Commit Graph

1094 Commits

Author SHA1 Message Date
Fedor Isakov 5bd41f1098 Introduce typechecking term table 2021-08-17 09:30:35 +02:00
Fedor Isakov c6453b7293 Introduce hack for finding refs in LateParameter 2021-08-17 09:29:57 +02:00
Fedor Isakov 6b0526ba31 Introduce language j.m.l.types to contain aspect-related generator mappings 2021-08-17 09:29:21 +02:00
Fedor Isakov 837be3fe64 Fix reference to query classifier to be a node, initialize TypecheckingQueries 2021-08-04 13:24:59 +02:00
Fedor Isakov b1fbf7265e Update plugin version and platform compatibility 2021-07-29 15:17:18 +02:00
Fedor Isakov c4db4fcafe Set generator options: strict=false in build scripts 2021-07-29 14:18:29 +02:00
Fedor Isakov 617a7d77a5 Fix build script 2021-07-29 12:46:57 +02:00
Fedor Isakov 4b64377ac6 Introduce dsl constructs for typechecking queries
A root TypecheckingQueries is to replace the generic Queries
from j.m.lang.coderules.
2021-07-29 12:46:57 +02:00
Fedor Isakov 4f22a7959d Fix LateExpression generator: avoid interfering with other gen templates 2021-07-29 12:46:57 +02:00
Fedor Isakov 4d06adf85b Rename isAssigned to isNonfree for consistency 2021-07-22 15:46:21 +02:00
Fedor Isakov 4ea1d0cadd Feature: isGround and isNonground predicates, MPSCR-94 2021-07-22 13:59:19 +02:00
Fedor Isakov 4e02433491 Make rule input and session variables available in rule methods 2021-07-06 13:42:41 +02:00
Fedor Isakov 2425fe933a Ensure dependency is tracked for nested expand macro applications
Expand macro passes the rule's input to nested macro calls.
This adds the macro input as the dependency of the rule's input.
As a result, incremental processing starts working in some cases.
2021-06-30 18:25:46 +02:00
Fedor Isakov f83757b69a Rollback aspect devkit for bootstrap languages 2021-06-29 18:10:21 +02:00
Fedor Isakov 17e1bc4589 Applied migration 2021-06-29 14:51:10 +02:00
Fedor Isakov c4811d7d74 Migration of types aspect
Add types aspect devkit, remove engaged in generation.
2021-06-29 14:51:10 +02:00
Fedor Isakov dd8c5ffb07 Introduce types aspect devkit and genplan 2021-06-29 14:51:10 +02:00
Fedor Isakov 9ea7ae2067 Better naming scheme for downloadable artefacts 2021-06-21 18:35:48 +02:00
Fedor Isakov 9826290f78 Fix building and packaging the plugins 2021-06-21 17:50:00 +02:00
Fedor Isakov a8b0b13513 Include build solution into coderules plugin; fix file name 2021-06-18 18:41:01 +02:00
Fedor Isakov 9527a097b8 Migrate to the latest MPS release, apply migrations 2021-06-18 18:41:01 +02:00
Fedor Isakov e03a65760c Adjust style for fail constraint 2021-06-18 18:41:00 +02:00
Fedor Isakov c153d605e6 Auto-fix 2021-05-18 12:32:03 +02:00
Fedor Isakov 02baab4100 Optimize AspectLookup: avoid traversing descendants of input 2021-05-18 12:32:03 +02:00
Fedor Isakov 1d620cdd63 Drop obsolete unused features, cleanup the code 2021-05-18 12:32:03 +02:00
Fedor Isakov 24ce9167bf Drop second implementation of aspect lookup, unify usages of AspectLookup 2021-05-18 12:32:03 +02:00
Fedor Isakov 1bb8763816 Refactor AspectLookup to depend on repository, cache results 2021-05-18 12:32:03 +02:00
Fedor Isakov 1925ee9ef6 Auto-corrected 2021-05-13 15:54:43 +02:00
Fedor Isakov 4ee3869b45 Introduce a means to use direct reference to INamedConcept in rules 2021-05-13 15:54:42 +02:00
Fedor Isakov 338ea4109e Limit LogicalItemValueExpression to contain LogicaVariable 2021-05-04 18:24:30 +02:00
Fedor Isakov 637da7d966 Apply migration and rebuild project 2021-05-04 18:24:30 +02:00
Fedor Isakov 0a7623fa3b Migration to LogicalItem for the rest of expressions 2021-05-04 18:24:30 +02:00
Fedor Isakov ce1569f4f6 Enable DataNodeLiteral in EvaluationSetting, only for lists 2021-05-04 18:24:29 +02:00
Fedor Isakov 06083bdd30 Disable entering DataNodeExpression in EvaluationSetting 2021-05-04 18:24:29 +02:00
Fedor Isakov ea6e930954 Apply migration and rebuild project 2021-05-04 18:24:29 +02:00
Fedor Isakov a9fc3db841 Migrate to TermFeatureOverrid to LogicalItem
Deprecate TFO.getter
Disable entering LogicalItemExpression
2021-05-04 18:24:29 +02:00
Fedor Isakov 287c31c9f7 Process only pattern's top-level node when coercing
Ignore all contents of a pattern but the top level.
This covers most situations.
The pattern ought to provide information as to which
nodes are capturing variables.
2021-04-29 14:53:19 +02:00
Fedor Isakov abed4bd3e1 Avoid failing on an error in template application, allow recover 2021-04-28 08:54:25 +02:00
Fedor Isakov ab87c8a129 Support strong convert/coerce queries 2021-04-28 08:54:25 +02:00
Fedor Isakov cce261ec8c Fix cleaning up the caches on modules reload 2021-04-28 08:54:25 +02:00
Fedor Isakov 450f2e5989 Fix coerce to pattern with antiquotations.
A node from a pattern with antiquotations is treated as a "hollow"
type with only the form defined, and all parameters being capturing
variables.
This is a workaround for certain kinds of coerce queries that define
unsound pattern nodes.
2021-04-28 08:54:25 +02:00
Fedor Isakov 6088ac0085 Fix displaying of logical value variables in activation trace
Unassigned variables to be displayed as X?,
assigned to print their contents..
2021-04-28 08:54:24 +02:00
Fedor Isakov cff18e7ca5 Optimize RulePlanHandler
Avoid iterating over LinkedHashMap (ineffective).
Do topo-sort only once on creating the object.
2021-04-21 10:40:51 +02:00
Fedor Isakov 394cb720c1 Optimize program producing: drop checking of constraints
Constraints arity is no longer checked.
Checking for null arguments to constraints is done
in AbstractConstraint's constructor.
2021-04-19 22:55:09 +02:00
Fedor Isakov ff6b5ec6ae Apply migrations and rebuild project 2021-04-14 13:19:50 +02:00
Fedor Isakov 93fd42365a Fix NodeWalker ignoring annotations 2021-04-13 22:57:06 +02:00
Fedor Isakov 49357ab87a Drop all usages of "principal store" and "preamble" feature 2021-04-13 22:57:06 +02:00
Fedor Isakov 008887944d Refactor "incremental" tests launcher to not rely on incrementality
The incremental algorithm using history and replay/revalidate of
matches is deprecated and will be removed soon. The incremental tests
are now relying on the UpdataRecorder and RulePlanHandler to
implement incrementality.
2021-04-12 12:47:44 +02:00
Fedor Isakov 1769998f7f Implement Rule.isBasis contract, fix feedback basis processing
Invalidated rules set invalidates feedback that has any of them it in its basis.
Validated rules invalidates feedback that has all of validated
rules in its basis set.
2021-04-12 12:47:44 +02:00
Fedor Isakov 87a843088c Cosmetics: report ERR on a query finished with !success status 2021-04-12 12:47:44 +02:00
Fedor Isakov 077e1564b4 Refactor and optimize RulePlanHandler, drop obsolete contracts
RulePlanHandler does not rely anymore on fixed total order of
input nodes in a given rule template. An update constitutes a list
of rules/reqs generated for a pair template+input node.
All hacks that use sets of rule IDs removed.
Also, support for "new" and "dropped" rules removed, incremental algorithm
no longer supported.
2021-04-12 12:47:44 +02:00
Fedor Isakov 1d1db7cba5 Disable all preamble-related stuff 2021-04-12 12:47:44 +02:00
Fedor Isakov c37f8f82eb Minor optimization: rely on variable count when mapping terms 2021-04-12 12:47:43 +02:00
Fedor Isakov 384fc5dce8 Adapt all predicates to try-tell protocol 2021-04-08 12:41:17 +02:00
Fedor Isakov 28dd6c7a12 Implement feedback invalidation based on (in)validated rules
Refactor supervisor/feedback consumer to support feedback basis.
Track (in)validated rules tags in RulePlanHandler.
Both (in)- and validated rules cause associated feedback to be cleared.

