Fedor Isakov
76991aabe7
Fix dependencies among rule tables.
...
Observing the invariant: whenever a constraint is used in
rule's head, the rule table containing it must extend the
one that constraint.
Also drop unused constraint from the head in ConversionFunctionIFace.
2020-05-05 16:23:13 +02:00
Fedor Isakov
2c363f85f4
Tidy up helper methods contract, drop unnecessary method.
...
BaseHelper.getListContents() accepts a dataform that must be
an instance of ListNode or be resolved to one via DataFormUtil.ground().
2020-05-05 15:58:48 +02:00
Grigorii Kirgizov
54c9af37a3
Add checking of loop statements in blExt
2020-05-05 16:45:27 +03:00
Grigorii Kirgizov
c388aa25b6
Reorganise rule table extends dependencies in blExt
...
Mainly, avoid extending TypeOf by ConversionMain (unnecessary dependency).
It's also more logical structure: tables defining declarations go first, then typeOf-related.
So rule tables which require only decls can depend only on such tables.
Core tables extends relationship now:
TypeBound <- CheckAll <- Generics <- TypeOf
TypeBound <- ConversionMain [<- other langs' conversions]
2020-05-05 16:45:27 +03:00
Fedor Isakov
66d2896fff
Ensure type variable bounds are processed in coerce query.
...
This fixes constraint errors in model check while running
typechecking with coderules.
2020-05-05 13:20:59 +02:00
Fedor Isakov
a15a6b3f1d
Fix target statement (not allowed within constraint rule).
2020-05-05 10:19:38 +02:00
Fedor Isakov
ab9a22a013
Rebuild project.
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
27b7917a1a
Add conversion of closures to functional classifiers, add tests
2020-05-04 16:38:00 +03:00
Grigorii Kirgizov
c6e20d00c2
Handle case of free vars for ternary operation and primitive subtyping (needed for closures)
2020-05-04 15:16:47 +03:00
Grigorii Kirgizov
590f3ed6ed
Fix usages of OriginSpec: can't use them inside ConstraintRule bodies. Use convertsToSafe instead
2020-05-04 15:16:47 +03:00
Grigorii Kirgizov
aa40ca0e01
Fix function conversion to allow coerceTo queries pass
2020-05-04 15:16:47 +03:00
Grigorii Kirgizov
36a85d5c2c
Add bl.collectionsExt dependency on bl.function lang; upd mpscore build script and build.xml
2020-05-04 15:16:47 +03:00
Grigorii Kirgizov
f7a9c73199
Refactor out lang dependency on function type analogously to sequence type
...
As closures typesystem depends on collections due to sequence type,
so collections typesystem depends on closures due to function type.
E.g. consider typechecking of SequenceCreator.
2020-05-04 15:16:47 +03:00
Grigorii Kirgizov
898087f427
Fix term table in closuresExt to extend blExt term table and use imported sequence type
2020-05-04 15:15:35 +03:00
Grigorii Kirgizov
72d48d76e3
Add typechecking for recursive closure invoke expression, add tests & fix older ones
2020-05-04 15:15:28 +03:00
Grigorii Kirgizov
3284d2c331
Add typechecking of ClosureLiteral and invoke expressions
2020-05-02 14:04:34 +03:00
Grigorii Kirgizov
19ab82586f
Add function type subtyping
2020-05-02 14:04:34 +03:00
Grigorii Kirgizov
b9fe7439bb
Add empty closuresExt files for lang and test solution, upd bulid script
2020-05-02 14:04:34 +03:00
Grigorii Kirgizov
3101d22a5b
Upd mpscore build script and build.xml
2020-05-02 13:44:19 +03:00
Grigorii Kirgizov
735276d2a2
Add import/export constructs for sequence type in collectionsExt to enable basic tests
2020-05-02 13:43:03 +03:00
Grigorii Kirgizov
8921c44a8e
Add first tests for sequence type conversions
2020-05-02 13:43:03 +03:00
Grigorii Kirgizov
451b892b9f
Add empty models for collectionsExt lang and tests
2020-05-02 13:43:03 +03:00
Grigorii Kirgizov
625ea8c049
Add j.m.bl.sequenceBase language with basic sequence typing rules
...
This lang doesn't depend on collections lang and extracts
common dependencies of closures and collections langs:
sequence term and its basic typing rules.
2020-05-02 13:43:03 +03:00
Grigorii Kirgizov
69457dc747
minor fix: extend term tabl from blExt in tuplesExt
2020-05-02 13:43:03 +03:00
Grigorii Kirgizov
bd1e0b61e5
minor: rewrite errorType constraint in blExt as call macro
2020-05-02 13:43:03 +03:00
Grigorii Kirgizov
a2f3a5b824
Avoid leaving logicals unassigned in case of error: assign error type explicitly
...
Needed to disambiguate free variables that are not yet inferred
from those which has been already processed with error.
Also more properly handle case of trivial return type inference
2020-04-30 15:38:34 +03:00
Grigorii Kirgizov
aca2b3b8d9
BL typesystem: forbid conversion to/from void type
...
There's special constraint 'isCompatbile' to handle void.
Conversions with void can arise from closure types returning nothing.
2020-04-30 15:38:34 +03:00
Grigorii Kirgizov
125d051534
Fix check for return statements given possibility of nested method-like decls
...
Also fuse two bl rules for return statement and last expr.
Output feedback on return stmt, not returned expr,
because it also handles case of erroneous void return
2020-04-30 15:38:34 +03:00
Grigorii Kirgizov
5dcc71d2a5
Separate typing or return statement from checking its compatibility with method type
...
For convenience: to always get typeOf(return)
to unconditionally match on it (eg in closures lang)
2020-04-30 15:38:34 +03:00
Fedor Isakov
77d35bfaa2
Manually migrate all queries to new table format.
2020-04-23 10:15:39 +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
46fe463118
Update instances of query templates to include reference to Query type.
2020-04-22 11:25:14 +02:00
Fedor Isakov
98f1a0a6d2
Apply one outstanding migration. Force save all models.
2020-04-19 16:30:11 +02:00
Grigorii Kirgizov
22921b9b17
Clean unneded require statements
...
Relies on facts that children of origin are always processed and
that all nodes mentioned in rule bodies are required implicitly.
2020-04-19 13:43:05 +03:00
Grigorii Kirgizov
0e0438cf3c
Provide necessary dependencies for correct incr typechecking of cls hierarchies, fixes MPSCR-55
...
Now subclassPaths rule depends on a declaration of classifier,
which allows to track justifications dependency and invalidate
rule on incremental typechecking.
Similarly, rule for declaration now depends on all super classifiers.
2020-04-19 13:43:05 +03:00
Grigorii Kirgizov
b07fdd6735
Reproduce MPSCR-55
2020-04-19 13:43:01 +03:00
Grigorii Kirgizov
4bb1b9d3d8
Apply some migrations after rebase on master
2020-04-19 13:42:53 +03:00
Fedor Isakov
9f7d60e7c1
Reorder macro template declarations: move abstract concept to the bottom.
2020-04-16 12:25:59 +02:00
Fedor Isakov
7cc19bdece
Minor code fix: remove unnecessary wrapping of logical var.
2020-04-15 11:14:38 +02:00
Fedor Isakov
eb4862eb48
Force save all models -- update resolve info.
2020-04-14 16:20:05 +02:00
Fedor Isakov
fcbdbe7e47
Attempt to fix gradle task deps graph.
2020-04-13 18:00:15 +02:00
Fedor Isakov
35fd816cbc
Update all usages of moved concepts.
2020-04-13 18:00:15 +02:00
Fedor Isakov
fd2043e047
Update build scripts.
2020-04-13 18:00:15 +02:00
Fedor Isakov
1336e82065
Fix wrongly used logical item expression.
2020-04-13 17:58:34 +02:00
Fedor Isakov
5b1449fa82
Update all usages of moved concepts.
2020-04-13 17:58:34 +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
52bca36d32
Rebuild project.
2020-04-13 17:58:33 +02:00
Fedor Isakov
7413e9e387
Force save all models.
2020-04-13 17:58:33 +02:00
Fedor Isakov
cac5573cb9
Drop instances of deprecated concepts in baseLangExt
...
.
2020-04-13 17:58:33 +02:00
Grigorii Kirgizov
145aa79753
Regenerate build.xml for mpscore
2020-04-13 15:10:37 +03:00
Grigorii Kirgizov
bd87873160
Move baseLanguage.tuplesExt lang to 'samples' and upd build script
2020-04-13 14:36:37 +03:00
Grigorii Kirgizov
8dfcff1844
Add typechecking for indexed tuples (new language .tuplesExt and tests)
2020-04-08 23:24:55 +03:00
Fedor Isakov
4e12f7bf3b
Migrate baseLanguageExt sample to new expand/call macros.
2020-03-31 18:44:07 +02:00
Fedor Isakov
6a431fcb49
Rebuild project.
2020-03-31 18:44:07 +02:00
Grigorii Kirgizov
79952036cd
Fix ternary operator typechecking
2020-03-26 18:17:06 +03:00
Grigorii Kirgizov
6a53d15a21
Refactor: move logic related to tracking parent match from ControllerImpl to MatchJournal
...
Relates to machinery introduced in MPSCR-47.
Previously parent match was maintained in Controller on Java call stack.
Now this stack of parent matches is maintained manually in MatchJournal.
So MatchJournal gains new invariant: parentChunk()
returns correct parent after each logMatch() call.
Several tests fail, also need to maintain this
invariant after logActivation() calls.
2020-03-26 13:40:41 +03:00
Grigorii Kirgizov
c51d767926
Add typechecking for all missing operators. Refine missing cases, check compatibility. Properly handle ternary op. Add tests. (MPSCR-3)
2020-03-25 20:11:52 +03:00
Grigorii Kirgizov
b6aaec8870
Revert temporary workaround for MPSCR-51 from 16e39a93
2020-03-23 14:39:54 +03:00
Grigorii Kirgizov
91e4d2b582
Revive 'principal' rule feature for MPSCR-51. Mark those rules in BL typesystem.
...
Introduce 'auxiliary/essential' notions instead of 'principal/not principal'.
2020-03-23 14:28:14 +03:00
Grigorii Kirgizov
8874e8eb2c
Complete checking rules for overriding methods (add signature clash check, JLS12 8.4.8). Add tests for that. (MPSCR-3)
2020-03-18 19:50:17 +03:00
Grigorii Kirgizov
7a5a5388b1
minor fix: suppress out of scope error in node test code
2020-03-17 18:36:41 +03:00
Grigorii Kirgizov
16e39a9345
Check applicable scope for certain checking rules in BL (workaround for BL for MPSCR-51). Fix SubclassingUtil.
...
Modified TYPECHECK query to include "checkingScope" query parameter:
it is a root node for which program is generated (for local typechecking it's local node).
Rules additionally match on a constraint `checkDecls(node<>)` bearing this node,
so while rules will be generated for all scopes, only those in applicable scopes will run.
Also split rule for EnumConstantDeclaration on declration checking and just typing rule.
2020-03-17 17:54:38 +03:00
Grigorii Kirgizov
8d1f086562
Rewrite check_ClassifierOverridingMethods checking rule in Coderules. Rename several rules. (MPSCR-3)
2020-03-17 13:14:41 +03:00
Grigorii Kirgizov
455aea18d0
Refactor: compute instantiated subclass paths in SubclassingUtil more efficiently and allow resolving type vars with it
2020-03-16 17:59:19 +03:00
Grigorii Kirgizov
873d04c907
Add typechecking of Enums (MPSCR-3). Also avoid getting Classifier types with prim types as type args
...
Now primitive types in conversion relation are handled before processing of free inference vars.
So primitive types first get boxed and only then these terms can be unified with inference vars.
2020-03-16 16:42:03 +03:00
Grigorii Kirgizov
7c40295948
Add test cases for boxing/unboxing, complete typechecking for boxing (MPSCR-3)
2020-03-12 18:02:21 +03:00
Grigorii Kirgizov
a5cc88aeef
Fix typechecking for qualified this expr (MPSCR-3)
2020-03-12 14:54:40 +03:00
Grigorii Kirgizov
73fd59e58e
Add more test code for checking some cases of BL method overriding logic. Muted for now. (MPSCR-3)
...
It's unclear who should handle this: coderules or old typesystem checking rules.
2020-03-12 14:01:30 +03:00
Grigorii Kirgizov
a2d28e566a
Tried to reproduce MPSCR-50 -- typechecking works okey, problem lies elsewhere
2020-03-12 10:36:26 +03:00
Grigorii Kirgizov
a4d561b5a4
Drop now unused subclassing / promote rules operating on raw Classifier values
2020-03-11 15:51:26 +03:00
Grigorii Kirgizov
88a433584b
Simplify subclassPaths rule, add a test for now used SubclassingUtil's method
...
Previously type substitution in subclssing path is computed
by helper method instead of a code inside rule template.
2020-03-11 15:46:16 +03:00
Grigorii Kirgizov
fea3d5d021
minor: align NestedGenerics test with javac
2020-03-11 15:22:54 +03:00
Grigorii Kirgizov
7b143bdb6f
Ensure typeVarBound constraint is produced once for each tv decl. Fix capture of type var.
...
Fixes typechecking tests.
Type var bounds are produced together with genDecls at program start.
Now bound of type var is captured only when needed --
inside convertsTo check, leaving typeVarBound intact.
2020-03-11 12:29:43 +03:00
Fedor Isakov
253a7609a3
Introduce typeVarBound constraint to handle typevar bounds.
...
Since it's no longer possible to have cyclic terms,
the term for type variable type has to be refactored:
the bound information is attached via typeVarBound constraint
on the type.
2020-03-11 12:29:19 +03:00
Fedor Isakov
4020989bde
Defensive copying of argument list.
...
SModel returns a model-based list by default.
Since it is used w/o a read action, we need to copy the list
to be used as constraint's argument.
2020-03-11 12:28:22 +03:00
Grigorii Kirgizov
e1ac188023
Produce proper type erasure for raw classifiers: type variables are erased to their bounds
2020-03-11 09:41:18 +03:00
Grigorii Kirgizov
d3d567101f
Add typechecking for return type covariance and tests for it (MPSCR-3)
2020-03-11 09:41:08 +03:00
Grigorii Kirgizov
92f95674b3
Refactor: drop meaningless DataForm.asRoot (used symbolPath which is deprecated)
2020-03-06 14:04:18 +03:00
Fedor Isakov
f2bb87e1b0
Apply migration to replace deprecated concept.
2020-02-26 15:03:31 +01:00
Fedor Isakov
7ba7c983cb
Apply migration to use logical variable ref expression.
2020-02-24 22:57:05 +01:00
Fedor Isakov
e1c5f68e3e
Typechecking templates: minor refactoring, optimizing code.
...
Replace node-ptr<> type with node<> where applicable.
Use node<> type is ok in constraint arguments.
Replace instances of LateExpressionItem $() with ExpressionItem.
2020-02-20 14:52:28 +01:00
Fedor Isakov
2c43762f93
Replace all instances of .pointer in constraints to node reference.
...
SNode is supported now directly as an argument to constraint/predicate.
Pointer operation is no longer necessary, as is node-ptr<> type for logical vars.
2020-02-20 11:59:28 +01:00
Fedor Isakov
8ec26b4e94
Support node<> argument in constraints. Prepare to get rid of node-ptr<>. Minor refactoring.
2020-02-20 11:59:28 +01:00
Fedor Isakov
3758971194
Fix the only instance of ExpressionItem that doesn't wrap .pointer op.
2020-02-20 11:59:28 +01:00
Fedor Isakov
9a6859a5d9
Refactor usages of TargetSpec parameter to target{} block.
...
TargetSpec is to be reduced to a reference to logical variable,
simplifying the feedback predicate.
When a node can be specified directly, use target{} block.
2020-02-17 12:49:26 +01:00
Fedor Isakov
417fc45933
Restore origin ref in RuleEx interface, fix terminology in templates API.
...
To avoid confusion, a rule defines "target ref", which is supposed
to indicate the source code location for possible errors.
The origin node is to be referred as "origin" as before.
Temporarily rename OriginSpec's alias to "target" to reflect change
in semantics.
2020-02-17 11:57:14 +01:00
Grigorii Kirgizov
9001286ebe
Add incremental test. Tried reproduce MPSCR-42 with auto-test, but it appeared only from Editor action.
2020-02-13 17:12:33 +03:00
Grigorii Kirgizov
c004ef888a
Avoid producing typeVariable term with null decl inside (MPSCR-40)
2020-02-12 20:24:04 +03:00
Grigorii Kirgizov
2aeadaf63f
Always silently handle wildcard classifiers to avoid errors while handling 'promote' relation (fixes MPSCR-41)
2020-02-12 20:15:07 +03:00
Fedor Isakov
796ad9ad2c
Apply migration to drop ValueOfExpression.
2020-02-12 12:26:09 +01:00
Fedor Isakov
66cf34ae80
Drop instances of ExpressionItem that don't contain a node ref.
...
ExpressionItem is to be ousted. It has no real use aside from
containing a .pointer op.
2020-02-12 10:53:40 +01:00
Grigorii Kirgizov
516ecd594f
Fix incr test failure due to incorrect flow from duplicated line
2020-02-11 16:00:18 +03:00
Grigorii Kirgizov
c87a2741fe
Add test for incrementality in BL to reproduce MPSCR-36
2020-02-11 15:52:30 +03:00
Fedor Isakov
1a6b107a76
Apply migration to replace condition block with if statement.
2020-02-07 13:14:46 +01:00
Fedor Isakov
73219399f4
Deprecate unused flag "principal" in rule template, drop usages.
2020-02-07 12:05:45 +01:00
Fedor Isakov
4a84ebce5f
Apply migration to switch to BodyBlock.
2020-02-06 12:55:32 +01:00
Fedor Isakov
c353f89ea0
Apply migration to drop ParameterContainer.
2020-02-05 17:02:32 +01:00
Fedor Isakov
3f51c1e5c1
Apply migration that replaces empty logical type with term type.
2020-02-05 12:34:20 +01:00
Grigorii Kirgizov
54fc91a031
Fix and reenable 3 tests on incremental typechecking disabled in fa7532f3, enable few older tests for previously missing bl machinery
2020-02-05 12:29:33 +03:00
Fedor Isakov
5b7bdc5838
Add error annotations on test data where errors are expected.
2020-02-03 12:00:44 +01:00
Fedor Isakov
391c9053b5
Apply migrations after switch to MPS 193. Regenerate project.
2020-02-03 11:24:22 +01:00
Fedor Isakov
5ebdea0714
Add necessary module dependency.
2020-01-20 10:52:40 +01:00
Fedor Isakov
85cf6888d5
Typechecking BL: introduce type term, reorganize terms to extend type, drop kind value from prim.
...
Temprorarily use classifier type String for internal string type.
Restore eq predicate in converts_ground_id body.
Remove origin{} block from var decl, doubtful idea.
2020-01-20 10:52:40 +01:00
Fedor Isakov
fa7532f34f
Include origin features's hash to requiredHash when building rules.
...
This enables to adequately reflect changes in the model when it is updated
by editor actions, such as "side transform".
Three tests was broken as the result of this fix and are disabled
http://127.0.0.1:63320/node?ref=r%3A8d22f6d9-72f0-49ec-92ee-027a87fbedd4%28jetbrains.mps.baseLanguageExt.test.incremental%40tests%29%2F3095008005741803340
2020-01-02 17:42:38 +01:00
Fedor Isakov
efd19aa45b
Implement incremental generation of coderules program.
...
Introduce SessionData, allow to keep arbitrary data with the session.
Extend RulesListTable with support for invalidation based on rule unique tags.
Introduce UpdatesRecorder to keep track of invalidated nodes.
Extend ApplyTemplatesStep with invalidate logic for typechecking.
Simplify design, drop unnecessary fields, minor refactorings.
2020-01-02 17:20:13 +01:00
Fedor Isakov
1e9e41601a
Add method to RuleEx that had been removed from the superclass.
2020-01-02 17:20:13 +01:00
Grigorii Kirgizov
955c814c3c
Add test for now failing cases of nested generics (filed MPSCR-29)
2019-12-26 19:13:17 +03:00
Grigorii Kirgizov
6399859f8e
fix one incorrectly removed rulesList extends
2019-12-26 18:44:17 +03:00
Grigorii Kirgizov
846dbed182
Minor refactor: Split Conversion rulesList to general convertsTo rules and other conversions. Drop intro_hasBound
2019-12-26 18:32:00 +03:00
Grigorii Kirgizov
1b79c2b548
Check compatability for eq/neq operators, forbid null to prim conversion (MPSCR-3)
...
Introduced a variation of conversion relation with a bit stricter boxing, needed for eq/neq.
e.g. suppose { (Number n, float f) => n == f } here f shouldn't be boxed.
2019-12-26 17:57:59 +03:00
Grigorii Kirgizov
52af2d527a
Complete subtyping for array types (A[] <: Serializable, Cloneable; JLS 4.10.3) (MPSCR-3)
2019-12-25 14:11:01 +03:00
Grigorii Kirgizov
e4b927e6e6
stringType: make it a sub-dataform of classifierType, don't add new rules. Add tests for conversion to/from classifierType and binstr promote. (MPSCR-3)
...
Everywhere where we don't care whether it's <String> or <string> it will be handled just as String.
Where we need to discern between the cases (as in Recover), 'stringType()' dataform can be matched first.
2019-12-25 14:09:48 +03:00
Grigorii Kirgizov
171671161f
Remove unused promoteUnchecked rule, add "shortcut" promote_reflexive rule which avoids computing subtype paths
2019-12-24 19:57:46 +03:00
Grigorii Kirgizov
a2f8f5e6f3
Handle cases with free & inference variables in containment, remove few unneeded rules (MPSCR-11)
...
Remove rules which handle capture+inference var case separately: it's already handled.
Remove rule with error on bound which shouldn't be triggered with new hasBound semantics.
Add symmetric rule for case value+inference var: types can be inferred nevermind relation direction.
Add rules for free vars without bounds (these ain't inference vars). Need in such vars arise when
e.g. params in classifierType terms must be somehow accessed. It's used in MethodCall rules.
2019-12-24 19:21:33 +03:00
Grigorii Kirgizov
8744263cb4
Add more tests for containment relation, remove some found unsound rules (MPSCR-11)
...
Rules removed are concerned with type variables. JLS [4.5.1] doesn't define containment for them.
2019-12-24 17:27:52 +03:00
Grigorii Kirgizov
9d35064db5
Provide better explanation of capture/typevar inference rule (relates to MPSCR-13)
2019-12-24 13:54:10 +03:00
Grigorii Kirgizov
76859dc69a
Provide required info for return ty inference or assign Object type. Fixes minor MPSCR-27
...
During investigation a different issue has been found.
Currently, e.g. when checking args to a method call, if there's an error then inference variable remains free.
It allows to continue typechecking without spurious additional errors triggered by former ones,
but with this approach all relations must gracefully handle free vars, and it's more difficult to avoid "no type".
There's an alternative to always assign to inference var a type at hand, even it doesn't pass checks
-- but then there're more unneccessary errors. Both approaches seem valid, no action is taken now.
2019-12-24 13:48:06 +03:00
Grigorii Kirgizov
2a15404753
Disable hasBound_check rule aimed at reactivation. All cases are now handled without it.
...
Enabling it with working reactivation causes spurious errors on method calls
because now it's impossible to specify feedback target for such errors fired
from reactivated rules.
2019-12-23 21:18:41 +03:00
Grigorii Kirgizov
ef5959dcdc
Fix failing checkModels test because of var out of scope
2019-12-19 02:42:04 +03:00
Grigorii Kirgizov
455f69f499
Fix miising import of lang.text in tests
2019-12-19 00:59:09 +03:00
Grigorii Kirgizov
3495cb4c2a
Fix checking of raw new class / anon class. Thinlet now passes.
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
e8cb6f9ad2
Add rule for determining correct type to bind inference variable to. Fixes MPSCR-13.
...
The inferred type can be either capture or type variable.
This logic is covered by a new rule 'inferFromCapture'.
For examples see 'Bounds' test sample.
This inference is used in call arguments type inference.
It happens on cases when bounds arise from several places:
(a) bounds for inference variables from type vars declared in method signature (hasBound constraint)
(b) bounds of type vars used as arguments to call (typeVariableType term wiht bounds inside)
(c) bounds from captures on type variables from case (b), which come in the form of 'captureOf' term
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
f2b35764d9
Explicitly match on hasBound in convertsTo rules (it's not reactivated as should)
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
7d582df9dc
Extend and clean up tests for bounds/capture type checking (Bounds sample)
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
9347cbf8ca
Fix captureOf_upperBound_check rule to handle typeVariableType case. Add check for captureOf_lowerBound
...
Errors are now reported on ClassifierType instead of type argument, because some checks must be done
in captures and there's no proper way to specify origin of arg here.
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
bced911edf
Add tests for capture logic of bl typesystem
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
4e948ab70e
Handle 'cls==null' case in ClassifierType macro. Fixes error in "Typechecking:scopes" test.
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
6ac8390e77
Remove error feedback from classifierType altogether: always produce some type
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
f51d351e06
Avoid generating checkClsTy rule for ClassifierType-s without model
...
Workarounds unclear test failure in genericNewExpression with "Unadvised error on 'null/null': ..."
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
b66ba51084
minor: unify instanceMethoCall and baseMethodCall rules so they are almost duplicates
...
Isn't posssible to merge them because of ClassCreator rule
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
a460459702
Require declared type check for local tc of Expression.
...
E.g. method calls can rely on it for return type inference.
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
9138c8e817
Rewrite rules converned with class creation. Add check for args count in ClassifierType check.
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
489ce56d70
Fix subclassPaths given updated TypeVarSubstitution behavior
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
85142e52f8
Switch error annotation place on checking classiferi. Correctly handle convertsTo to capture context tvs in instanceMethodCall
2019-12-18 21:47:07 +03:00
Grigorii Kirgizov
be2bb09811
Remove incorrect convertsTo rule (any to upperBoundType can't be converted)
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
76c6ee052a
Switch error reporting on arg types from 'origin' to 'convertsToSafe' in method call rules.
...
'origin' works only when wrapping whole ConstraintRule-s, not individual constraint activation statements.
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
b0c0f1b118
Remove unneded constraint toTypeVariableType
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
e13ca7ad33
Make TypeVarSubs usage precondition weaker: don't require substs for declared vars to be set. Drop vacuous type var resolution.
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
2e0feb670e
Fix baseMethodCall rule accroding to instanceMethodCallOperation rule
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
62d76dea9f
Check type arguments on instanceMethodCall. Rename captureWildcard to captureBound
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
dc6ffbdbad
Fix forwarding to GenericDeclaration macro by using 'call' instead of expand. Check mismatched num of args in ClassifierType.
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
a887328d4a
Process case of convertsTo(X,T) when isFree(X) in priority to correctly bind inference vars.
...
Fixes case described in MPSCR-13, but not all tests now pass.
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
af14f31090
Handle capture for bounds of type var types. Add additional example for that case in Samples_bad2 (MPSCR-13)
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
6305578b25
Simplify captureWildcard by using tv bounds from type scheme instead of hasBound. Fix inferring bounds for captures.
...
Concerned with MPSCR-13 and MPSCR-16.
Previous decision that bounds on lowerBoundType must be "refined" (see 'capture' rulesList) proved to be wrong.
The source of typesystem errors is that capture isn't performed properly on arguments which has type variable type.
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
52f708908b
Fix captureWildcard to correctly work with hasBound and type vars. Produce hasBound where needed. (MPSCR-16)
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
f33d94dead
Add default classifierType macro expansion for ThisExpression. Fix calls to this macro. (MPSCR-16)
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
99d386c3ef
Switch Capture from using TVSubs to type scheme instantiation. Fix checking clsType. (MPSCR-16)
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
0604a69789
Remove older versions of rules and macros for generics. Introduce additional Typecheck stage of "checkGenerics". (MPSCR-16)
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
31dd2a3644
Handle raw & unparameterized classifiers in new macros (MPSCR-16)
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
6f5746a31d
Extract checks from macros to separate rules. Add notion of typeScheme (genDecl dataform). Remove type inference logic from capture. (MPSCR-16)
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
78358bfc1c
Partly rework 'capture' given new hasBound semantics. Produce hasBound in typeVariable macro for Object bound too. (MPSCR-16)
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
8a2aa76252
Allow default type var decl expansion to typeVariableType() in classifierType macro (MPSCR-16)
...
e.g. needed for ThisExpression
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
c3aba49059
Fix PathHelper to pass a test for SubtypePaths which uses raw types in subclass paths
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
0e4e6fe8df
Redefine typeVariableDeclaration macro. Use TypeVariableSubstitution more consistently (MPSCR-16). Fix SubclassPaths.
...
'typeVariableDeclaration' now returns substituted vars or creates new subst.
Earlier it created created a new susbst which led to infinite recursion in specific cases.
Now macro expects tvdecl to be declared in TypeVariableSubstitution.
Accordingly modify usages of TypeVariableSubstitution.
Also fix (apparently broken?) SubclassPaths rulesList (used in lub relation)
and switch 'dpromote' implementation to use it
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
0bc053fe63
Fix classifierType macro condition, fix typeVariable macro & add tmp forwarding macros (MPSCR-16)
...
Macros currently don't handle subconcepts expansions.
2019-12-18 21:47:06 +03:00
Grigorii Kirgizov
2a71743895
Handle cases when inference variables must be instantiated into typeVariableType (MPSCR-16)
2019-12-18 21:47:05 +03:00
Grigorii Kirgizov
c8d1b9415b
Clean rules in hasBound rulesList (MPSCR-16)
...
Most of the rules were duplicating rules from convertsTo
2019-12-18 21:47:05 +03:00
Grigorii Kirgizov
9fbda2b26d
Change subset of calls to ClassifierType macro to expansion of Classifier macro (MPSCR-16)
2019-12-18 21:47:05 +03:00
Grigorii Kirgizov
0b3354cf24
Move 'cls==null' case to Classifier macro from ClassifierType macro (MPSCR-16)
2019-12-18 21:47:05 +03:00
Grigorii Kirgizov
9a31800dfa
Refactor classifierType macro in ReferenceTypes macro table (MPSCR-16)
2019-12-18 21:47:05 +03:00
Grigorii Kirgizov
13de18ae90
Change calls to typeVariable macro to macro expansions (of TypeVariableDeclaration) (MPSCR-16)
2019-12-18 21:47:05 +03:00
Grigorii Kirgizov
749ac192aa
Begin work on MPSCR-16: rewrite macros for TypeVariableDeclaration & TypeVariableReference
...
Remove duplicated processing of auxiliary bounds in type var declarations.
TypeVariableDeclaration macro now plays a role of instantiating type variables.
hasBound constraint is produced more consistently, on any expansion of TypeVariableDeclaration.
It will work mainly through reactivation due to changes to its arguments.
2019-12-18 21:47:05 +03:00
Grigorii Kirgizov
fa129f5937
Add test case for capture & containment. One case fails.
2019-12-18 21:47:05 +03:00
Fedor Isakov
dfecccfb86
Fixup ArgumentsCollector: include forgotten model changes, fix the build.
2019-12-11 12:00:51 +01:00
Fedor Isakov
7c781a7f87
Add javadocExt language to the build script.
...
Rename javadocExt language's location.
2019-12-08 21:36:51 +01:00
Fedor Isakov
eb50ce7f86
Typechecking BL: optimize matching list with arguments.
...
Checking for triggering condition in guard is ineffective.
Pattern matching is faster.
2019-12-08 17:51:41 +01:00
Fedor Isakov
b182cf60d7
Revert "Temporarily ignore failing tests."
...
This reverts commit 7776f97fe7 .
2019-11-26 23:09:40 +01:00
Fedor Isakov
85674ef077
Add explicit "test" facets to test solutions.
2019-11-24 17:58:15 +01:00
Fedor Isakov
7776f97fe7
Temporarily ignore failing tests.
...
The tests presumably fail because of a broken contract that is used
in the typesystem implementation, namey that a logical variable
contained by an constraint argument-term (as opposed to being an
argument itself) reactivates the constraint on ground/parent change
event. This assumption is false, thereby the implementation needs
to be adjusted keep compatibility with the contract.
2019-11-24 13:34:59 +01:00
Fedor Isakov
96fbab18b4
Fix dependencies of blExt and javadocExt langs.
...
The dependency on j.m.l.typechecking lang must be kept on the module level.
2019-11-24 13:34:59 +01:00
Fedor Isakov
8fdd80c54e
Restore accidentally remove language import. Fix the tests.
2019-11-11 16:58:00 +01:00
Fedor Isakov
dbc5154491
Reload and re-generate build scripts.
2019-11-11 15:28:23 +01:00
Fedor Isakov
69bc34e8f9
Drop language j.m.l.smodel.types containing SNodeTypeOp that is no longer used.
2019-11-11 14:37:41 +01:00
Fedor Isakov
ecd2594fed
Drop deprecated Reporting interface and all its usages.
...
Remove runtime solution that contained only Reporting.
2019-11-11 13:53:41 +01:00
Fedor Isakov
1e068abe13
Repackage typechecking tests to separate module.
...
All test data (code) to be contained in j.m.blExt.test module.
The samples are to be kept separately with generation on to demonstrate fewer false negatives
of the new typechecker.
2019-11-06 21:14:12 +01:00
Fedor Isakov
3f1b65ada2
Fix the structural errors introduced by a badly run migration.
2019-11-06 12:05:18 +01:00
Fedor Isakov
ad90a4cb77
Apply migration that replaces all instances of NodeAnchor with .pointer op.
2019-11-06 11:21:57 +01:00
Fedor Isakov
daa1bdceb6
Update default jvm options for running tests to "-Xmx2048m".
2019-11-05 20:53:01 +01:00
Fedor Isakov
15a7dece1b
Move error annotation to the correct place in test samples.
2019-11-05 18:55:08 +01:00
Fedor Isakov
9f3301f1c2
Typechecking BL: Use origin block to suppress target for dpromote solvers.
2019-11-05 18:54:38 +01:00
Fedor Isakov
8d21b056fa
Typechecking BL: drop calls to node-ptr.resolve where not necessary.
...
Replace expand macro with plain term constructors for String and Object.
2019-11-04 17:16:45 +01:00
Fedor Isakov
0585f88496
Suppress a scope error in a "bad" sample.
2019-11-04 16:20:57 +01:00
Fedor Isakov
4396adc9ff
Fix error being reported on another location.
2019-11-04 16:20:57 +01:00
Grigorii Kirgizov
320a19af93
Add test checking precondition for other tests on incrementality
...
The test is concerned with correct computation of RulesDiff and correct work of ArgumentsCollector
2019-10-31 19:33:17 +03:00
Grigorii Kirgizov
224d998c9a
Temporarily comment out a failing line in Samples_bad3
2019-10-28 20:56:56 +03:00
Grigorii Kirgizov
530dfd8719
Fix incorrect vis scopes due to failing coerceTo queries. Assign 'fallback' type in classifierType macro on error to continue typechecking besides returning error.
...
The problem is concerned from incorrect recover of captureType given recent changes to its handling.
Essentially, recover was losing information about inferred type var bounds.
Also, necessary rule for convertsTo for upperBpundType was missing.
2019-10-28 20:55:24 +03:00
Grigorii Kirgizov
3016ffd904
Remove dependency on lang.text to enable experimental typechecker for Samples:bounds.bad
2019-10-28 18:33:00 +03:00
Grigorii Kirgizov
223b243e7f
MPSCR-2: Fix capture of lowerBoundType on type variables with bounds
2019-10-26 21:44:09 +03:00
Grigorii Kirgizov
820066cf4d
Set "do not generate" flags again on some examples in bl tests
2019-10-26 17:11:47 +03:00
Grigorii Kirgizov
bc46a8e5ce
Upd broken refs to logical vars
2019-10-26 17:01:07 +03:00
Grigorii Kirgizov
c16801a928
Remove unnecessary accidental test root for BL
2019-10-26 16:17:41 +03:00
Grigorii Kirgizov
10a4b9ac70
Extend Lub test a bit with intersection type consumer
2019-10-26 16:17:41 +03:00
Grigorii Kirgizov
1b4a5ce55d
Add check that all aux boudns in type var decl are interfaces. Add test for such error.
2019-10-26 16:17:37 +03:00
Grigorii Kirgizov
122917cc42
Fix: clean up lub() constraint in one case. Caused typechecker errors.
2019-10-26 16:17:37 +03:00
Grigorii Kirgizov
03702da2f0
Add handling of aux bounds in type variable macros
2019-10-26 16:17:37 +03:00
Grigorii Kirgizov
b4d61ecb91
Add two more lub examples in LUB test
2019-10-26 16:17:37 +03:00
Grigorii Kirgizov
dfa53a265f
Add static field access to Sample typechecking test in BL
2019-10-26 16:16:59 +03:00
Grigorii Kirgizov
8e1633b0fb
Fix typing rule for FieldReferenceOperation
2019-10-26 16:16:59 +03:00
Grigorii Kirgizov
9ec95421bf
MPSCR-1: Remove unsound rule from containedIn relation. Add test for that case. Restructure Lub tests.
...
Now another test for suspicious rule for fieldReferenceOperation fails.
2019-10-26 16:16:59 +03:00
Grigorii Kirgizov
223cbeaabe
Add incremental test for BL plus operator overload for String type
2019-10-26 16:14:43 +03:00
Fedor Isakov
742adef5f9
Completing BL typesystem: [ClassifierClass,Mul,Div,LT,GT,NEQ]Expression, UnaryMinus.
2019-10-25 22:45:55 +02:00
Fedor Isakov
3092fa3635
Fix all templates with broken scopes for logical variables.
2019-10-25 22:45:55 +02:00
Fedor Isakov
a117f52ad5
Various improvements in j.m.baseLanguageExt typesystem.
...
Introduce generic way of handing recover/2 for ClassifierType.
Extract handling of expectType/2 constraint into a separate ruleslist.
Add lub/3 handler for char type.
2019-10-24 16:29:22 +02:00
Fedor Isakov
2e2cfd5194
Enable generation of samples known to be valid.
2019-10-24 13:29:55 +02:00
Fedor Isakov
c81b88f636
Fix Lub test: proove that the result of ternary operation is correct. Enable compilation of "bounds" model.
2019-10-22 21:20:20 +02:00
Fedor Isakov
fdd7c7fb19
New language j.m.bl.javadocExt to contain types aspect for javadoc.
2019-10-22 21:20:20 +02:00
Fedor Isakov
94dae1c5a8
Fix buildscript for samples/mpscore (extract dependency).
2019-10-18 17:02:14 +02:00
Grigorii Kirgizov
7fb8ebd7c2
Fix one assert in incremental tests to correctly check nodes with type errors. Fixes last failing test.
2019-10-17 13:17:16 +03:00
Grigorii Kirgizov
ef93acd34a
Revert "Temporarily silence the last failing BL incrementality test"
...
This reverts commit 5aa7585b
2019-10-17 12:58:37 +03:00
Grigorii Kirgizov
d861fd5eb4
Add convertsTo_ground reflexive case.
...
At least convertsTo(stringType(), stringType()) was failing without it.
2019-10-17 12:33:17 +03:00
Grigorii Kirgizov
5aa7585bea
Temporarily silence the last failing BL incrementality test
2019-10-15 21:31:29 +03:00
Grigorii Kirgizov
0fdc2ada2a
Rewrite BL Recover base rules to make dependencies between rules visible (i.e. to actually reeval 'eval' predicates in rules incrementally)
2019-10-15 21:29:07 +03:00
Grigorii Kirgizov
28a82fd443
Revert "Temporarily disable failing tests in BLIncrTypecheck test case."
...
This reverts commit 1c1ddd6e
2019-10-15 18:01:21 +03:00
Fedor Isakov
6372f5a4a4
Experimental: cache the results of convertsTo/coerceTo queries.
...
The cache is repository-local and is invalidated on every command in that repository.
2019-10-12 09:35:09 +02:00
Fedor Isakov
c7ad048a9e
Completing the BL typesystem: rules for Minus- and ParethesizedExpression.
2019-10-12 09:35:09 +02:00
Fedor Isakov
1c1ddd6e5d
Temporarily disable failing tests in BLIncrTypecheck test case.
...
Tests started to fail after an argument was introduced to a constraint that is being
activated from a query -- recoverAll/1 now has a parameter.
2019-10-12 09:35:09 +02:00
Fedor Isakov
f8dcf127db
Extend typechecking query TYPECHECK with a parameter to report types.
...
Reporting of calculated types is to be more explicit.
The not-so-obvious _type_.set() operation is to be phased out.
2019-10-10 17:30:11 +02:00
Fedor Isakov
be81c982f1
Housekeeping in BL typesystem: organize artifacts using virtual folders.
2019-10-09 13:45:20 +02:00
Fedor Isakov
3d7f8688f5
Add new sample for testing typechecking performance.
2019-10-08 13:30:16 +02:00
Fedor Isakov
9914c3ba19
Add all descendants of classifier type as required.
2019-10-03 10:25:25 +02:00
Fedor Isakov
64a4be471f
Optimize typechecking of array literals. The errors are now reported on the literal itself.
...
In general one should avoid using `typeOf/2` constraint with first argument being a logical.
The indexing mechanism ensures efficient search of matching rules when at least one argument
is a constant value. However, when all arguments are free logicals, *all* matches should be
tested, which is highly ineffective.
2019-09-30 16:44:36 +02:00
Fedor Isakov
7210fd2cad
Drop checking for unique varname in BL typesystem.
2019-09-30 16:44:36 +02:00
Fedor Isakov
49518e0704
Switch to reactor version 0.9.14.
2019-09-30 16:44:36 +02:00
Grigorii Kirgizov
b362f55b25
Fix error annotations to be on args in method calls tests. Unsilence incremental tests, same arg fix.
2019-09-16 13:56:23 +03:00
Grigorii Kirgizov
c0e4bb1d1a
Fix reporting on argument nodes in MethodCall rules
2019-09-16 13:56:23 +03:00
Grigorii Kirgizov
51258b5179
Silence two tests on incremental typechecking concerned with method calls
2019-09-16 13:56:23 +03:00
Grigorii Kirgizov
ace483a61d
Add tests on varargs. Adjust two error annotations.
2019-09-16 13:56:23 +03:00
Grigorii Kirgizov
b4f2d88123
Add rules for checking method arguments incl. variable argument
2019-09-16 13:56:23 +03:00
Grigorii Kirgizov
d251f626fa
Remove Scratchpad that accidentally found its way into test suite
2019-09-16 13:56:23 +03:00
Fedor Isakov
2942c244a6
Move model access out of coderules evaluation, avoid "read access violation".
...
It's doubtful this check belongs here, but let's keept it for now.
2019-09-13 13:00:03 +02:00
Fedor Isakov
6938a8108b
Drop superfluous check involving smodel access.
...
Typechecker should be occupied with checking types, not the model validation.
2019-09-13 11:31:18 +02:00
Fedor Isakov
eda493f672
Fix typechecking of VariableArityType.
...
Parameter was defined as list instead of child.
2019-09-13 11:28:34 +02:00
Grigorii Kirgizov
332735e770
Remove unneded handler
2019-09-12 15:29:14 +03:00
Grigorii Kirgizov
cdfe1f2c0c
Update language version after migrations from mps.logic lang
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
a9cf2e5589
Fix inf recursion in recovering intersectionType
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
9a782fc619
Run 'list literal -> cons list constructor' migration on samples
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
39fa007310
Run Splice migration on samples
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
163e339436
Add migration for replacing List usages for ConsList constructor usages
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
1e23572397
minor change of method use in BaseHelper
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
005dfa1e33
Fix reporting for typechecking of arrays in bl
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
6a02be6f6e
Avoid nested empty lists in mapped ListNode.Alias. Fix capture in lcta helper for lub. Add test for lub.
...
The problem with empty lists showed up at least in printing lists.
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
442d15204c
Add capture conversion for type variables produced by LUB
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
a8cb00c8b5
Handle recursive case of LUB: produce wildcard type param
2019-09-11 13:24:02 +03:00
Grigorii Kirgizov
37be72d9cf
Refactor generation of ListFeature & 'spliced' MultiMetaLogical. Fix BL typesystem to accomodate these changes.
...
ListRole in DataForms is stricter and doesn't allow non-list values.
Spliced MultiMetaLogical is always generated to ListNode without intermediate step of Variable[].
2019-09-11 13:24:01 +03:00
Grigorii Kirgizov
4938551fcb
Subst ListNode for 'term' type in some places in relation concerned with LUB. Change ListRole to ChildRole in upperBoundType & lowerBoundType.
2019-09-11 13:24:01 +03:00
Grigorii Kirgizov
6255bdb6f5
Add relations required for recursive case of LUB
2019-09-11 13:24:01 +03:00
Grigorii Kirgizov
087bfdaf9b
Extend LubHelper to collect all parameterizations of erased types from raw LUB
2019-09-11 13:24:01 +03:00
Grigorii Kirgizov
d3186851db
Instantiate type variables in extended 'findSubtypePaths' rule
2019-09-11 13:24:01 +03:00