Commit Graph

2289 Commits

Author SHA1 Message Date
Fedor Isakov a72327630e Implement runtime support for call and expand macro templates. 2020-03-31 11:27:09 +02:00
Fedor Isakov ea670422f1 Introduce ExpandMacro template and prototype.
ExpandMacroTemplate to be used for dispatching macro invocations
based on the concept of the specified node.
Prototype is an abstraction to be implemented by
specific templates.
2020-03-31 11:27:09 +02:00
Fedor Isakov d5ea8e8006 Introduce CallMacroTemplate, necessary refactorings. MPSCR-25
Call macros are to be parameterized with logicals and other parameters.
To replace combined expand/call macros causing confusion.
Context parameters to be passed explicitly.
2020-03-31 11:27:09 +02:00
Grigorii Kirgizov 79952036cd Fix ternary operator typechecking 2020-03-26 18:17:06 +03:00
Grigorii Kirgizov 13e1e10f59 Disable assertion failing for lambdacalc, related to proper parent match tracking
Problem lies in that journal doesn't track all justifications
for reactivated occurrences. For a parent of such occurrence
its original activating match is considered, while
justifications from the Reactivating match aren't tracked.
So, this information about immediate reactivating parent is lost.

lambdacalc lang typesystem heavily uses reactivation, so it fails.
2020-03-26 13:40:42 +03:00
Grigorii Kirgizov 654031c05c Extend docs for Justified.justifiedBy relation, add assertion for its antisymmetric property 2020-03-26 13:40:42 +03:00
Grigorii Kirgizov a2675351b5 Track justifications for all occurrences, but weaken information they carry.
Now Evidence isn't unique for each Chunk: Occurrence Chunks fully
share evidence and justifications with their activating match.
So, less collections of justifications are created, approx. 2 times less.
2020-03-26 13:40:41 +03:00
Grigorii Kirgizov 6a53d15a21 Refactor: move logic related to tracking parent match from ControllerImpl to MatchJournal
Relates to machinery introduced in MPSCR-47.
Previously parent match was maintained in Controller on Java call stack.
Now this stack of parent matches is maintained manually in MatchJournal.

