Commit Graph

2255 Commits

Author SHA1 Message Date
Grigorii Kirgizov b526afd357 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:26:03 +03:00
Fedor Isakov 991ae30ef7 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-10 14:31:23 +01:00
Fedor Isakov c7fb0502cc 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-10 14:31:20 +01:00
Fedor Isakov 05bfe0002a 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-10 14:31:20 +01:00
Fedor Isakov ecafb2da6d 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-10 14:31:20 +01:00
Grigorii Kirgizov df1750fee6 Add tests for unification of terms with var refs 2020-03-06 14:05:29 +03:00
Grigorii Kirgizov f71d734853 Reproduce cause of MPSCR-45 in unification solver 2020-03-06 14:05:29 +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
Grigorii Kirgizov 5c4b1f8263 Add test that ensures that justifications invariant is preserved by a fix to MPSCR-47
Invariant ensures that retroactively added justifications
(added on past parent chunk, see fix commit) are propagated
for all relevant children of justified parent chunk.
2020-03-02 22:03:05 +03:00
Grigorii Kirgizov 2b92e5df04 minor: rename test method princConstraint to pconstraint 2020-03-02 17:58:05 +03:00
Grigorii Kirgizov 7af3f29a6d Provide additional justifications for nearest relevant Chunks on certain matches. Fixes MPSCR-47
Such cases arise when non-principal rules can match on principal occurrences
(for example, capture_Classifier rule in BaseLanguage typesystem).
We don't want to lost justifications provided by these occurrences,
so store them in the nearest relevant chunk --- which is a parent match chunk.

