Commit Graph

565 Commits

Author SHA1 Message Date
Grigorii Kirgizov ad9f02dd7d Fix rule name generation (consider query rules also). Sort results of principals analyzers
Also deprecate unsude 'queryName' prop in QueryTemplate
(it inherits from INamed.. so it has name, which is used)
2020-07-01 14:36:48 +03:00
Grigorii Kirgizov a3e6c4d552 minor: Implement extended interface for IncrProgramSpec
Defines notion of weak principal rule. Relevant for MPSCR-62
2020-07-01 14:36:48 +03:00
Grigorii Kirgizov f9ca9f2766 Handle usedDataHash computation for macros
Fixes IncrClosureInference.changeFunctionalInterfaceParam test.
Temporary rules built as macro applications weren't computing hash
due to origin!=null condition. Also macro inputs weren't processed.

Stable hash for TypeVarSubstitution is defined because it's used in macro args.
In general, any classes used as constraint/predicate/macro args
must adhere to stable hashCode() contract: hash should change
if there're important changes that may influence typechecking result.
Otherwise there may be unnecessary incremental recomputations.
Relevant for MPSCR-62
2020-07-01 14:36:48 +03:00
Grigorii Kirgizov 8ccfa63111 Add test methods for ensuring incremental logic for rules diff 2020-07-01 14:36:48 +03:00
Grigorii Kirgizov 36e4e01f2e Аdd tests for changes to class hierarchy with generics 2020-07-01 14:36:45 +03:00
Fedor Isakov 0d2fe10940 Make unhandled failures visible in evaluation result.
An unhandled failure is only shown as "suppressed".
The evaluation result must also indicate the error.
2020-06-28 17:14:35 +02:00
Fedor Isakov 53f03d83d6 Fix isRelevant logic for converts/coerce queries.
Take into account the language that contains concept declaration
of the passed node(s).
2020-06-28 17:14:35 +02:00
Fedor Isakov a829fdba12 Fix access to session in queries generator template. 2020-06-28 17:14:35 +02:00
Fedor Isakov 598d6c109d Make incremental test launcher fail on errors during evaluation.
Also provide a method to check that a node has "error type" assigned,
which may come in handy.
2020-06-27 10:35:47 +02:00
Fedor Isakov d2d4578514 Ensure typechecking cache is cleared on reload classes. 2020-06-25 20:48:17 +02:00
Fedor Isakov f6154be66b Refactor Effect to rely on Result for errors collecting.
Result class encapsulates errors collected during step execution.
Simplify CoderulesHelper and callback interface.
2020-06-25 14:30:31 +02:00
Fedor Isakov 9c1d3aad92 Move Result class to commonly-used runtime solution. 2020-06-25 14:30:30 +02:00
Fedor Isakov 4350d43ddb Simplify Result class design, drop unnecessary MITM class. 2020-06-25 11:40:16 +02:00
Fedor Isakov 735a97a0e7 Drop obsolete feature "checkGarbage" 2020-06-25 11:40:16 +02:00
Fedor Isakov b6fd3ea464 Minor refactoring: remove message handler from MacroTemplateIndex. 2020-06-25 11:40:16 +02:00
Fedor Isakov e4347fc092 Refactor DataFormPrinter to use Memoizer, support nested terms.
DataFormPrinter is hardcoded to support _term and _subterm
hacks and present the terms in a readable way.
Memoizer is searched for an implementation of
NodePresentable, which helps with visualization of SNode
and SNodeReference.
2020-06-21 23:17:33 +02:00
Fedor Isakov 44a25ada3a Enable extracting term presentation via delegate.
Provide an instance of NodePresentable that ought
to serve as the delegate proxy for extracting node
presentation.
2020-06-21 23:17:33 +02:00
Fedor Isakov ab99a0245c Introduce runtime support module j.m.coderules.runtime. 2020-06-21 23:17:33 +02:00
Fedor Isakov 2bf415e8af Deprecate obsolete interface. 2020-06-18 13:05:24 +02:00
Fedor Isakov 9db3dbbcfd Restore empty list as default value in term constructor.
Term constructor creates all features with default values where
not overridden. The default values for "value" and "child"
features are wildcards for now (TBD), the default value for
list feature is an empty list.

The rationale is that a rule's head defining term pattern with
a logical variable capturing list feature will not be matched
with a free logical variable. Thus, to avoid having to always
explicitly specify all term features, a term constructor that
is not a pattern must use the default values for non-overridden
features.
2020-06-18 13:05:24 +02:00
Fedor Isakov 5c376168b4 Introduce match constraint.
Match constraint is provided for use cases where the intention
is to pattern-match a term capturing features into logical
variables.
A term constructor in the right-hand side of match constraint
is a pattern, and all its non-overridden features are
to be defined as wildcards.
2020-06-18 13:05:24 +02:00
Grigorii Kirgizov 4876c22282 Refactor single root of incremental tests into several, move IncrTestBuilder 2020-06-16 14:14:46 +03:00
Grigorii Kirgizov a03651dd31 Refactor IncrementalLauncher in tests to use TypeIndex (as on runtime) 2020-06-15 13:03:09 +03:00
Grigorii Kirgizov 62d31743ed Refactor incremental tests 2020-06-15 11:14:47 +03:00
Grigorii Kirgizov f3d62dbc94 Handle MacroTemplates in principal constraints analysis
It's possible to activate constraints in macros, so they must be also handled.
Also restrict a bit principal rules analysis: consider only rules with template input.
2020-06-08 19:02:20 +03:00
Fedor Isakov 6f9958e432 Minor optimization in UnificationPredicate. Adapt to DataProvider interface. 2020-06-04 11:44:07 +02:00
Fedor Isakov 04c2dfb385 Implement DataProvider interface in DefaultSupervisor. 2020-06-04 11:44:07 +02:00
Fedor Isakov 68c2d212a5 Fix presumable memleaks in activation trace view.
The leak may have been caused by TabContentLayout's
myLastLayout keeping a live reference to the component.
2020-06-04 11:44:07 +02:00
Fedor Isakov b8f2d63353 Access NavigationManager as service, fix memleak. MPSCR-56 2020-05-25 11:03:39 +02:00
Fedor Isakov 5f6ea9e6c1 Fix NPE in checking rule. 2020-05-25 11:03:39 +02:00
Fedor Isakov d4c2e6f303 Fix property constraint for when splice is present. 2020-05-25 11:03:39 +02:00
Grigorii Kirgizov 400198f965 Adjust principal constraints analysis to not consider node refs wrapped in terms
It makes definition of principal constraint clearer:
principal constraint is a constraint that has at least one arg
of type node<> and passes to it ruleOrigin in at least one rule.

