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