Commit Graph

40644 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy dc83e5ca3a Fix test which is correctly work in old inference 2017-08-07 18:01:17 +03:00
Mikhail Zarechenskiy 3fb865e07c Move test for NI to diagnostic tests and add "todo" 2017-08-07 18:01:16 +03:00
Mikhail Zarechenskiy fb72726f08 Resolve right part of equality with given descriptors 2017-08-07 18:01:15 +03:00
Stanislav Erokhin 6680f01cfe [NI] Fix assertion error at FlexibleTypeImpl
Use KotlinTypeFactory for FlexibleType creation
2017-08-07 18:01:14 +03:00
Mikhail Zarechenskiy e7cd615450 [NI] Introduce type depth in CS calculator to avoid SOE 2017-08-07 18:01:13 +03:00
Mikhail Zarechenskiy cf75afba66 [NI] Fix type intersection for equal types 2017-08-07 18:01:12 +03:00
Mikhail Zarechenskiy ac507e721c [NI] Do not add non-dynamic candidates when there is dynamic extension 2017-08-07 18:01:11 +03:00
Mikhail Zarechenskiy 21c5187c9e [NI] Handle dynamic types in type intersector 2017-08-07 18:01:10 +03:00
Mikhail Zarechenskiy 0d464f06d1 [NI] Consider CS as nullable if one of the types isn't subtype of Any
Note that this isn't fully correct, consider the following situation:

S : T, T : Any?
=> CS(S, T) = T, but for now it will be T?, which is reliable but not so specific as just T
2017-08-07 18:01:09 +03:00
Mikhail Zarechenskiy 39349abd39 [NI] Preserve name of parameters for functional types 2017-08-07 18:01:07 +03:00
Mikhail Zarechenskiy 5ec8d4920f [NI] Translate new resolved call to old one to avoid CCE 2017-08-07 18:01:06 +03:00
Dmitry Petrov c0d6eff97c [NI] Select variable with proper non-trivial constraint first 2017-08-07 18:01:05 +03:00
Dmitry Petrov 0bf81aeec0 [NI] Extract InferenceStepResolver into a separate component 2017-08-07 18:01:04 +03:00
Dmitry Petrov 258a5aea28 [NI] Minor cleanup in FixationOrderCalculator 2017-08-07 18:01:03 +03:00
Stanislav Erokhin ab2f99542a [NI] Redo how we take care of postpone arguments
The main change here is the following: before callable reference
resolution starts directly after choosing candidate. Since now we
start resolution before call completion.
2017-08-07 18:01:02 +03:00
Stanislav Erokhin b344865c15 [NI] Minor. Fixes after review 2017-08-07 18:01:01 +03:00
Stanislav Erokhin 93d80c252f [NI] Refactoring. Move properties from KotlinCall to external component 2017-08-07 18:01:00 +03:00
Stanislav Erokhin ef93088a42 [NI] Move most of KotlinCallDiagnostic to one file
Now there is 3 kind of KotlinCallDiagnostic:
  - ResolutionDiagnostic
  - ConstraintSystemCallDiagnostic
  - other common diagnostic

Also SpecialResolutionParts were merged into other ResolutionParts
2017-08-07 18:00:59 +03:00
Stanislav Erokhin 9378bff65c [NI] Move irrelevant code from KotlinCallCompleter
Extract code about smart cast diagnostic to new component
AdditionalDiagnosticReporter
2017-08-07 18:00:58 +03:00
Stanislav Erokhin 3450340d7f [NI] Refactoring. Introduced PostponableCallArgument
Also here argument resolution was divided to two parts:
for SimpleCallArguments and for PostponableCallArguments.
Call Resolution for SimpleCallArguments also used for CheckReceivers
and lambda result arguments checks
2017-08-07 18:00:57 +03:00
Stanislav Erokhin 1bc68e073d [NI] Minor. Clarified type for arguments from lambda 2017-08-07 18:00:56 +03:00
Stanislav Erokhin 4848f8e3da [NI] Use correct type in TypeApproximator for Invariant projection 2017-08-07 18:00:56 +03:00
Stanislav Erokhin 85e34163bb [NI] Temporary fix for cases related callable reference and if
For cases like if (..) ::foo else ::bar we didn't write stub resolved
calls for ::foo before call completion. Because of this, and strange
code in if we get null inside type info.
2017-08-07 18:00:54 +03:00
Stanislav Erokhin 455c43afa8 [NI] Some improvements in callable reference resolution 2017-08-07 18:00:53 +03:00
Stanislav Erokhin f1144c9f01 [NI] Use resolved lhsType as unbound receiver. 2017-08-07 18:00:53 +03:00
Stanislav Erokhin c752e1580e [NI] Check receivers for callable reference resolution. 2017-08-07 18:00:52 +03:00
Stanislav Erokhin a5dffafacd [NI] Fix provideDelegate resolution.
For provideDelegate there is no real psi for resolution,
so we write corresponding call via special trace key.
2017-08-07 18:00:51 +03:00
Mikhail Zarechenskiy 7802492b08 [NI] Fix resulting type when there are no proper constraints 2017-08-07 18:00:50 +03:00
Mikhail Zarechenskiy 6be726854f [NI] Preserve type abbreviation during type substitution 2017-08-07 18:00:49 +03:00
Mikhail Zarechenskiy 76d013a33f [NI] Resolve % to mod if candidates have wrong receivers 2017-08-07 18:00:48 +03:00
Dmitry Petrov 4963580f90 [NI] Take into account return without expression in lambdas 2017-08-07 18:00:47 +03:00
Mikhail Zarechenskiy 17cdbcca03 [NI] Approximate substituted type arguments for non-members 2017-08-07 18:00:46 +03:00
Stanislav Erokhin 915ac32bfb [NI] Improve type inference for T vs Captured(in Smt)
If we has Inv<T> <: Inv<Captured(in Foo)> then we should get:
- T <: Captured(in Foo)
- Captured(in Foo) <: T