Disable passing SessionToken in WatchingIncremental strategy;
this forces the correct journal recording but turns off incrementality.
2021-04-08 08:51:40 +02:00
Fedor Isakov 7c89dfdffd Refactoring in program producing: getting ready to drop incrementality
Optionally produce partial program in incremental mode.
A partial program includes all "static" rules plus the "required closure"
of all changed nodes.
Produce program for required nodes unconditionally.
Mark all rule updates as validated only if exlicitly asked for it.
2021-04-08 08:51:39 +02:00
Fedor Isakov b5ffb8c83c Drop TypesModuleOwner, stop caring to store types in a model
This feature causes major problems and is really hard to maintain,
while its utility is questionable.
2021-04-08 08:51:39 +02:00
Fedor Isakov 636c1a15ef Use tmp model to render type in Show Type Action 2021-04-08 08:51:39 +02:00
Fedor Isakov 99e248c5b3 Fix incremental update of reported feedback
Correctly detect cache up-to-date.
Refactor feedback reporting, provide origin node as the key.
Drop invalidated feedback correctly.
Code cleanup.
2021-03-23 12:48:06 +01:00
Fedor Isakov 2977b4dd19 Extend expand macro operation with rule input parameter, fix tracking dependencies
Enable recording the dependencies while expanding macro.
Rename/refactor operations in UpdatesRecorder to reflect the intent
of adding the dependencies.
2021-03-23 12:48:06 +01:00
Fedor Isakov 39f7ded3f4 Implement missing methods in typechecking provider 2021-03-08 12:34:40 +01:00
Fedor Isakov 7d60ddde46 Drop template trace view tool, merge into activation trace 2021-02-19 14:46:42 +01:00
Fedor Isakov 2ec038aed0 Fix FindApplicableTemplates action 2021-02-18 15:00:28 +01:00
Fedor Isakov 818d4087b2 Fix reported errors disappeared on returning to editor 2021-02-16 13:25:54 +01:00
Fedor Isakov 6a7219f528 Fix using local typechecking if root is null in session flags 2021-02-15 12:29:46 +01:00
Fedor Isakov 1cfe1ccc26 Add dummy empty model to fix build 2021-02-14 15:30:38 +01:00
Fedor Isakov 4755c0dfa0 Extract test helper classes into separate redistributable module 2021-02-14 15:12:58 +01:00
Fedor Isakov d25158b39f Change plugin packaging and versioning
All modules are to be located under languages/.
Version to be RELEASE-0.9-bBUILD
2021-02-13 10:20:09 +01:00
Fedor Isakov bd1753e2ef Fix plugin version number, ensure compatibility with MPS starting from 211 2021-02-08 10:11:58 +01:00
Fedor Isakov a3aa92e60a Temporarily disable test until problems with MPS build are fixed 2021-02-07 19:17:08 +01:00
Fedor Isakov 54cadb200a Repackage plugin 2021-02-06 15:28:03 +01:00
Fedor Isakov c62b7ee3c1 Fix model check errors in generator model 2021-02-04 18:04:06 +01:00
Fedor Isakov dee5db0e96 Drop instances of TermFeature.final property 2021-02-04 18:01:10 +01:00
Fedor Isakov ed55370a01 Fix model imports (hamcrest lib has been moved to another solution) 2021-02-04 12:27:55 +01:00
Fedor Isakov 7fe5a5ad7a Auto-updated files after migrating to MPS 2021.1 EAP 2021-02-04 12:26:59 +01:00
Fedor Isakov 676645fad2 Refactor DataForm presentation mechanism, drop unused code
Rewrite most of DataFormPrinter for simplicity.

