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.
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.
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.
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.
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.
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.
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.
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.
Enable recording the dependencies while expanding macro.
Rename/refactor operations in UpdatesRecorder to reflect the intent
of adding the dependencies.
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.
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.
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.
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.
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).
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.
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.
Enable rule index to be updated during rules application.
Make RuleProcessingSession depend on AspectClique.
Enable updating of rule/macro/query indices.
Fix rule basetag generation to coincide with templateName
Needed for PrincipalStore (occurrence cache) which uses
info about occurrence source rule template name.
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).
Get information on invalidated nodes from EvaluateStep & incr processing
instead of UpdatesRecorder, which has only partial info and can't handle
all cases.
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.
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.
TemplateApplicationSession allows to invoke require with the
input node as the first parameter, which is then forwarded as
a "requirement" (TODO: rename to dependency).
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.
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
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.
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.
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.
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.
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.
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.
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<>.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Drop recording of "suppressed exception" by CoderulesHelper.
Report failed program evaluation as info message.
Ensure traces are available for failed evaluations.
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
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.
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.
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.
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.
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.
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)
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])`.
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.
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).
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.
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.
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.
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.