Commit Graph

602 Commits

Author SHA1 Message Date
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