With this the invalidation of the tracked principal occurrences will lead to invalidation
of this relevant match and so to invalidation of any effects produced by non-principal rules,
because they're logged exactly under the chunk of that relevant match.
See tests from previous commits for example.
2020-03-02 17:11:26 +03:00
Grigorii Kirgizov ccd3ed6d45 Add tracking of last justifying MatchChunk during program eval to avoid searching for it in Journal
Such machinery is needed inside ControllerImpl.processBody
to provide nearest relevant match to feedback handling.
Also required for a fix for MPSCR-47.
Also enables back one assertion in incremental processing on rm stage.
2020-03-02 17:11:26 +03:00
Grigorii Kirgizov a9af387816 Fix IndexedSignatureSet.remove method which didn't clear signatures, clear internal index also 2020-03-02 17:11:26 +03:00
Grigorii Kirgizov 38924ef64d Add 2 tests on incremental engine, reproduces case of MPSCR-47 2020-03-02 17:11:26 +03:00
Grigorii Kirgizov 8102080809 Refactor: drop unused on MPS level java interfaces 2020-03-01 17:12:15 +03:00
Grigorii Kirgizov 37dd3ee4a8 Refactoring: extract Justified interface and hide lower-level work with Int sets behind it
Make Occurrence a Justified entity and drop .justifications() from
ConstraintOccurrence.java because justifications are used only internally.
A single justification is now called Evidence (typealias to Int),
so Justified entities are justified by Evidence-s.
2020-03-01 17:12:15 +03:00
Fedor Isakov 3193a9c078 Adjust nullability contract in occurrence matcher.
Term's symbol can't be null.
Also guarantee that when processing a match no null
values occur.
2020-02-28 17:42:54 +01:00
Fedor Isakov fec446f006 Drop wrapping substitutions in favour of regular actions.
The editor for evaluating late expression inserts $() construct
first, then allows to enter the expression.
A couple of minor fixes and a workaround.
2020-02-27 14:48:37 +01:00
Grigorii Kirgizov a619b017ec Fix NPE in UpdatesRecorder on roots move/remove
In such cases typechecking was failing on the point of computing changeSetClosure,
because changeSet got null nodes from SNodeChangeEvents
2020-02-26 18:58:05 +03:00
Grigorii Kirgizov 707982fbe9 Include changed nodes from different roots in invalidated set for incremental program update. (MPSCR-46)
The core chang in is InvalidateAndApplyTemplatesStep.
Also rename SNodeEventsFilter to RelevantNodesTracker.
2020-02-26 18:58:05 +03:00
Grigorii Kirgizov 025232969d Track change events from all referred models (MPSCR-46)
UnitTypecheckingCacheHolder now holds the data needed for ChangesTrackers.
This data is updated by UpdatesRecorder: different models and nodes from different roots are tracked.
2020-02-26 18:58:05 +03:00
Fedor Isakov 2e9a1e8dbf Support deleting pattern from logical variable in head. 2020-02-26 16:08:50 +01:00
Fedor Isakov f2bb87e1b0 Apply migration to replace deprecated concept. 2020-02-26 15:03:31 +01:00
Fedor Isakov c064972266 Deprecate obsolete concept, provide migration. Minor editor fixes.
ExpressionLogicalVariable is replaced with ExpressionItem wrapping
the same expression.
Fixes ensure correct application of transformations.
Late expression can't be used as "placeholder" logical item.
2020-02-26 15:01:29 +01:00
Fedor Isakov 2a5b3661b8 Use EvaluationSetting tag for constraint context.
Concepts supposed to contain constraints are
effectively implementing evaluation setting.
2020-02-24 22:57:05 +01:00
Fedor Isakov 7ba7c983cb Apply migration to use logical variable ref expression. 2020-02-24 22:57:05 +01:00
Fedor Isakov 630fd33629 Introduce logical var reference expression.
This expression is to be used in those rare cases
when a logical var is to be passed to an external method.
Not available within EvaluationSetting (new marker interface).
Normally logical variable (as an instance of LogicalItem)
is only to be used within a logical context.
Logical item value expr only to contain a logical variable.
2020-02-24 22:56:54 +01:00
Fedor Isakov e1c5f68e3e Typechecking templates: minor refactoring, optimizing code.
Replace node-ptr<> type with node<> where applicable.
Use node<> type is ok in constraint arguments.
Replace instances of LateExpressionItem $() with ExpressionItem.
2020-02-20 14:52:28 +01:00
Fedor Isakov 2c43762f93 Replace all instances of .pointer in constraints to node reference.
SNode is supported now directly as an argument to constraint/predicate.
Pointer operation is no longer necessary, as is node-ptr<> type for logical vars.
2020-02-20 11:59:28 +01:00
Fedor Isakov 8ec26b4e94 Support node<> argument in constraints. Prepare to get rid of node-ptr<>. Minor refactoring. 2020-02-20 11:59:28 +01:00
Fedor Isakov ee36d879b3 Make better editor for provide feedback and fail constraints. 2020-02-20 11:59:28 +01:00
Fedor Isakov 3758971194 Fix the only instance of ExpressionItem that doesn't wrap .pointer op. 2020-02-20 11:59:28 +01:00
Grigorii Kirgizov 6a67865554 Fix NPE in new ChangesTracker in UpdatesRecorder on broken references (relates to MPSCR-44) 2020-02-19 01:04:55 +03:00
Grigorii Kirgizov 725a438bca Use same information for incremental program update and types cache invalidation (fixes MPSCR-44)
Previously there were two independent ChangeTracker-s in UpdatesRecorder and UnitTypecheckingCacheHolder.
Now, given more elaborate logic for tracking changes to types (which includes changes in different roots)
this information must be propagated from UpdatesRecorder to cache holder,
so that if there're changes relevant for recomputing types then types cache is also invalidated.
2020-02-18 23:39:26 +03:00
Grigorii Kirgizov 5abbccf511 Collect changes in UpdatesRecorder in referred-to roots (MPSCR-44) 2020-02-18 23:35:23 +03:00
Fedor Isakov 9a6859a5d9 Refactor usages of TargetSpec parameter to target{} block.
TargetSpec is to be reduced to a reference to logical variable,
simplifying the feedback predicate.
When a node can be specified directly, use target{} block.
2020-02-17 12:49:26 +01:00
Fedor Isakov 417fc45933 Restore origin ref in RuleEx interface, fix terminology in templates API.
To avoid confusion, a rule defines "target ref", which is supposed
to indicate the source code location for possible errors.
The origin node is to be referred as "origin" as before.
Temporarily rename OriginSpec's alias to "target" to reflect change
in semantics.
2020-02-17 11:57:14 +01:00
Grigorii Kirgizov a8f3ed8d9a Store reversedRequirements in UpdateRecorder by SNodeId, not by SNodes themselves (fixes MPSCR-42)
Sometimes UpdatesRecorder can log changes of SNodes which have same SNodeId, but different identity.
Thus reversedRequirements map returned nothing on such nodes and these require-dependencies were not handled.
Such case is described in MPSCR-42 ticket.
2020-02-13 17:12:33 +03:00
Grigorii Kirgizov 9001286ebe Add incremental test. Tried reproduce MPSCR-42 with auto-test, but it appeared only from Editor action. 2020-02-13 17:12:33 +03:00
Grigorii Kirgizov c004ef888a Avoid producing typeVariable term with null decl inside (MPSCR-40) 2020-02-12 20:24:04 +03:00
Grigorii Kirgizov f9602c8bbf Throw on null terms in term trie (relates to MPSCR-40)
For more clear errors stemming from usage of constraints with null values, which ain't handled
2020-02-12 20:15:07 +03:00
Grigorii Kirgizov 2aeadaf63f Always silently handle wildcard classifiers to avoid errors while handling 'promote' relation (fixes MPSCR-41) 2020-02-12 20:15:07 +03:00