Commit Graph

105 Commits

Author SHA1 Message Date
Jinseong Jeon 4cb32cd38a FIR2IR: add implicit NOT_NULL cast for @FlexibleNullability type 2020-11-18 13:06:48 +03:00
Mikhail Glukhikh f2f00a4654 Fix BB test to work on JDK 6 2020-11-11 12:00:18 +03:00
Mikhail Glukhikh bc47a30dd3 [FIR] Handle 'EnhancedNullability' more properly
This commit includes three changes:
1. 'EnhancedNullability' is no more set for declaration types
2. It is no more used for conversion types in translator
3. Translator inserts implicit not-null cast only when enhanced type is cast to not-null type.
2020-11-10 21:07:27 +03:00
Mikhail Glukhikh f8e03786c0 Mute not relevant JS/WASM back ends for new BB tests 2020-11-10 21:07:09 +03:00
Juan Chen 9486f58fb1 [FIR] fix subtyping for definitely notnull types.
The current implementation doesn't consider Foo a subtype of Captured<in
Foo>!!, since AbstractTypeCheckerContext::checkSubtypeForSpecialCases
does not handle DefinitelyNotNullType cases. This PR adds handling of
DefinitelyNotNullType by looking at its original type.

^KT-42824 Fixed
2020-11-10 21:07:09 +03:00
Juan Chen eb804709da [FIR] fix subtyping for nullable captured types.
The issue is the type checker doesn't consider P? a subtype of
CapturedType<in P>?, whereas P a subtype of CapturedType<in P>?. In
AbstractTypeCheckerContext::checkSubtypeForSpecialCases, it checks if
P? is a subtype of the lower type of the captured type, which is
P, and returns false.

This fix uses nullable version of the lower type when the captured
type is marked nullable. To check if P? is a subtype of Captured<in
P>?, we check the LHS, P?, against the nullable lower type of RHS,
P?.

^KT-42825 Fixed
2020-11-10 21:07:09 +03:00
Dmitry Petrov 785466acee Minor: add '// JVM_TARGET: 1.8' 2020-11-10 06:48:07 +03:00
Svyatoslav Kuzmich fdd7fa5aea [Wasm] Mute codegen box tests 2020-11-09 16:04:43 +03:00
Dmitry Petrov b9c6267a63 KT-43217 Encode @EnhancedNullability types in IdSignature 2020-11-09 15:20:46 +03:00
Steven Schäfer bd4e2a283c JVM IR: Don't generate null checks on value parameters of private operator functions
The null check on the extension receiver of private operator functions
is a special case and doesn't extend to value parameters.
2020-11-03 21:44:25 +01:00
Jinseong Jeon 46cc01602e FIR2IR: add implicit NOT_NULL cast if needed 2020-10-22 10:51:20 +03:00
Dmitry Petrov 0b34526321 JVM_IR remove lambda hack required for odd JVM+OI behavior in KT-35849 2020-10-21 13:47:01 +03:00
Dmitry Petrov 3979cde738 Add box and PSI2IR tests for special cases listed in KT-35849 2020-10-20 19:31:40 +03:00
Mikhail Glukhikh b64b32e06b FIR: keep captured types in substitution scope 2020-09-23 09:00:57 +03:00
Mikhail Glukhikh e1b4108e4a [FIR2IR] Mute some tests due to captured type problems 2020-09-14 18:08:30 +03:00
Steven Schäfer 44ffb1fb3e Psi2Ir: Fix SAM conversion with new inference 2020-09-08 11:14:14 +03:00
Mikhail Glukhikh a7da0d5080 [FIR] Approximate exotic return types for public declarations 2020-09-03 14:24:31 +03:00
Mikhail Glukhikh 23e83e8933 FirClassSubstitutionScope: don't recreate type parameters for unbound f/o 2020-09-03 14:24:30 +03:00
Mikhail Glukhikh 85c1505689 [FIR2IR] Copy type parameters for trivial fake overrides 2020-08-20 16:04:02 +03:00
Dmitriy Novozhilov 29849b1330 [FIR] Resolve rhs of += in dependent context 2020-07-08 12:13:31 +03:00
Dmitriy Novozhilov 624b9306f0 [FIR] Resolve LHS of type operator call in independent context
#KT-39046 Fixed
2020-07-02 15:10:51 +03:00
Mikhail Glukhikh c4d41f48a3 [IR] Allow Fir2Ir symbols in function factory 2020-06-29 16:08:12 +03:00
Mikhail Glukhikh d08f91bf35 [FIR2IR] Introduce & use lazy function for external class functions 2020-06-23 19:06:08 +03:00
Mikhail Zarechenskiy a067d138e9 Enable test for new inference after df1595e4
Follow up KT-37149
2020-06-18 12:41:27 +03:00
Georgy Bronnikov c015463926 IR: remove field fake overrides 2020-06-17 20:02:26 +03:00
Vitaly fe047f9b47 [JS BE] mutes tests for JS_IR_ES6, which muted for JS_IR 2020-05-27 00:32:56 +03:00
Mikhail Zarechenskiy 8bdc4d34f7 [NI] Commonize type-conversions (SAM/Suspend)
- Allow participating subtypes of functional types in conversions
 - Fix several subtle inconsistencies
 - Place logic about conversions at one place

 Now conversions operations have two stages: before usual subtyping
 check and after one. This is needed to support conversions of
 subtypes (of functional types, for example). First, the compiler
 checks if it possible to resolve an argument without conversion and
 only then it tries to perform conversion.
 Note that it'd be incorrect to perform conversion eagerly as it can
 change resolve (Runnable & () -> Unit <: KRunnable), plus we can't
 guess whether conversion is needed at all as it's important not to
 look into supertypes if resolution doesn't actually needed it

 #KT-36448 Fixed
 #KT-37574 Fixed
 #KT-38604 Fixed