Before this commit we got: T <: Foo instead first constraint.
2017-08-07 18:00:45 +03:00
Stanislav Erokhin 91241a34d1 [NI] Run checks for captured types only once in NewTypeSubstitutor
Sometimes we can get Enum<Captured(*)> type here, so, supertype for
Captured(*) is Enum<Capture(*)> and we go into SO.
2017-08-07 18:00:44 +03:00
Stanislav Erokhin d58c6e245f Minor. rename type parameters for debug purposes. 2017-08-07 18:00:43 +03:00
Mikhail Zarechenskiy e74a02eb94 [NI] Approximate implicit return type for functions 2017-08-07 18:00:42 +03:00
Mikhail Zarechenskiy ffc130f5fb [NI] Always approximate captured types for property descriptors 2017-08-07 18:00:41 +03:00
Stanislav Erokhin 5f2cc75718 [NI] Support INAPPLICABLE_WRONG_RECEIVER candidate applicability
It is important for provideDelegate resolution, because if scope has
provideDelegate with wrong receiver we shouldn't resolve to it and
report any errors.
2017-08-07 18:00:40 +03:00
Stanislav Erokhin e4b73fcdbd [NI] Create SubCallArgument for variable in VariableAsFunctionCall
If variable is generic call, then we should complete inference only
after invoke resolution. It means that explicit receiver for invoke
should be SubKotlinCallArgument.
But, if this property has no generics,
for example local property, then this property can have smartcast and
such call has no type arguments -> no completion required.
For such call we should store information about smart casts.
2017-08-07 18:00:39 +03:00
Dmitry Petrov 756f7d6e9c [NI] Fix tests (was a type checker bug, see KT-18380) 2017-08-07 18:00:38 +03:00
Dmitry Petrov d4e8a30dcf [NI] Fix nullability for captured type in input types approximation 2017-08-07 18:00:37 +03:00
Dmitry Petrov e5c87fdad7 [NI] Filter out duplicates types in commonSuperTypeForNotNullTypes 2017-08-07 18:00:36 +03:00
Dmitry Petrov b336919db3 [NI] In NI mode, use return type from special call resolution for '!!' 2017-08-07 18:00:35 +03:00
Dmitry Petrov 397e04f382 [NI] Do not use return type from 'onlyResolvedCall' 2017-08-07 18:00:34 +03:00
Dmitry Petrov 5b2e66f0ca [NI] Invoke checkType for arguments
checkType performs various actions required by BE
(e.g., record nullability assertions information for JVM BE).
2017-08-07 18:00:33 +03:00
Dmitry Petrov dc453e6d8b [NI] Update lambda argument expression type when return type is known 2017-08-07 18:00:32 +03:00
Dmitry Petrov ba068c2d65 Use original descriptor for enum constructor symbol 2017-08-07 18:00:31 +03:00
Mikhail Zarechenskiy def0816095 [NI] Write info about hidden descriptor to candidate 2017-08-07 18:00:30 +03:00
Mikhail Zarechenskiy 38d9123a57 [NI] Use weaker upper constraint for case {T & Any} <: S 2017-08-07 18:00:29 +03:00
Stanislav Erokhin 18961cc5a9 [NI] Analyze lambda in independent context if it isn't call argument 2017-08-07 18:00:28 +03:00