So MatchJournal gains new invariant: parentChunk()
returns correct parent after each logMatch() call.
Several tests fail, also need to maintain this
invariant after logActivation() calls.
2020-03-26 13:40:41 +03:00
Grigorii Kirgizov c51d767926 Add typechecking for all missing operators. Refine missing cases, check compatibility. Properly handle ternary op. Add tests. (MPSCR-3) 2020-03-25 20:11:52 +03:00
Grigorii Kirgizov b6aaec8870 Revert temporary workaround for MPSCR-51 from 16e39a93 2020-03-23 14:39:54 +03:00
Grigorii Kirgizov 91e4d2b582 Revive 'principal' rule feature for MPSCR-51. Mark those rules in BL typesystem.
Introduce 'auxiliary/essential' notions instead of 'principal/not principal'.
2020-03-23 14:28:14 +03:00
Grigorii Kirgizov 8874e8eb2c Complete checking rules for overriding methods (add signature clash check, JLS12 8.4.8). Add tests for that. (MPSCR-3) 2020-03-18 19:50:17 +03:00
Grigorii Kirgizov 7a5a5388b1 minor fix: suppress out of scope error in node test code 2020-03-17 18:36:41 +03:00
Grigorii Kirgizov 16e39a9345 Check applicable scope for certain checking rules in BL (workaround for BL for MPSCR-51). Fix SubclassingUtil.
Modified TYPECHECK query to include "checkingScope" query parameter:
it is a root node for which program is generated (for local typechecking it's local node).
Rules additionally match on a constraint `checkDecls(node<>)` bearing this node,
so while rules will be generated for all scopes, only those in applicable scopes will run.

Also split rule for EnumConstantDeclaration on declration checking and just typing rule.
2020-03-17 17:54:38 +03:00
Grigorii Kirgizov 8d1f086562 Rewrite check_ClassifierOverridingMethods checking rule in Coderules. Rename several rules. (MPSCR-3) 2020-03-17 13:14:41 +03:00
Grigorii Kirgizov 455aea18d0 Refactor: compute instantiated subclass paths in SubclassingUtil more efficiently and allow resolving type vars with it 2020-03-16 17:59:19 +03:00
Grigorii Kirgizov 873d04c907 Add typechecking of Enums (MPSCR-3). Also avoid getting Classifier types with prim types as type args
Now primitive types in conversion relation are handled before processing of free inference vars.
So primitive types first get boxed and only then these terms can be unified with inference vars.
2020-03-16 16:42:03 +03:00
Grigorii Kirgizov b10b69545e Refactor: hide mutability of Chunk.entries (both as var and as MutableList). Add a bit of docs. 2020-03-12 18:02:22 +03:00
Grigorii Kirgizov 7c40295948 Add test cases for boxing/unboxing, complete typechecking for boxing (MPSCR-3) 2020-03-12 18:02:21 +03:00
Grigorii Kirgizov a5cc88aeef Fix typechecking for qualified this expr (MPSCR-3) 2020-03-12 14:54:40 +03:00
Grigorii Kirgizov 73fd59e58e Add more test code for checking some cases of BL method overriding logic. Muted for now. (MPSCR-3)
It's unclear who should handle this: coderules or old typesystem checking rules.
2020-03-12 14:01:30 +03:00
Grigorii Kirgizov af0a118273 Fix mistake introduced in 591865b9: return copy of invalidated tags, not ref (fixes MPSCR-50) 2020-03-12 11:02:46 +03:00
Grigorii Kirgizov a2d28e566a Tried to reproduce MPSCR-50 -- typechecking works okey, problem lies elsewhere 2020-03-12 10:36:26 +03:00
Grigorii Kirgizov a4d561b5a4 Drop now unused subclassing / promote rules operating on raw Classifier values 2020-03-11 15:51:26 +03:00
Grigorii Kirgizov 88a433584b Simplify subclassPaths rule, add a test for now used SubclassingUtil's method
Previously type substitution in subclssing path is computed
by helper method instead of a code inside rule template.
2020-03-11 15:46:16 +03:00
Grigorii Kirgizov fea3d5d021 minor: align NestedGenerics test with javac 2020-03-11 15:22:54 +03:00
Grigorii Kirgizov 7b143bdb6f Ensure typeVarBound constraint is produced once for each tv decl. Fix capture of type var.
Fixes typechecking tests.
Type var bounds are produced together with genDecls at program start.
Now bound of type var is captured only when needed --
inside convertsTo check, leaving typeVarBound intact.
2020-03-11 12:29:43 +03:00
Fedor Isakov 253a7609a3 Introduce typeVarBound constraint to handle typevar bounds.
Since it's no longer possible to have cyclic terms,
the term for type variable type has to be refactored:
the bound information is attached via typeVarBound constraint
on the type.
2020-03-11 12:29:19 +03:00
Fedor Isakov 856c7cc777 Dereference all refs within term on unification.
Method findSolution now walks all refs inside a term.
This guarantees no "hidden" cycles, but also breaks the
"cyclic term" feature.
2020-03-11 12:29:04 +03:00
Fedor Isakov 914507329e Introduce checking flag to context, avoid failure in rule match.
Processing a match may fail because of unification went wrong.
To avoid these transient failures to propagate to program trace,
context can optionally abort instead of fail, which is then
recovered from.
2020-03-11 12:28:23 +03:00
Fedor Isakov 4020989bde Defensive copying of argument list.
SModel returns a model-based list by default.
Since it is used w/o a read action, we need to copy the list
to be used as constraint's argument.
2020-03-11 12:28:22 +03:00
Grigorii Kirgizov e1ac188023 Produce proper type erasure for raw classifiers: type variables are erased to their bounds 2020-03-11 09:41:18 +03:00
Grigorii Kirgizov d3d567101f Add typechecking for return type covariance and tests for it (MPSCR-3) 2020-03-11 09:41:08 +03:00
Grigorii Kirgizov 591865b9cb Small opt: skip traversing journal when there're no rules to invalidate/add 2020-03-10 13:31:34 +03:00
Grigorii Kirgizov 60f838eb28 Add tests for unification of terms with var refs 2020-03-10 12:22:22 +03:00
Grigorii Kirgizov 831871a81b minor refactor: drop few usages of LogicalDataForm.logical() which were used for checking equality, use appropriate .symbol() instead 2020-03-06 14:04:18 +03:00
Grigorii Kirgizov 7f840e2899 Refactor: drop deprecated Path class and DataForm.attached() method operating on it 2020-03-06 14:04:18 +03:00
Grigorii Kirgizov 92f95674b3 Refactor: drop meaningless DataForm.asRoot (used symbolPath which is deprecated) 2020-03-06 14:04:18 +03:00
Grigorii Kirgizov f5f1fe3916 Reproduce cause of MPSCR-45 in unification solver 2020-03-06 14:04:18 +03:00
Grigorii Kirgizov 441f203084 Revert "Remove throwing NPE on Term.symbol() given updated NotNull contract"
Leave exception because can't strongly rely on NotNull java annotation.
This reverts commit 6f49d63f
2020-03-06 14:04:18 +03:00
Grigorii Kirgizov 54f8c7a6be Change usages of ConstraintsProcessing.parentChunk() to usages of tracker parent 2020-03-06 14:04:18 +03:00
Fedor Isakov 485eedea5e Ensure no infinite recursion is possible in toString.
Scheduler in rxjava2-swing seems to cause a peculiar bug
that is difficult to reproduce.
Seems like AtomicReference or one of its subclasses
gets itself as the value, which triggers infinite recursion.
2020-03-05 22:18:13 +01:00
Fedor Isakov 77c44e9066 Ensure RxSwingPlugins is unset and scheduler initialized. 2020-03-05 18:18:20 +01:00
Fedor Isakov 5a16c4d23b Drop ModelPropertiesChecker temporarily from CheckProjectModules test. 2020-03-05 16:48:04 +01:00
Fedor Isakov 8328467a54 Fix java stub locations for RxJava. 2020-03-05 16:23:47 +01:00
Fedor Isakov a894b33983 Update to the latest RxJava2 and Swing adapter. 2020-03-05 15:49:04 +01:00
Fedor Isakov 719956007a Increase timeout to 10 sec, try to fix the test. 2020-03-05 10:11:37 +01:00
Grigorii Kirgizov 6f49d63fae Remove throwing NPE on Term.symbol() given updated NotNull contract 2020-03-02 22:08:51 +03:00
Grigorii Kirgizov 2ec4abe860 Maintain invariant that justifications of a MatchJournal.Chunk are inherited by all its children Chunks
Retroactive addition of justifications to a parent Chunk (MatchChunk.justifyBy),
introduced by a recent fix for MPSCR-47, can broke this invariant.
2020-03-02 22:08:51 +03:00
Grigorii Kirgizov 81721a0067 Ensure MatchJournalImpl.replay is idempotent operation, add test for it
Add another test for replaying inside Chunk.
Doesn't pass for now for the lack of machinery for tracking precise Pos.
2020-03-02 22:03:05 +03:00