2020-05-20 15:30:14 +03:00
Jinseong Jeon 615636ed55 FIR2IR: apply SAM conversion to arguments of functional type. 2020-05-15 15:08:43 +03:00
Mikhail Glukhikh cdac6157a9 [FIR2IR] Force loading Java SAM from external classes 2020-05-14 14:07:40 +03:00
pyos df4f1365ec PSI2IR: support SAM conversion to substituted types
i.e. in arguments to `f(T x)` where `T` is a type parameter bound to a
SAM type.
2020-04-29 18:50:40 +03:00
Mikhail Zarechenskiy fa50d66afe [NI] Fix SAM conversion for projected-out members
#KT-25290 Fixed
2020-04-29 14:15:25 +03:00
Mikhail Glukhikh a545ec41a0 FIR serializer: consider exotic types as errors (breaks 4 BB tests) 2020-04-28 07:35:09 +03:00
Jinseong Jeon ef09850df8 FIR2IR: set superQualifierSymbol for super call 2020-04-27 11:50:26 +03:00
Jinseong Jeon 57fe01c375 FIR2IR: populate overriddenSymbols for overriding functions
#KT-38416 Fixed
2020-04-27 11:50:24 +03:00
Georgy Bronnikov 41a28bde5c JVM_IR: repair synthetic accessors to fields 2020-04-16 15:08:11 +03:00
Steven Schäfer fc7d667282 Psi2Ir: Bind unbound type parameters 2020-04-15 15:32:53 +03:00
Jinseong Jeon c370b86141 IR: consolidate generation of synthetic members for data class 2020-04-13 17:30:05 +03:00
Georgy Bronnikov 9ccda31189 IR: deal with conflicting variances in computeSubstitutedSyntheticAccessor 2020-04-13 14:34:57 +03:00
Mikhail Glukhikh 3d17ce05b5 [FIR] Introduce FirResolvedArgumentList with argument-parameter mapping
#KT-36345 Fixed
2020-03-11 22:08:59 +03:00
Mikhail Glukhikh 2308e5bb7c FIR2IR: in case of use-site generic type use call from original class 2020-02-28 15:29:02 +03:00
Mikhail Glukhikh d1fac6dce1 FIR2IR: declare receivers for all accessors of extension properties
Before this commit, extension receivers were declared only for
properties with container source, which is strange & inconsistent.
Now we declare accessor extension receiver iff corresponding property
has extension receiver.
2020-02-25 12:13:42 +03:00
Mikhail Glukhikh 8c21f04bf4 FIR2IR: determine type parameters before value parameters
Type parameters can be referred from value parameters,
so we should determine them earlier to be able to set their indexes
2020-02-20 18:34:51 +03:00
Mikhail Zarechenskiy abc5eb4740 [NI-MIGRATE-BAD] Update problematic/questionable tests
These tests are going to be reviewed in more detail before 1.4
2020-02-13 11:15:59 +03:00
Mikhail Glukhikh f3f88cae7a FIR: unmute accidentally muted black-box test 2020-02-12 16:30:47 +03:00
Dmitriy Novozhilov 6735cc8937 [FIR] Implement new bound smartcast algorithm
#KT-36055 Fixed
2020-02-12 10:17:45 +03:00
Juan Chen 7249d2f889 [FIR] Fix translation of invokes & add return expressions for lambdas
* fixed NoSuchMethod caused by mismatched signatures of the "invoke" method generated for lambda arguments
* added test cases in invoke.kt for KFunction and anonymous functions
* added a transformer to wrap the last expression in the bodies of lambdas with return
2020-02-06 12:44:14 +03:00
Mikhail Glukhikh 71b0840ef9 [FIR] Implement super resolve as a particular tower resolver case 2020-02-05 11:19:19 +03:00
Steven Schäfer cf3e4608f3 JVM IR: Support -Xno-call-assertions 2020-01-30 14:43:23 +03:00
Steven Schäfer aea5e3ffbc JVM IR: Remove type substitutions from ExpressionCodegen
Instead, determine whether the return type of a call is Nothing, by
looking at the type of the call expression.
2020-01-22 15:51:11 +01:00
Alexander Udalov 3ca0f8a569 Fix incorrect message for new nullability assertion exception in 1.4
#KT-36026 Fixed
2020-01-22 14:41:20 +01:00