Commit Graph

577 Commits

Author SHA1 Message Date
Fedor Isakov fd812f2369 Avoid raising exception from disposed provider. Forgotten deactivate call. 2020-07-09 11:27:05 +02:00
Fedor Isakov 00897f843f Refactor isRelevant, make dependent on provided LanguageRegistry. 2020-07-09 10:05:53 +02:00
Fedor Isakov d77459b1de Respect NullEffect for the sake of naming stages. 2020-07-09 10:05:53 +02:00
Fedor Isakov 9c9acceb96 Refactor effects composition for better readability. A couple of minor fixes.
Drop recording of "suppressed exception" by CoderulesHelper.
Report failed program evaluation as info message.
Ensure traces are available for failed evaluations.
2020-07-07 18:42:16 +02:00
Fedor Isakov ca973ddc51 Fix test compilation. 2020-07-07 13:50:43 +02:00
Fedor Isakov a60c41905c Ensure typechecking cache cleared on classes reload. 2020-07-07 13:12:16 +02:00
Fedor Isakov 598b7e596b Refactor TypecheckingService to do all error reporting. Fix isRelevant logic.
Use the same logic for TypecheckingProvider.isRelevant() as in AspectLookup
with additional test for directly imported languages.
2020-07-07 13:12:14 +02:00
Fedor Isakov 9a6298778a Process node's descendants while looking for apsect clique. 2020-07-03 16:35:48 +02:00
Fedor Isakov e76eeeb676 Ensure failures during query template application are reported. 2020-07-03 16:35:48 +02:00
Fedor Isakov 19a1f881bc Simplify Step API. Enable collection of errors while applying templates. 2020-07-03 16:23:00 +02:00
Fedor Isakov c89bde5bed Fix NPE by checking for not null. 2020-07-03 16:23:00 +02:00
Grigorii Kirgizov acfac19a1c minor: specify rule in msg for InvalidRuleException 2020-07-01 14:36:48 +03:00
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