Commit Graph

469 Commits

Author SHA1 Message Date
Fedor Isakov 93b782122a Drop mockito lib, replace with ad-hoc solution, fix the tests. 2020-10-25 00:00:19 +02:00
Fedor Isakov ab31a8fe0d Update mockito lib, fix the tests. 2020-10-23 15:29:40 +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
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 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 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 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 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
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