Such constraints are most likely meant to define relations
of nodes to terms, e.g. `typeOf` -- which is what we're interested in.

At the same time semantics of values inside terms is less defined.
TermFeatures are also untyped, and so complete analysis of
ValueFeatures would require full code traversal of coderules program
to find out whether a value feature is used to carry smth of `node` type.

Relevant to MPSCR-62.
2020-05-22 21:40:03 +03:00
Grigorii Kirgizov e2b3c21b2f Change semantics of implicit ListFeature: treat as wildcard, not as empty list
Motivation is that implicit (non-overriden) list features must unify
with list of any length. Consider an example:
`classifier(cls: node-ptr/A/) = classifier(cls: node-ptr/A/ param: [B,C])`
With previous approach it would fail, which seems counter-intuitive to me.
So, if empty list (e.g. of type parameters) is meant, then it must be
specified explicitly.

There's one thing to remember, though: such wildcard list features
won't match with MetaLogicalArrays in rule heads.
(e.g. see dpromote_* rules and consider what happens when
a classifier with unbound `parameter` feature comes in)
2020-05-21 16:38:36 +03:00
Grigorii Kirgizov 9bbcf6ecef Allow terms to inherit features from ancestor terms
Avoides the need to exactly duplicate features of ancestors.
Opens possibility to match on super-terms
with partially provided (overriden) features.

For example, suppose there's `typeParameterized(child: param)`
term which is extended by `classifier` and `methodSignature`.
Then it becomes possible to write a common rule for both terms,
matching on `typeParameterized(param=[Smth])`.
2020-05-21 16:31:36 +03:00
Grigorii Kirgizov 36606e5740 Add a test for AspectClique for the case of asepct with branches 2020-05-11 15:20:37 +03:00
Fedor Isakov da43822154 Manually migrate try statements that were not auto-migrated. 2020-05-09 15:07:06 +02:00
Fedor Isakov 14780b5561 Apply automatic migrations. 2020-05-09 15:04:25 +02:00
Fedor Isakov d1163fc883 Open and rebuild the project with MPS 2020.1. 2020-05-09 15:02:20 +02:00
Fedor Isakov f3b16186e6 Fix build scripts and regenerate. 2020-05-09 10:54:18 +02:00
Fedor Isakov c4fc687f76 Refactor and simplify code in AspectClique. Write tests.
Treat a language and its sidekick (if any) as a single vertex.
Add all extended languages to the pool before building the graph.
Drop dubious invariant check.
Fix the second pass in findAspectCliques ingnoring the fact
that there might be leafs without aspects.
2020-05-09 10:53:40 +02:00
Fedor Isakov 5bac140e61 Drop unnecessary test languages. 2020-05-07 10:23:04 +02:00
Fedor Isakov f2bcaffccc Revert "Upd coderules buildscript, regen build.xml"
This reverts commit 6b826334
2020-05-07 10:18:16 +02:00
Fedor Isakov 65429c800e Test for AspectClique. Use test model instead of real languages. 2020-05-07 10:16:55 +02:00
Fedor Isakov 4744081e36 Refactor AspectLookup and related interfaces for testability.
Simplify interfaces, abstract away the direct dependency
on LanguageRutime, make the code in AspectClique testable.
2020-05-07 10:16:53 +02:00
Grigorii Kirgizov 6b82633450 Upd coderules buildscript, regen build.xml 2020-05-07 02:37:35 +03:00
Grigorii Kirgizov cd3e56c16a Handle case of language cycles in AspectClique, add simple test with lang cycle (MPSCR-60) 2020-05-07 02:21:26 +03:00
Grigorii Kirgizov e7d23f9b6d Redefine how Aspect Cliques are found (fixes MPSCR-60)
Now algorithm for finding aspect cliques includes 3 stages:
1) topological sort (as before)
2) bottom-up pass with initial assignment of clique ids (as before)
3) top-down pass (i.e. in reverse topo sort order) (added stage)

The 3rd stage handles case when hierarchy of langs with
required aspect include branching point (with no join further down),
as in the case of closuresExt & collectionsExt both extending blExt,
but unrelated to each other (neither extends the other).
2020-05-07 01:28:14 +03:00
Grigorii Kirgizov bb5412230a Fix topo sort in Aspect Clique and add check for graph acyclicity (MPSCR-60) 2020-05-07 01:28:14 +03:00
Fedor Isakov 587711a3e8 Drop deprecated class and its usages. 2020-05-05 15:58:48 +02:00
Fedor Isakov d3a72049e8 Drop deprecated stuff from coderules lang. 2020-05-05 15:58:48 +02:00