Victor Petukhov
559bedf5ae
Continue processing not builder inference stub variables in the type checker during computing common super type
...
^KT-47148 Fixed
2021-06-15 17:40:56 +03:00
Tianyu Geng
ce767046eb
FIR checkers: report SMARTCAST_IMPOSSIBLE
2021-06-10 16:01:13 +03:00
Denis.Zharkov
6136526a3a
FIR: Avoid reporting inference errors from DelegatedPropertyConstraintPosition
...
All necessary diagnostics have already been reported through the checkers
2021-06-07 15:25:50 +03:00
Denis.Zharkov
c420957eac
FIR: Report INFERENCE_NO_INFORMATION_FOR_PARAMETER diagnostic
2021-06-07 15:25:45 +03:00
Victor Petukhov
1e5998e0ba
Add constraints between two different stub variables instead of creating constraint error due to T1 isn't subtype of T2
...
^KT-44241 Fixed
2021-06-03 19:18:09 +03:00
Victor Petukhov
124a14c8df
Use separate constraint position during call substitution as part of inferring postponed type variables
...
^KT-47052 Fixed
^KT-47082 Fixed
2021-06-03 12:37:17 +03:00
Dmitriy Novozhilov
796f8e6bce
Revert "FIR checkers: report SMARTCAST_IMPOSSIBLE"
...
This reverts commit 84334b08
2021-06-03 09:48:50 +03:00
Tianyu Geng
84334b087c
FIR checkers: report SMARTCAST_IMPOSSIBLE
2021-06-02 13:19:12 +03:00
Victor Petukhov
9fd1cbd2e7
Inject stub type variables of a different builder inference call properly
2021-05-28 15:36:19 +03:00
Victor Petukhov
0c427555cf
Support definitely not null stub types and proper subtyping on them
2021-05-28 15:36:19 +03:00
Victor Petukhov
5a11450d77
Split stub types into stub type for subtyping and for builder inference and use them in the proper way
2021-05-28 15:36:17 +03:00
Victor Petukhov
ac7b459f2a
Do subtyping with stub types properly
...
1) Return stub type if we are calculating super type between two same stub types
2) Return nullable Any if those stub types are different
2021-05-28 15:36:15 +03:00
Denis.Zharkov
faa5e46396
FIR: Fix inference case with flexible captured types
...
Previsously, errors have been ignored because we ignored errors raised
from the completion phase
See the comment above the createConstraintPartForLowerBoundAndFlexibleTypeVariable
2021-05-20 17:24:28 +03:00
Denis.Zharkov
dac5c31993
Minor. Simplify ConstraintSystemUtilContext::createArgumentConstraintPosition
2021-05-20 17:24:23 +03:00
Andrey Zinovyev
b1c8669b43
[FIR] Resolve infix calls to infix functions only
...
Implements INFIX_MODIFIER_REQUIRED diagnostics
2021-05-20 13:46:27 +03:00
Victor Petukhov
2239404085
Extract type preparation during type checking to a separate component
2021-05-18 17:52:23 +03:00
Victor Petukhov
7c62e9aecd
Introduce warnings reporting by missed constraints because of incorrect optimization in the constraints processor
2021-04-30 15:46:04 +03:00
Victor Petukhov
e110b49cab
Revert "Don't stop constraints processing if all type variables have proper equality constraints"
...
This reverts commit b87c2a15
2021-04-30 15:46:03 +03:00
Victor Petukhov
867d7b5bca
Allow type variable fixation into intersection type if it isn't meaningless (i.e. has one or more final classes, or two or more open classes)
...
^KT-46186 Fixed
2021-04-23 15:12:13 +03:00
Tianyu Geng
6a03f31e50
FIR: add UnsafeCall resolution diagnostics
...
Previously unsafe call is reported as part of InapplicableWrongReceiver.
This makes it difficult for the downstream checkers to report different
diagnostics.
2021-04-19 15:11:13 +03:00
Mikhail Glukhikh
9b3f1b9b8a
Inference: handle Exact constraints with captured types properly
...
#KT-41818 Fixed
2021-04-15 15:55:41 +03:00
Denis.Zharkov
37f923a98f
Do not approximate DefinitelyNotNullType in public declarations
...
Because since 1.6 they become normal denotable types
^KT-26245 Fixed
2021-04-09 13:06:37 +03:00
Denis.Zharkov
e74a0c7ef7
Pass languageVersionSettings to AbstractTypeApproximator
2021-04-09 13:06:35 +03:00
Victor Petukhov
7f2c5cde55
Propagate input type position across incorporation properly
...
^KT-45719 Fixed
2021-03-29 16:17:31 +03:00
Victor Petukhov
d06031ece3
Approximate types when only input types check is done. Otherwise given types are inconsistent with types obtained by ResultTypeResolver
...
^KT-45714 Fixed
2021-03-29 16:17:30 +03:00
Victor Petukhov
60f2f85be7
Process captured types with type variable inside properly, in the operations related with the type variables fixation
2021-03-19 16:16:11 +03:00
Victor Petukhov
91d2f32a57
Don't lose upper non-expected type constraints to include them to intersection type during finding the result type of the fixing type variable
2021-03-12 14:36:54 +03:00
Victor Petukhov
b87c2a15b5
Don't stop constraints processing if all type variables have proper equality constraints
...
Those type variable may have other constraints after incorporation into which, the constraint error may appear
^KT-42042 Fixed
2021-03-12 14:36:54 +03:00
Victor Petukhov
7f7bb70596
Don't fix a type variable into the intersection type if there is an explicit expected type
...
^KT-43303 Fixed
^KT-42396 Fixed
^KT-42472 Fixed
2021-03-12 14:36:53 +03:00
Ilya Kirillov
af4d300686
Use nullability from approximated local type in AbstractTypeApproximator
2021-02-19 16:44:47 +01:00
Dmitriy Novozhilov
3626008ed2
[Inference] Add ability to approximate local types in AbstractTypeApproximator
2021-02-19 12:47:27 +03:00
Simon Ogorodnik
3909e3c54c
Decouple TypeCheckerContext and TypeSystemContext
2021-02-15 18:28:58 +03:00
Victor Petukhov
dcad9c84fc
Don't fix type variables into Nothing in priority way
...
^KT-44546 Fixed
2021-02-15 15:12:45 +03:00
Victor Petukhov
9efac8f68b
Propagate all annotations during creating simple functional types
...
^KT-44563 Fixed
2021-01-29 13:50:46 +03:00
Victor Petukhov
977ac7cbe7
Propagate nullness flexibility into the result type from type variables in other constraints during result type finding, to prevent variable fixation to less flexible type
...
^KT-44540 Fixed
2021-01-27 17:23:15 +03:00
Victor Petukhov
f06a5321a6
Approximate definitely not-null types for type parameter's types if they are already not-null (has not-null upper bounds)
...
^KT-44440 Fixed
2021-01-25 14:17:58 +03:00
Victor Petukhov
0dde5ddd7e
Fail calls constraints of which contain uninferred type parameter
...
^KT-44055 Fixed
It's possible only if there is a callable reference among subcalls which go though the old type inference (and the error for uninferred type parameter wasn't reported)
2020-12-25 11:53:16 +03:00
Victor Petukhov
1926434b18
Report error about uninferred type parameter for some special call' subcalls
2020-12-25 11:53:14 +03:00
Jinseong Jeon
0ea6b32c01
NI: allow lower bound of flexible type for coercion-to-Unit
...
Example from
box/inference/coercionToUnitForLambdaReturnTypeWithFlexibleConstraint
// FILE: TestJ.java
public class TestJ {
public static <T> In<T> materialize() { return null; }
}
// FILE: test.kt
class In<in T>
fun <T> inferred(e: In<T>?, l: () -> T): T = l()
fun box() {
inferred(TestJ.materialize<Unit>(), { null })
}
`materialize` has flexible type, both for `In<T>` and `T`.
When analyzing `{ null }`, collected type constraints include:
ft<Unit?, Unit> <: T (from ft<In<ft<Unit, Unit?>>, In<ft<Unit, Unit?>>?>)
By allowing the lower bound of flexible type, FIR resolution can visit
`{ null }` with the expected type Unit, which will lead to proper
coercion to Unit at the end.
2020-12-15 17:52:48 +03:00
Victor Petukhov
04846ca47a
Rework checking constraints by presented OnlyInputTypes annotation in accordance with changed incorporation mechanism
2020-11-25 11:15:23 +03:00
Victor Petukhov
0857b9c9e7
Rethink constraints incorporation
...
Namely, remove incorporation “otherInsideMyConstraint” to eliminate
constraint system redundancy and produce a potentially very large number
of constructs.
Instead, introduce not so “spreadable” incorporation during variable
fixation (equality constraint with result type into other constraints).
^KT-41644 Fixed
^KT-42195 Fixed
^KT-42920 Fixed
^KT-42791 Fixed
^KT-41741 Fixed
2020-11-25 11:15:20 +03:00
Victor Petukhov
616e40f879
Reuse equality constraints during simplification in adding constraints
2020-11-25 11:15:19 +03:00
Alexander Udalov
b3e79d36df
Fix compiler warnings and some inspections
2020-11-03 14:00:53 +01:00
Victor Petukhov
84129098cb
Add equality constraints without subtyping
...
^KT-42195 Fixed
^KT-41741 Fixed
2020-10-21 21:23:13 +03:00
Victor Petukhov
c6da2a1138
Reuse built functional types for postponed arguments by expected types and paths from a top level type variable
...
^KT-42221 Fixed
2020-10-16 10:46:22 +03:00
Pavel Kirpichenkov
39a87435ee
[FIR/NI] Refactor type variable gathering from lambda types
...
Motivation:
- drop getArguments from type context as a duplicate of getArgumentList
- reduce the number of collection allocations in getAllDeeplyRelatedTypeVariables
Additional minor improvements, test data fixes
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
712a2ce1ab
[FIR] Improved lambda completion: initial implementation
...
Repeat the logic of KotlinConstraintSystemCompleter in ConstraintSystemCompleter.
Implement additional context operations required for updated lambda completion algorithm.
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
5eae6f2f4e
[FIR] Move PostponedArgumentInputTypesResolver to resolution.common
2020-10-13 11:00:20 +03:00
Pavel Kirpichenkov
3822a32fce
[FIR] Prepare commonization of PostponedArgumentInputTypesResolver
2020-10-13 11:00:20 +03:00
Victor Petukhov
6c1dc43d25
Add check already fixed variables in PostponedArgumentInputTypesResolver during adding constraints on them and using inside a functional type
...
^KT-42374 Fixed
2020-10-02 18:31:54 +03:00