Reformat presentation of terms, so that the specification comes at the beginning.
2021-02-04 09:16:10 +01:00
Fedor Isakov e06916b184 Refactor TypecheckingService: move logic into Request
Straighten up the code organization by consolidating logic
implementing a request within the corresponding Request
instance.
2021-02-04 09:16:09 +01:00
Fedor Isakov 0e50b0e1b4 Support coerce query to specified (pattern) type
Coerce with pattern expects resulting type to be matched with a node
specified in the pattern.
2021-02-04 08:51:00 +01:00
Fedor Isakov be156a5d31 Throw NPE in case an argument or symbol is null in term 2021-02-04 08:51:00 +01:00
Fedor Isakov ad269bb6b5 Ensure typechecking state is properly disposed of on reload 2021-02-04 08:51:00 +01:00
Grigorii Kirgizov b1d81ef683 Fix apparent type in DataFormPrinter test 2021-01-29 16:21:57 +03:00
Grigorii Kirgizov 148223a842 Add incremental tests for lambda calc. Enable ignored tests for closures. 2021-01-29 13:39:35 +03:00
Grigorii Kirgizov d1b5c5b477 minor fix in tests: propely hack finding needed aspect clique. allow custom type matchers (for lc) 2021-01-29 13:39:35 +03:00
Grigorii Kirgizov ccecb50fc2 Fix handling of invalidated feedback for effects of Rewind Stage to be visible (MPSCR-67, MPSCR-21) 2021-01-29 13:39:35 +03:00
Fedor Isakov 240fed8f63 Drop Finders feature: unused 2021-01-23 16:59:46 +01:00
Fedor Isakov c450462fa5 Drop "final" flag on term feature: unused 2021-01-23 16:59:45 +01:00
Fedor Isakov 2ab8d41b0c Minor refactoring: move term specication to the end of feature list
It's only natural to have the specification to come after
all upper-level features have been specified in a term.
2021-01-23 16:59:45 +01:00
Fedor Isakov 536e1aa1c2 Introduce helper methods to factor out creation of terms 2021-01-23 16:59:45 +01:00
Fedor Isakov b3c57465fc Minor refactoring: extract constants for building terms 2021-01-23 16:59:45 +01:00
Fedor Isakov 52725b4826 Minor refactoring in TermNode: simplify API 2021-01-23 16:59:43 +01:00
Fedor Isakov 4991536db1 Fix diff view showing insertion wrongly, dont assume vertical layout 2021-01-23 16:59:42 +01:00
Fedor Isakov 13627568df Ensure input is processed for fresh cache by setting invalidated to false 2021-01-18 10:59:03 +01:00
Fedor Isakov acc9477512 Drop invalidated flag from cache (unused) 2021-01-18 10:59:02 +01:00
Fedor Isakov dc7a06c685 Ensure typechecking queries get appropriately disposed of for editor session 2021-01-18 10:59:00 +01:00
Fedor Isakov 4be723c09e Introduce programEvaluated flag to strategy, only display traces for real programs 2021-01-18 10:59:00 +01:00
Fedor Isakov 89ae2d2003 Use UpdatesRecorder to control whether to apply templates
Invalidated and introduced nodes are collected by UpdatesRecorder.
If either set is not empty, a walk of the input is triggered.
Also, drop invalidated flag in RulesPlanHandler.
2021-01-18 10:58:58 +01:00
Fedor Isakov 3a5c5dcec4 Avoid keeping cached data by aspect+query kind
This optimization doesn't have any tangible effect.
2021-01-13 17:32:23 +01:00
Fedor Isakov 397e1efc0c Fix dropped rules erroneously marked as validated 2021-01-13 17:32:21 +01:00
Fedor Isakov c9f2a34b53 Ensure shared state for basic queries, fix performance of model checker 2021-01-12 22:55:42 +01:00
Fedor Isakov baae5c5bf0 Several interconnected changes to optimize performance in incremental mode
Introduce invalidated flag to program producer to control whether to
only process invalidated nodes in incremental mode.

Update validated flag in RulesPlanHandler to reflect the finalized
state, after the plan has been built.

Refactor ProgramProducer/Factory to avoid enumerating the source
root in case no changes have been detected (in incremental mode).

Avoid relaunching program in case the producer did nothing.
2021-01-12 22:55:42 +01:00
Fedor Isakov d88acbe0f4 Introduce trivial result state 2021-01-12 22:55:40 +01:00
Fedor Isakov 93cbb90fec Avoid aborting execution of helpers in case of error
BlockingExecutor must not block other helpers from being executed
if a error is detected by one of them.
Since helpers are built in unpredictable order, there can be situations
when an (unrelated) error causes intermittent failures.
2021-01-12 22:55:40 +01:00
Fedor Isakov 62e8e7d013 Switch to MPS 2020.3 release. 2021-01-08 11:00:02 +01:00
Fedor Isakov 603787ab2b Fix test that expects same type to be returned from cache, no longer true 2021-01-07 17:04:27 +01:00
Fedor Isakov abb76e68b5 Refactor changes tracking in UpdatesRecorder, use model instead of a ref
Using a model reference require resolving via a repository, which
is unnecessary in case model objects are stored directly.
2021-01-07 13:31:37 +01:00
Fedor Isakov 77b02a4e0e Drop tracking unit cache, rely on UpdatesRecorder to provide incrementality
The idea to use "tracking" cache to save on typechecking operations is obsolete.
There is conflict of responsibilities with UpdatesRecorder,
which is to be solely relied upon for all things related to tracking changes.
2021-01-07 13:31:37 +01:00
Fedor Isakov 4c82ddd622 Autofix references to method decl 2021-01-07 13:31:37 +01:00
Fedor Isakov 0315fca5fa Fix ghost artefacts in activation trace appearing on moving selection up
StyledTreeCellRenderer component received wrong bounding box
because of top border's inset to be set to 1 (see DefaultTreeUI.paint()).
This border is the default set by LookAndFeel.installBorder()
in case the border on tree component is set to null,
which is explicitly set to null in TreeTableTree's constructor (go figure).
2021-01-06 12:43:55 +01:00
Fedor Isakov 5e147837ec Drop node pointer in QueryTemplate behaviour 2020-12-30 18:28:46 +01:00
Fedor Isakov c67c62d394 Fix generator for terms, switch to local call instead of this expression 2020-12-27 19:47:35 +01:00
Fedor Isakov 7570d050c9 Fix type declaration: replace linkedlist with list
A problem with collections language is that linkedlist type
gets generated into a Deque. There is a workaround for this,
which fails to work because of another problem in collections
language: linkedlist not being a direct subtype of LinkedList.
Probably a legacy code issue.
2020-12-27 16:04:06 +01:00
Fedor Isakov 37486d4484 Avoid NPE during template application, provide appropriate reporting 2020-12-27 16:04:06 +01:00
Fedor Isakov 26b0f4ac87 Fix helper action items not appearing in inspector 2020-12-27 16:04:06 +01:00
Fedor Isakov eb03d7d218 Include languages imported to all imported models of the model that contains node to check
Some language imports necessary for correct typechecking are obscure.

Example may be a closure type, which requires the type of the operand
(receiver) of the method it serves a parameter to. That, in turn, may
require some type defined in another root and perhaps some other model.
2020-12-27 16:04:05 +01:00
Fedor Isakov 64b33d1a88 Refactor RulesPlanHandler to not depend on AspectClique 2020-12-27 10:36:04 +01:00
Fedor Isakov 43ad19494b Refactor rule processing: straightforward dependencies, simplify code
Enable rule index to be updated during rules application.
Make RuleProcessingSession depend on AspectClique.
Enable updating of rule/macro/query indices.
2020-12-27 10:36:00 +01:00
Fedor Isakov 07a6b722c7 Drop unnecessary computations, simplify rules/query template index. 2020-12-27 10:36:00 +01:00
Grigorii Kirgizov ba8ccfce03 minor: Disable incremental option (that controls Preamble also) for lambdacalc tests
Preamble optimization requires same contracts from programs as full incrementality.
2020-12-15 17:59:10 +03:00
Grigorii Kirgizov 8022fa4203 Add tests for local typeOf query with occurrence cache 2020-12-15 17:59:10 +03:00
Grigorii Kirgizov 27ed01c447 refactoring: Adjust uniqueTag usages for Rule.Tag refactoring
Fix rule basetag generation to coincide with templateName

Needed for PrincipalStore (occurrence cache) which uses
info about occurrence source rule template name.
2020-12-15 17:59:09 +03:00
Grigorii Kirgizov 3eccaf81a1 Introduce occurrence store as cache for their reuse in Queries strategy
It's important that program that uses occurrences from cache
shouldn't include rules that could produce their duplicates.
So implementation of occurence cache includes 2 parts:
on reactor level & in ProrgramFactory.

