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
Dmitry Petrov
8599763cb9
Do not perform type checks for function literals in visitor in NI mode
...
They are type-checked as arguments for the corresponding expressions.
2017-08-07 18:00:27 +03:00
Dmitry Petrov
fbad16567b
[NI] Fix number type adjustment for greatest lower bound calculation
...
Compute common supertype (regardless of whether the given set of
lower bounds contains number types, intersection types, or whatever).
If the result type S is a possibly nullable intersection X1 & ... & Xn,
N = {Xi | Xi is a primitive number type},
R = {Xi | Xi is not a primitive number type},
M = default primitive number type for {Nj},
then adjusted type T* = M & R1 & ... Rm with the same nullability as S.
NB: IntegerValueType(_) = Int & Byte & Short & Long
2017-08-07 18:00:26 +03:00
Dmitry Petrov
1ae4278cfd
Minor: fix formatting
2017-08-07 18:00:25 +03:00
Mikhail Zarechenskiy
bc2a8555a3
[NI] Resolve collection literals arguments as postponed ones
2017-08-07 18:00:24 +03:00
Stanislav Erokhin
c0c94910e2
[NI] Fix StackOverflow in TypeApproximator
...
For cases like Enum<Captured(*)> where Captured(*) has supertype
Enum<Captured(*)> we get SO in TypeApproximator.
To prevent this argument depth was introduced.
2017-08-07 18:00:23 +03:00
Dmitry Petrov
9fa3bce73a
[NI] Fix special case of captured type handling in subtyping
...
Given the subtyping constraint
X <: CapturedType(in Y)
we should check only
X <: Y
if X contains type variables.
2017-08-07 18:00:22 +03:00
Dmitry Petrov
26cc08be65
Fix anonymous function literals handling in type checker
...
- [NI] Create type info directly if the expected type is functional.
- Properly handle suspended function expected type.
2017-08-07 18:00:21 +03:00
Dmitry Petrov
6facdcb7ea
Minor: lambda arguments formatting
2017-08-07 18:00:20 +03:00
Mikhail Zarechenskiy
badbf777df
[NI] Use data flow info from arguments in parenthesis to resolve lambda
...
Fixes 'javaObjectType' and 'javaPrimitiveType'
2017-08-07 18:00:19 +03:00
Stanislav Erokhin
5eb56dca60
[NI] Check type compatibility before fixation.
...
If for type variable we have upper and lower bounds, then sometimes
our approximation before fixation give us incorrect result for type
variable and we should chose other bound as result.
Example: Int & Byte <: T <: Byte. If we run approximation for lower
bound we get Int as result and it isn't subtype of Byte.
2017-08-07 18:00:18 +03:00
Mikhail Zarechenskiy
d1263c5dc3
[NI] Coerce to unit for empty lambda block
...
Fixes 'kt3903'
2017-08-07 18:00:17 +03:00
Mikhail Zarechenskiy
cf55674109
[NI] Support fallback resolve to operator mod if needed
...
Fixes:
- assignmentOperations
- percentAsModOnBigIntegerWithoutRem
2017-08-07 18:00:16 +03:00
Dmitry Petrov
f578d07b00
[NI] Fix lambda return type when expected type is not functional type
...
Introduce a fresh type variable for lambda return type.
We can't set expected lambda return type to 'Any?', because we can't
infer the actual type from return expressions in lambda in that case.
2017-08-07 18:00:15 +03:00
Dmitry Petrov
f637ebe9ff
Minor: formatting for lambda arguments
2017-08-07 18:00:14 +03:00
Stanislav Erokhin
b7c894a6d3
[NI] Capture types from smart-cast types.
...
Sometimes we have something like if (a is Foo<*>) a.bar()
where bar declared: fun <T> Foo<T>.bar().
For such case we should create receiver with possible types Capture(*).
2017-08-07 18:00:13 +03:00
Mikhail Zarechenskiy
b6bb171b67
[NI] Extension function wins member if it's infix call
...
Fixes 'infixFunctionOverBuiltinMember'
2017-08-07 18:00:12 +03:00
Mikhail Zarechenskiy
8670d2abba
[NI] Propagate information about safe call to receiver argument
2017-08-07 18:00:11 +03:00
Mikhail Zarechenskiy
72d14bfe0d
[NI] Record type of callable reference to trace
2017-08-07 18:00:10 +03:00
Dmitry Petrov
a303888e66
[NI] Fix expected return type for function literals
...
It should actually be Unit, as told in FunctionExpression comments
(was null, later defaulted to Any?).
2017-08-07 18:00:09 +03:00
Dmitry Petrov
0136be3500
[NI] Fix traversing delegated constructor call chain
...
Use original descriptor instead of possibly substituted one: even though
the substitution is always trivial here, delegated constructor call is
recorded for the original constructor descriptor. So the code that
traverses the delegated constructor call chain should use original
descriptor, too.
2017-08-07 18:00:08 +03:00
Mikhail Zarechenskiy
0634025229
[NI] Propagate known type substitutor to resolution part
...
This commit fixes 'functionNtoStringGeneric' and 'superConstructor'
2017-08-07 18:00:07 +03:00
Mikhail Zarechenskiy
c6fcbf6172
[NI] Check for unwrapped descriptor when generating accessible function
...
In new inference we get copy of sam constructor and therefore should check original descriptor in BE.
This fixes 'protectedSamConstructor' test
2017-08-07 18:00:06 +03:00
Stanislav Erokhin
e12eb66572
[NI] Fix COERCION_TO_UNIT in NI.
2017-08-07 18:00:05 +03:00
Stanislav Erokhin
de17604fe7
[NI] Bind all new resolved calls before update arguments.
2017-08-07 18:00:04 +03:00
Stanislav Erokhin
42438bd363
[NI] Do not calculate lambda return type in Visitor if NI enabled.
2017-08-07 18:00:03 +03:00
Stanislav Erokhin
85248676d2
[NI] Update lambda result arguments after resolution.
2017-08-07 18:00:02 +03:00
Stanislav Erokhin
b9e9243e9d
[NI] Add hacks for property delegation resolution.
2017-08-07 18:00:00 +03:00
Stanislav Erokhin
af138e7403
Minor. Extract object to inner class.
2017-08-07 17:59:59 +03:00
Stanislav Erokhin
5bb61d2d02
[NI] Small improvements in callable reference resolution.
...
I'm not sure in this commit, but it fix some test -> let it be for now.
And yes, now I do not know correct way for callable reference resolution,
so for now it is just proposals.
2017-08-07 17:59:58 +03:00
Stanislav Erokhin
7eabdeffb3
[NI] Fix variable to proper upper type even if direction is TO_SUBTYPE.
2017-08-07 17:59:57 +03:00
Stanislav Erokhin
b3be21146c
[NI] Add more hacks.
2017-08-07 17:59:56 +03:00
Stanislav Erokhin
0f0d834c23
[NI] Minor. Fix IOE.
2017-08-07 17:59:55 +03:00
Stanislav Erokhin
55181541af
[NI] Change lambda analysis -- create arguments for return statements.
2017-08-07 17:59:54 +03:00
Stanislav Erokhin
58f73bd82a
[NI] Use right DFI for arguments smart-casts.
2017-08-07 17:59:53 +03:00
Stanislav Erokhin
30f7396803
[NI] Substitute lambda return type with current substitutor
...
We should do this because return type even it still not proper
can contain fixed type variables
2017-08-07 17:59:52 +03:00
Stanislav Erokhin
89ac3bd5cf
[NI] Do not add useless constraints to constraint system
...
Skipped constraints:
- T <: Any, T >: Nothing
- T <: T, T <: T?, T >: T, T <: T!, T! <: T
2017-08-07 17:59:51 +03:00
Stanislav Erokhin
3a25405088
[NI] Remove type variables for lambda arguments -- use existing instead.
2017-08-07 17:59:50 +03:00
Stanislav Erokhin
ff6a28b64c
Add util method to BuildIns is kotlin.Function type.
2017-08-07 17:59:49 +03:00
Stanislav Erokhin
acc6e48172
[NI] Added isSuspend for lambdas.
2017-08-07 17:59:48 +03:00
Stanislav Erokhin
29e2a26ad6
[NI] Write fake ResolvedCall for callable reference.
2017-08-07 17:59:47 +03:00