When RuleBuilders are produced, cache is queried whether
there're already  occurrences associated with the rule template
in question. If so -- then those RuleBuilders are not included
into the program (as well as all RuleBuilders required by it).
2020-12-15 17:59:05 +03:00
Grigorii Kirgizov f051e6bf19 Avoid null nodes in UpdatesRecorder. Caused erroneous invalidation of null-origin rules. 2020-12-15 17:51:27 +03:00
Grigorii Kirgizov c455514325 Get more precise info on invalidated nodes (fixes MPSCR-82)
Get information on invalidated nodes from EvaluateStep & incr processing
instead of UpdatesRecorder, which has only partial info and can't handle
all cases.
2020-12-15 17:51:23 +03:00
Fedor Isakov 8dd43190b4 Switch to finding aspect clique for subject node in local typechecking
During generation, the imports set of a transient model doesn't always
reflect the actual set of imported languages.
2020-12-15 13:32:54 +01:00
Fedor Isakov 03be7f19b5 Optimize processing of static rules
Avoid evaluating templates and producing rules on null
input and all required closure of this input, which effectively
constitutes the static collection of rules that are only
dependent on chosen aspect clique.
2020-12-13 22:09:31 +01:00
Fedor Isakov 159de90e6f Exclude free floating nodes from required set
Required nodes w/o a model, or "free floating" nodes
are excluded from the required set.
Instead all their valid references are processed.
2020-12-12 13:48:15 +01:00
Fedor Isakov d4f0c9741f Enable reuse of locally calculated types.
Typechecking results cache is consulted on a request to
locally calculate the type.
2020-12-11 12:03:17 +01:00
Fedor Isakov 5813704d9e Optimize application of rule templates via RulesPlanHandlder.
Avoid calling template's code if cached evaluation results are
not invalidated.
Keep information on required nodes (dependencies) together with
the list of produced rule ids.
2020-12-11 12:03:16 +01:00
Fedor Isakov c7eaa1dbf3 Clean up ProgramEvaluator API. Straighten up passing of session token. Drop RulesDiff usages. 2020-12-08 22:57:36 +01:00
Fedor Isakov ffe1a241bf Implement require(All) statement to call overloaded require methods.
The statement require(All) now invokes the overloaded require
method with the first parameter the input node.
2020-12-08 22:57:35 +01:00
Fedor Isakov 4eab445aa9 Introduce overloaded "require" methods to keep track of dependencies.
TemplateApplicationSession allows to invoke require with the
input node as the first parameter, which is then forwarded as
a "requirement" (TODO: rename to dependency).
2020-12-08 22:57:35 +01:00
Fedor Isakov 616c39ae38 Fix incremental test launcher
The use of ProgramProducer and other stuff have new requirements.
The program is now produced incrementally, with UpdatesRecorder
playing a major role in keeping track of changes.
2020-12-08 22:57:35 +01:00
Fedor Isakov e026674fb2 Introduce a means to clear invalidated rules in RulesPlanHandler.
In incremental mode all rules need to be moved to validated set
after all invalidated rules have been dropped.
2020-12-08 22:57:35 +01:00
Fedor Isakov 0ff05e39e7 Fix UpdatesRecorder to construct the transitive changes closure.
The changed set is processed transitively using "required"
association. (TODO: rename to dependency).
2020-12-08 12:52:13 +01:00
Fedor Isakov 8918b0afd8 Refactor RulesPlanHandler, introduce RulesPlan. Drop unused class.
Refactor the rules producing line to run via newly introduced RulesPlan.

Correctly process new and dropped rules.
2020-12-08 12:52:13 +01:00
Fedor Isakov 59db13bf41 Simplify UpdatesRecorder implementation. Fix input processing by ProgramFactory.
Move invalidation logic inside UpdatesRecorder from elsewhere.
Drop type parameters.
Avoid recording dependencies for null input.

ProgramFactory: always process input, not only the first time
2020-12-08 12:50:36 +01:00
Fedor Isakov d637bed114 Enable cache data to be accesible with an Object key. Drop usages of PreambleSet.
PreambleSet exists only to allow to multiplex cached values by
query. There is no need for this now that the key can be a compound one.
2020-12-06 16:14:28 +01:00
Fedor Isakov e2926d8433 Enable reuse of RulesPlanHandler. 2020-12-06 10:52:11 +01:00
Fedor Isakov 64a8b71d24 Enable RulesPlanHandler to incrementally update rules. 2020-12-05 13:37:04 +01:00
Fedor Isakov b31b5be38f Refactor ProgramBuilder to a helper inner class. 2020-12-04 12:13:30 +01:00
Fedor Isakov 5413c78b0a Refactor and cleanup RulesPlanHandler. Ensure single mapping node->rules. 2020-12-04 12:13:30 +01:00
Fedor Isakov e7bb65ecff Refactoring in program producing: drop usages of RulesList, simplify code. 2020-12-03 20:16:11 +01:00
Fedor Isakov c6152abdc2 Fix RuleBuilder not processing macro's input concept.
A query may be invoked without the input node, thus dispatching
macros by the specified concept. The concept must be taken into
account when calculating the "diff", so that the old (stale)
rules don't override the updated ones.
2020-11-29 00:20:15 +01:00
Fedor Isakov 010e6cdc61 Minor refactoring: use Queries strategy for local typechecking too. 2020-11-27 10:06:09 +01:00
Fedor Isakov 4165c320ff Avoid throwing NPE on opening project, unload is called on an uninitialized plugin. 2020-11-24 13:48:42 +01:00
Fedor Isakov 044b707b77 Implement handlers for typeOf query in all types aspects. 2020-11-24 13:41:25 +01:00
Fedor Isakov 73f610b597 Introduce new kind of typechecking query, typeOf, having a subject.
This query kind is to be used in local typechecking.
The idea is to do away with constraints that are not essential for
typechecking a single node, thus making local type computation faster.
2020-11-24 13:41:25 +01:00
Fedor Isakov acc3167e21 A bunch of optimizations and minor refactorings.
Consolidate options, configure all from typechecking plugin.
Introduce a computable option to control using traces.

Introduce shared state to be used at generation time.
Drop repository cache holder, replace with a field in state.
Fix singleton type collector.

Fix memory leak in strategy by cleaning it up after execution.
2020-11-24 13:41:25 +01:00
Fedor Isakov 5ce60c1398 Minor refactoring in typechecking service component: simplify code. 2020-11-24 13:41:25 +01:00
Fedor Isakov 4d79fbf263 Fix various issues arizing during generation time.
Avoid dereferencing DynamicReference from OriginIndex as it involves typechecking computation.
Aviod enqueing type nodes with TypesModelHandler during generation,
a workaround for "mature" references unable to be resolved
if target is in a transient (unpublished) model. (MPS-32709)
Ensure "local" typeof computation is used when queries a created with null root.
2020-11-24 13:41:25 +01:00
Fedor Isakov 29f5992ff9 Fix logical type's conversion to classifier; fix generation.
Specifically treat convertsTo of LogicalType to ClassifierType, support
convertsTo classifier type w/o specified classifier.
Fix typeOf LogicalItemValueExpression by to rely on logical's type.
Accept LogicalItem in LogicalItemValueExpression's logical slot to enable
replacement of it with an expression at generation time.
2020-11-24 13:41:24 +01:00
Fedor Isakov 1c04ec1a1d Avoid NPE in highlighting step if previous step(s) failed. 2020-11-24 13:41:24 +01:00
Fedor Isakov fe16b80132 Refactor types in all mps foundation langs. Drop node-ptr usage as anchor in terms.
Drop node-ptr in node features, macro calls.
Drop node-ptr types in rule templates and recover closures,
fix BiConsumer params
Drop node-ptr// refs where appropriate.
Drop pointer operations from macro calls and term ctor's; add resolve to FunctionTypeLookup static table.
Drop node pointer operations from constraints, add require statements in SModel types macro table.
2020-11-24 13:41:24 +01:00
Fedor Isakov 2c8f1a9294 Disable baseline time when running typechecking query. 2020-11-24 13:41:24 +01:00
Fedor Isakov 9c616971e1 Ensure all relevant languages are searched for aspects.
It might be necessary to look a little further into the input node's
referenced nodes to gather all relevant models for recovering
types aspects. Example: a type in BL may extend another BL type
parameterized by a non-BL type, such as node<>.
2020-11-24 13:41:24 +01:00
Fedor Isakov fcd3e15b83 Fix coderules generator, avoid referrences to transient models in types.
Coerce to be invoked on types inferred from the original input
nodes to avoid references to transient models in the result.
2020-11-24 13:41:24 +01:00
Fedor Isakov 59f653aeee Enable incremental option in test.
Now that "main" constraint is a principal one the test passes.
2020-11-24 13:41:24 +01:00
Fedor Isakov 35811d7322 Ensure "main" constraint is added as "principal".
Absence of "principal" flag on "main" contstaint causes invalid
processing of added rules that are triggered by this constraint.

Introduce protective copying of arguments in IncrProgramSpecBuilder.
The builder implementation must not reuse the collection passed in as argument.
2020-11-24 13:41:24 +01:00
Grigorii Kirgizov 85527c363b minor: consider 'main' as a principal constraint
Required for incremental (or preamble) processing
of rules with no input
2020-11-23 14:07:07 +03:00
Grigorii Kirgizov c44e3a7fd8 Upd buildscripts 2020-11-18 11:36:28 +03:00
Grigorii Kirgizov 42bc7a88fd Modify incremental tests to allow testing other queries, add test 2020-11-18 11:36:28 +03:00
Grigorii Kirgizov 1254ebd632 Handle case of query rules in PreambleInfo
Also process expand macro input for rule hash,
so that changed query rules (like one in testlang) get into
RulesDiff and could be updated with Preamble processing.
2020-11-18 11:36:28 +03:00
Grigorii Kirgizov 15cfd8a51b Refactor bl queries: separate "independent" query parts for Preamble 2020-11-18 11:36:28 +03:00
Grigorii Kirgizov 9d3b7e1fba Add program Preamble as SessionToken, use it in Queries strategy
Program Preamble consists of 2 parts: rules & Journal.
Preamble rules are no-input rules with rules for their required nodes.
Preamble journal is journal part with results of executing these rules.
Preamble is defined per-Query, because Journal differs for Queries.

Repository CacheHolder is used for storing them b/w sessions.
Rules are stored and  retrievied with Memoizer.
Journal is stored as SessionToken in PreambleSet (map Query->SessionToken).

Add option to IncrementalSpec -- incrementality level (Preamble or Full).
2020-11-10 10:40:06 +03:00
Fedor Isakov bf7bad4b4a Drop mockito lib, replace with ad-hoc solution, fix the tests. 2020-10-25 00:17:25 +02:00
Fedor Isakov 930100a47b Several fixes that guarantee stable order of rules in the program.
Ensure the order of rules in the resulting plan follows the priorities
set forward by extends relationship b/w languages. So that even if
rule template tables are unrelated, they are still ordered according to
language extension graph.
Ensure the order of rule lists in the resulting plan is stable b/w invocations of
RulesPlanHandler.allPlans().
Ensure the order of aspects in AspectClique is stable b/w invocations
of buildClique().

Associate RuleTemplatesTable with Manifest, and Manifest with CoderulesAspect.
Tentatively rename RulesList (the runtime object) to RulesPlan,
RulesListTable to RulesPlanHandler.
2020-10-23 12:26:30 +02:00
Grigorii Kirgizov cc9c4c54b3 Specify notion of required nodes: separately for tmpl application & for UpdatesRecorder
Too many nodes get into tmpl application process, which is unnecessary.
Many of those nodes are required actually only for correctly tracking
changes to nodes with WatchingTypecheckingStrategy.

Now implicitly required only nodes which are mentioned inside
constraint arguments. In other cases user must require them explicitly.
2020-10-23 12:26:30 +02:00
Grigorii Kirgizov 99c823d4f7 Integrate tmpl trace in ApplyTemplatesStep with TypecheckingOptions
Introduce TraceReport object for passing program results
(traces+report items) instead of using tuples.
2020-10-08 17:34:43 +03:00
Grigorii Kirgizov 1de365de9c Introduce trace tool for rule template application 2020-10-08 17:34:42 +03:00
Grigorii Kirgizov b693156229 minor refactoring: few changes in OriginIndex interface for better readability 2020-09-24 11:43:17 +03:00
Fedor Isakov 25e8e5fd78 Clear shared caches on releasing queries for generator. 2020-09-15 13:32:43 +02:00
Fedor Isakov 613b981977 Refactor UpdatesRecorder for better handling of nodes invalidation.
Alter the way invalidated nodes are handled by UpdatesRecorder.
A set of "source" nodes is now maintained, which helps to
detect the appropriate input for a changed node.
Templates are applied only to "new" or "invalidated" nodes.
2020-09-13 13:31:03 +02:00
Fedor Isakov 534c4832ce Re-saved models -- update resolve info. 2020-09-10 09:59:42 +02:00
Fedor Isakov 2d9e3547b6 Refactoring: simplify RelevantNodes[Tracker -> Monitor], drop interface and stub impl.
Rename TypeDependenciesNodeTracker to RelevantNodesMonitor and
have it the only implementation.
The "stub" implementation was never really used.
Simplify creation of and access to the monitor.
2020-09-10 09:57:53 +02:00
Fedor Isakov 9c7307286b Minor refactoring of UpdatesRecorder: straighten up API, better encapsulation. 2020-09-10 09:53:01 +02:00
Fedor Isakov 74e8eb86b1 Drop unused method in TemplateApplicationSession 2020-09-10 09:53:01 +02:00
Fedor Isakov ab59a76fa0 Drop usage of and drop UpdateRecorder.forAllFresh(): method has no effect 2020-09-10 09:53:01 +02:00
Fedor Isakov 2d9861e8a2 Avoid triggering NPE on calling ProviderInitToken.deactivate. 2020-09-10 09:53:01 +02:00
Grigorii Kirgizov 3a8bff821f Don't process macro args in 'usedDataHash' in RuleBuilder: it's unnecessary
Commit f9ca9f27 handles hash of macro bodies, making this functionality unnecessary.
Potentially less nodes can pass into 'required'.
2020-09-01 13:37:45 +03:00
Fedor Isakov 394459b17b Refactor typechecking cache to avoid updating model roots.
Instead of copying cached data just re-plant the fields to the new cache.
The new types-model to contain only the newly reported types. Types reported on earlier invocations are retained
in previously created models.
2020-08-20 14:20:52 +02:00
Fedor Isakov ca62bb0781 Ensure queries cache gets cleared even with no root node. 2020-08-20 14:20:52 +02:00
Fedor Isakov 248f71bb1d Drop unused overridden methods. 2020-08-20 14:20:52 +02:00
Fedor Isakov 2ea58960af Stop walking all references of a required node. 2020-08-20 14:20:52 +02:00
Fedor Isakov 4cf9821bc2 Optimize RuleTemplateIndex: cache matching rules per concept. 2020-08-20 14:20:52 +02:00
Fedor Isakov f085d10369 Temporary fix for tests: set tracking=true in TypecheckingTesetHelper.checkTypes(). 2020-08-14 17:42:19 +02:00
Fedor Isakov 54439e255e Refactor typechecking state/cache subsystem.
Refactor whe way TypecheckingResultsCache is updated:
all mutatiting methods extracted to Update subclass, which is
only available to the updater.

Make TypecheckingState a regular container for (unit) caches.
Make TypecheckingService responsible for managing caches.

Extract TypeModuleOwner and TypeModelHandler classes.
Get rid of QueryResultsCache, merge into TypecheckingResultsCache.
TypeModuleOwner to manage "repository" cache.
2020-08-14 16:57:36 +02:00
Fedor Isakov 905e11ac33 Refactor TypecheckingService API: simplify usage, extract Request.
Request is to keep all the parameters of a given API call,
whereas TypecheckingService is to handle the state between
calls.
2020-08-14 16:17:23 +02:00
Fedor Isakov d07b1d1517 Add option to report evaluation results. Reorganize options in pref pane.
When running typechecking with trace=on too much memory is taken up
by the traces, the new option enables to see the evaluation results
without collecting the traces.
2020-08-12 12:38:51 +02:00
Fedor Isakov 1bc6611a65 Use NPE guard in deactivate(). 2020-08-12 12:38:51 +02:00
Fedor Isakov b8798f0523 Ensure rules are created in predictable order, minor refactoring in ProgramFactory.
Before generating a rules list, all rules produced by a given template
are sorted to produce the same order of rules every time program is created.
2020-08-06 17:45:47 +02:00
Fedor Isakov 6348afaee5 Introduce CachingIncremental strategy for running typechecking. Minor fixes and code cleanup.
Optimization: Use repo/unit caches for storing various data in Caching strategy
Fix: introduce workaround for nodes coming from generator's transient model --
avoid clearing cache for non-resolvable origin nodes.
Fix: incrProgSpec not passed correctly downstream, incremental mode working only with trace on.
Refactoring: make TypesCollector a (private) singleton. TBD.
Rename SessionData -> CachedData.
2020-08-06 17:45:47 +02:00
Fedor Isakov 29bb1c72cd Allow Config.init() to be called multiple times. Ensure test passes alone. 2020-08-06 17:45:47 +02:00
Fedor Isakov 3bf644f766 Introduce strategy for running queries, ensure Memo is used. 2020-08-06 17:45:47 +02:00
Fedor Isakov 517838cbc1 Implement shortcut solution for occurrsCheck.
Make use of MutableLogical's feature to track usages count.
A logical with 1 or less usages can't be contained in
another term, so it's safe to skip unification in this case.
2020-07-30 17:14:40 +02:00
Fedor Isakov b5286d2671 Rely on memo to cache results of template application. 2020-07-30 17:14:40 +02:00
Fedor Isakov 32b11c0c7f Introduce memo expression to enable memoization of values.
During template application memo can be used to store results
of a computation in the session. The memo will be automatically
cleared on an event that invalidates the caches.
2020-07-30 17:14:40 +02:00
Fedor Isakov 4f74f192b4 Refactor typechecking state/results API for readability.
A bunch of renames:
TypesIndex -> TypecheckingResultsCache,
TypecheckingCache -> TypecheckingState.
Simplify methods that update caches.
2020-07-30 17:14:36 +02:00
Grigorii Kirgizov f13691668c Fix accidental var shadowing that led to report items not collected with IncrementalStrategy 2020-07-28 18:53:41 +03:00
Grigorii Kirgizov b87ae4b03a Produce warning when program can't be executed incrementally, but it's requested 2020-07-28 18:53:41 +03:00
Grigorii Kirgizov 3eebe8cd03 Refactor creation of IncrProgramSpec: allow later spec config (for MPSCR-66)
IncrProgramSpec influencing program eval is built from two sources:
internal analysis results & typechecking options.
Providing spec builder instead of spec allows to combine these
sources later at program pipeline creation in TypecheckingService.

Commit accomodates to addition of IncrementalSpec.Enabled.Unsafe
Commit also simplifies ProgramAnalysis -related classes.
Renames BasicProgramAnalysis to PrincipalsAnalysis.
2020-07-28 18:53:41 +03:00
Grigorii Kirgizov f6d7f5c4bd Refactor the way IncrPogramSpec is provided: explicitly pass as Step input 2020-07-28 18:53:41 +03:00
Grigorii Kirgizov 6339b5128b Add option to Typechecking page for enabling incremental contract assertions (MPSCR-66) 2020-07-28 18:53:41 +03:00
Grigorii Kirgizov c6a4e9ede3 Use opaque feedback keys (rule match ids) instead of rule unique tag
According to changes in prev commin in reactor
2020-07-22 15:27:46 +03:00
Grigorii Kirgizov 504261014a Modify principal constraint analysis: consider rules without origin (fixes MPSCR-64)
Also output warning on rules violating contract for non-principal rules
2020-07-22 15:27:46 +03:00
Fedor Isakov a0df862186 Temporary support for generation mode: use calcTypeLocally. 2020-07-21 17:03:41 +02:00
Fedor Isakov 96918d0e1d Support for processing input nodes recursively or not. Optimizing local typechecking.
The flag "recursive" is passed down to ProgramFactory to control whether
the input nodes are to be walked recursively.
This flag is set to false when calculating a node's type in isolation.
2020-07-21 17:02:17 +02:00
Fedor Isakov 49f81cbd9b Fix Show Type action to use checkTypeLocally() and report trace/errors properly. 2020-07-21 17:02:17 +02:00
Fedor Isakov 8e1bd7b931 Minor refactoring in TypecheckingCache. Provide separate non-tracking cache.
TypecheckingCache maintains two maps of root-to-cache: tracking and non-tracking.
Tracking cache is used in "watching" mode, caching mode doesn't require tracking.
Always merge the results of typechecking, avoid replacing the cached data.
Reimplement calcTypeLocally() to rely on cache for storing the resulting type.
Simplify cache API.
Fix TypecheckingTestHelper.
2020-07-21 17:02:17 +02:00
Fedor Isakov c9e87edbc1 Avoid throwing NPE when traceEvents is null. 2020-07-21 17:02:17 +02:00
Fedor Isakov 028ddfe93c Fix typechecking tests. 2020-07-16 10:33:44 +02:00
Fedor Isakov a6d671fef8 Refactor TypecheckingService and cache. Enable to use cache w/o tracking.
TypecheckingService has become too overloaded with responsibilities, and
so Strategy class is introduced to extract strategies to.
Cache holder can also be non-tracking, which comes in handy when
implementing purely caching typechecking, not anticipating any change.
2020-07-16 10:33:44 +02:00
Fedor Isakov 2119fbc591 Introduce explicit dependency on SRepository, stop trying to recover it from node.
TypecheckingService and provider component are explicitly dependent
on SRepository.
The repository instance comes from the first opened project, which
is a dirty hack and is temporary until Typechecking Facade API
is fixed to provide appropriate instance.
2020-07-16 10:33:44 +02:00
Fedor Isakov 29ffc46fa4 Introduce ProvideFeedbackOperation: enable providing feedback from templates.
Operations such as 'error' and 'warning' are available on input
node in templates and serve to report issues found during
template application, in contrast with those found during evaluation.
2020-07-13 18:14:12 +02:00
Fedor Isakov d5a259bbde Re-apply all re-runnable migrations (one fix). 2020-07-11 15:59:51 +02:00
Fedor Isakov 936190bca9 Apply migrations. 2020-07-11 15:13:08 +02:00
Fedor Isakov e2aa9fd53f Fix LogicalItemExpression contained in ExpressionItem issue, provide migration.
It's possible to a cycle b/w the two concepts, which is totally unnecessary.
This provides the means for detecting and fixing this problem.
2020-07-11 14:47:53 +02:00
Fedor Isakov cca0add2fb Better representation for coderules log messages. 2020-07-09 13:42:52 +02:00
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
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
Grigorii Kirgizov f13b5b3176 Fix a way to get needed clique in incremental tests 2020-05-05 16:45:27 +03:00
Fedor Isakov 56c341f615 Fix apparent memory leak in coderules messages view.
Use SoftReference wrapping TraceObject to avoid out of memory
error.
2020-05-05 11:42:25 +02:00
Fedor Isakov 2dc2191be3 Editor improvement: auto-substitute name from target concept for rule templates. 2020-05-05 10:19:38 +02:00
Fedor Isakov 2f9c23581f Fix substitution menu for LogicalItemExpression.
Prevent LogicalItemExpression from wrapping ExpressionItem.
2020-05-05 10:19:38 +02:00
Fedor Isakov 4666ca5349 Deprecate an obsolete concept. 2020-05-05 10:19:38 +02:00
Fedor Isakov f43b262e7f Introduce helper behaivour methods to be used from typesystem. 2020-05-05 10:19:38 +02:00
Fedor Isakov ea687efb21 Types for j.m.logic language. 2020-05-05 10:19:32 +02:00
Grigorii Kirgizov f75f87f13f Fix TypecheckingTestHelper to handle case of error types appearing with a reason
Error types can appear in cases similar to those of "no type"
because of addittion of "error()" term to typesystem.
2020-05-04 15:16:47 +03:00
Grigorii Kirgizov f6ebd46cb6 Disallow using OriginSpec inside rule bodies (such use case isn't handled) 2020-05-04 15:16:47 +03:00
Grigorii Kirgizov 5305e5d82f Fix generator of macros for case of applying them in alt body blocks
Previously body parts from macros applied in alt body branches
were merged into original, first body branch.
2020-05-02 13:43:03 +03:00
Grigorii Kirgizov 1ba46cef88 Fix analysis tests
Test model didn't containe needed nodes (RulesList-s) as roots
2020-05-01 18:15:15 +03:00
Grigorii Kirgizov aaa4d46655 Fix principal constraints/rules analysis to handle extended langs
Before it incremental typechecking for extending langs was failing
2020-05-01 13:38:12 +03:00
Grigorii Kirgizov f3ed39c8a6 Refactor a bit program analyses merge code in RuleProcessingSession 2020-05-01 13:38:12 +03:00
Grigorii Kirgizov 0569a96b6a Fix ExpressionStatement causing testa failure 2020-04-30 18:59:42 +03:00
Grigorii Kirgizov 09f4a54943 Fix AspectClique lookup for relevant langs: also add langs extended by sidekicked langs
Consider a case when j.m.bl.closuresExt is added as a sidekick,
then extended by it langs (e.g. j.m.baseLanguageExt) must be added also,
because they can contain crucial parts of extended aspects.
2020-04-30 15:38:33 +03:00
Grigorii Kirgizov 5894510797 Fix infinite loop on error of extended macro table not found 2020-04-30 15:38:33 +03:00
Grigorii Kirgizov 46cc65fd59 Allow passing multi meta logicals to macros as parameters 2020-04-30 15:38:33 +03:00
Fedor Isakov 866cd3fb04 Support extends relation between term tables.
A term table is now allowed to extend another term table.
Term prototypes can be imported through extends relation.
2020-04-28 12:54:35 +02:00
Fedor Isakov 25b08b627b Change root concept aliases for consistency. MPSCR-52.
Use "rule table" and "term table".
2020-04-24 10:43:46 +02:00
Fedor Isakov 39cfafb343 Fix analysis to analyze query tables also. 2020-04-23 10:15:39 +02:00
Fedor Isakov 77d35bfaa2 Manually migrate all queries to new table format. 2020-04-23 10:15:39 +02:00
Fedor Isakov 33739d7303 Support query table in generator templates.
Runtime switched to use newly generated query table definitions.
2020-04-23 10:15:39 +02:00
Fedor Isakov 6e7d4c3ae0 Minor refactoring: prefer interfaces over abstract classes. 2020-04-23 10:15:39 +02:00
Fedor Isakov a36369f002 Consistently use unified name RuleTable across all runtime. 2020-04-22 16:00:41 +02:00
Fedor Isakov 78a753a872 Refactor coderules aspect runtime: consolidate manifests.
Have single manifest for all assets instead of separate ones.
QueryTable is declared but not implemented yet.
2020-04-22 16:00:41 +02:00
Fedor Isakov 3e65376561 Drop deprecated stuff from coderules lang and runtime. 2020-04-22 12:07:50 +02:00
Fedor Isakov f23ea05b65 Update query templates to not use QueryParameterReference.
QueryParameter is always referring to Query instance passed
to the template.
Drop QueryKind and parameter declarations from query templates.
2020-04-22 11:43:37 +02:00
Fedor Isakov 767a41ad24 Switch runtime and generator templates to use Query interface.
Previously used contract with QueryKind/Object[] parameters is
replaced with Query object.
2020-04-22 11:43:37 +02:00
Fedor Isakov 46fe463118 Update instances of query templates to include reference to Query type. 2020-04-22 11:25:14 +02:00
Fedor Isakov 71dadaff0f Redesign query template to accept Query as parameter
Introduce QueryParameter as the way to refer to Query instance
in templates.
Introduce QueryTable.
2020-04-22 11:24:19 +02:00
Fedor Isakov dae5a63835 Introduce Query interface to replace QueryKind. Explicitly specify query params. 2020-04-21 12:36:19 +02:00
Fedor Isakov 9037b17516 Fix FeedbackConsumer's only method definition.
The method would generate to 'protected void...' with MPS 2020.1.
No idea why.
2020-04-19 17:32:29 +02:00
Fedor Isakov 91dda1d85f Move ProgramAnalysis to template model, avoid creating dependency cycle. 2020-04-19 16:30:11 +02:00
Fedor Isakov 1bb158d50b Consolidate models in template runtime solution. 2020-04-19 16:30:11 +02:00
Fedor Isakov 9bbf86cb8d Optimize coderules templates runtime and generator.
Drop obsolete code from runtime.
Consolidate and reconcile different templates for consistency.
Simplify generated code.
2020-04-19 16:30:11 +02:00
Fedor Isakov cfcbee9d6f Cleanup the runtime: drop unused/obsolete methods. 2020-04-19 16:30:11 +02:00
Fedor Isakov 20263ea520 Delete a bunch of deprecated/unused/obsolete concepts.
The API calls are deprecated and result in UnsupportedOperationException.
2020-04-19 16:30:11 +02:00
Grigorii Kirgizov 634bd053cc minor: fix generated rule names: add prefix to their sequential number 2020-04-19 13:43:05 +03:00
Grigorii Kirgizov be89545202 Adapt to method rename in EvaluationTrace interface 2020-04-19 13:43:05 +03:00
Grigorii Kirgizov 152e6fcfa3 refactor: move another version of ReportingSupervisor from test model to the model it belongs 2020-04-19 13:43:01 +03:00
Grigorii Kirgizov 43297ce5c6 Separate logic of being able to report feedback from handling it (i.e. recovering from failure), fixes MPSCR-57
Also rename ruleTag param in feedback methods to 'feedbackKey', what it really is.
feedbackKey is used in TypesCache internal ReportItem map as a key.
2020-04-19 13:42:58 +03:00
Grigorii Kirgizov 4d2658ee3f minor: Add doc comment on new method in AspectClique 2020-04-19 13:42:53 +03:00
Grigorii Kirgizov 4bb1b9d3d8 Apply some migrations after rebase on master 2020-04-19 13:42:53 +03:00
Fedor Isakov 3f4f9d35cb Fix macro templates in testlang. 2020-04-16 12:26:17 +02:00
Fedor Isakov 7b1764548c Fix runtime and generator for macro templates processing. MPSCR-53
Support matching expand macro template on subconcepts.
Respect topological order of macro tables.
Respect the order of macro templates in macro table.
2020-04-16 12:24:46 +02:00
Fedor Isakov 0d00d84b91 Update helper methods in tests to conform to LogicalUtil changes. 2020-04-15 10:41:33 +02:00
Fedor Isakov 9b8a560edc Simplify generator template for Splice, rely on java method overloading.
LogicalUtil defines a bunch of overloaded methods that help dispatch
data form construction based on runtime class of logical variable.
This eliminates the need to use coerce in generator template.
2020-04-15 10:40:59 +02:00
Fedor Isakov eb4862eb48 Force save all models -- update resolve info. 2020-04-14 16:20:05 +02:00
Fedor Isakov cbb9ac919e Rename LogicalDataForm to LogicalVariableDataForm. Fix generator to not rely on type.
LogicalVariableDataForm generates to either a list node or a term.
This choice can be made based on the structure alone.
Logical variable "array" corresponds to list node, everything else to a term.
2020-04-14 16:17:15 +02:00
Fedor Isakov ed821053ec Rename concepts for consistency to Term*. Move one more concept to coderules. 2020-04-13 18:00:15 +02:00
Fedor Isakov fd2043e047 Update build scripts. 2020-04-13 18:00:15 +02:00
Fedor Isakov 5b1449fa82 Update all usages of moved concepts. 2020-04-13 17:58:34 +02:00
Fedor Isakov a0bc96b3e0 Move all concepts related to term to j.m.coderules. 2020-04-13 17:58:34 +02:00
Fedor Isakov 204d1ff7e4 Move migration to termlist type to j.m.coderules. 2020-04-13 17:58:33 +02:00
Fedor Isakov 2ccee6e805 Move all term-related generator templates to j.m.coderules. 2020-04-13 17:58:33 +02:00
Fedor Isakov 0ce5e4813c Drop all deprecated concepts from j.m.logic lang. 2020-04-13 17:58:33 +02:00
Fedor Isakov f55a377528 Truncate migrations that are using deprecated stuff.
All deprecated concepts from j.m.logic are to be deleted.
Concepts related to terms are to be moved to j.m.closures.
2020-04-13 17:58:33 +02:00
Fedor Isakov 296b3e9271 Re-apply all rerunnable migrations. 2020-04-13 17:58:33 +02:00
Fedor Isakov a1c98b5bf0 Apply all outstanding migrations. 2020-04-13 17:58:33 +02:00
Fedor Isakov 4845e120e9 Introduce termlist type, rename multilogical type to logical[]. 2020-04-13 17:58:33 +02:00
Fedor Isakov e8a19249e6 Migration to replace spliced LogicalItemExpression on a list node.
Usually one uses Splice with LogicalItemExpression wrapping a logical variable.
Using LogicalDataForm wrapping same variable makes Splice unnecessary.
In order to keep code readable these are wrapped again in a cons list.
In general, one should avoid using bare LogicalDataForm, as these are
indistiguishable from normal LogicalVariable.
2020-04-13 17:58:33 +02:00
Fedor Isakov 065aac819c Introduce construct to directly insert term constructor in data form.
Usually one uses Splice with LogicalItemExpression wrapping a constructor.
The new TermConstructorDataForm provides a shortcut.
2020-04-13 17:58:33 +02:00
Fedor Isakov 2af087428d Document j.m.logic language. Rearrange virtual packages. 2020-04-13 17:58:33 +02:00
Fedor Isakov 922fe7ef2e Prevent bad migrations from being re-applied.
Replacing of == with = is not always justified.
ListNodeCons is now deprecated and already replaced with
new concept.
2020-04-13 17:58:33 +02:00
Fedor Isakov 1109471f9a Replace usages of MultiMetaLogical with MetaLogicalArray.
The new class MetaLogicalArray does not inherit from MetaLogical,
which should help catch subtle bugs related to errors in
generator code.
2020-04-13 17:58:33 +02:00
Fedor Isakov 73beb56834 Introduce ConsListNode to replace a deprecated concept. Migration.
Prefer aggregation over inheritance: ListNodeCons extending ListNode
is not a good design.
Also drop LogicalUnrapContext, as it has no real use.
2020-04-13 17:58:33 +02:00
Fedor Isakov cf77688a71 Replace instances of deprecated ListRole with ChildRole. 2020-04-13 17:58:33 +02:00
Fedor Isakov def1d9fbc6 Optimize generator, drop usages of ListRole. 2020-04-13 17:58:33 +02:00
Fedor Isakov b3d71ad13d Drop unused method from ListNode, simplify dataform-logical bridging. 2020-04-13 17:58:33 +02:00
Fedor Isakov 021853b996 Documenting LogicalUtil, minor refactorings.
MetaLogical are accessed through MetaLogicalFactory in generated code.
2020-04-13 17:58:33 +02:00
Fedor Isakov 749f60e665 Deprecate a bunch of obsolete concepts. 2020-04-13 17:58:33 +02:00