Commit Graph

9551 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy 6eefea6715 Add tests for obsolete issues
#KT-32395 Obsolete (fixed in 42a5c488)
 #KT-32388 Obsolete (fixed in f3e4c9cd)
 #KT-32271 Obsolete (fixed in 60a0cf1)
2019-07-06 10:06:04 +03:00
Svyatoslav Kuzmich 918d470e1b [JS IR BE] Simplify throwable lowering.
- Make kotlin.Throwable class extenral
- Add runtime function 'extendThrowable' to use instead of delegating
  constructors to Throwable
2019-07-03 20:37:48 +03:00
Steven Schäfer e7a5e5b4a0 JVM_IR: Handle annotation KClass fields in external declarations 2019-07-01 16:16:23 +02:00
Steven Schäfer 078ccbf077 JVM_IR: Implement name mangling exceptions for Result class. 2019-07-01 15:49:12 +02:00
Steven Schäfer d458e4a7b2 JVM_IR: Enable inlining for external declarations with inline class parameters. 2019-07-01 15:49:12 +02:00
Mark Punzalan 1abdf0561a Generate synthetic functions for local functions with default values, by
re-ordering the lowering phases.

The changes in InterfaceLowering are necessary so that IrElements that
target the removed functions are re-targeted to the new functions in
DefaultImpls. This affects local functions in interface functions since
now LocalDeclarationsLowering comes before InterfaceLowering.
2019-07-01 13:24:08 +02:00
Mikhail Zarechenskiy 515e666733 [NI] Fix exception on incomplete try/catch block
There was an inconsistency on creating PSI call and corresponding
 descriptor. See variable `catchBlocks` from visitor, it's created
 only if PSI elements are not null, but for descriptor parameters
 there wasn't such check

 #KT-32134 Fixed
 #EA-139748 Fixed
2019-07-01 12:59:37 +03:00
Mikhail Zarechenskiy 42a5c488c1 [NI] Fix OnlyInputTypes annotation support for top-level captured types
#KT-32157 Fixed
 #KT-32116 Fixed
 #KT-32235 Fixed
 #KT-32218 Fixed
2019-07-01 12:59:35 +03:00
Mikhail Zarechenskiy c2cf4aa2b5 [NI] Move ability to convert standalone SAM-argument under the feature
If new inference is enabled only for IDE analysis, then this feature
 will be disabled to reduce difference between new and old inference,
 but if new inference is enabled in the compiler, then this feature
 will be enabled too to preserve behavior of new inference for
 compilation

 #KT-32175 Fixed
 #KT-32143 Fixed
 #KT-32123 Fixed
 #KT-32230 Fixed
2019-07-01 12:53:33 +03:00
Georgy Bronnikov f332aff4ce Mute back tests that still fail 2019-06-28 19:44:04 +03:00
Georgy Bronnikov 3a9b94235f JVM_IR: generate facade classes for imported toplevel declarations 2019-06-28 17:34:49 +03:00
Anton Bannykh fadeac083f JS: fix reified T::class for primitive T (e.g. Int) (KT-32215 fixed) 2019-06-28 13:49:22 +03:00
Igor Chevdar e8ac22e238 Fixed some IR tests on enums 2019-06-27 19:04:01 +03:00
Igor Yakovlev 8b40005b0c UL classes flaky tests partially fix
#KT-32276 - Reduce affected tests count from 117 cases to 2 cases
2019-06-27 12:46:02 +03:00
Mikhael Bogdanov 9b6fef005f Simplify LocalDeclarationsLowering, support declaration pop up via separate lower
1. Scheme of capturing local variables not touched
 2. Lowered local functions are transposed to the nearest class (including local) or file
 3. Local classes are also transpose to the nearest class (including local) or file
2019-06-27 08:07:01 +02:00
Ilmir Usmanov 7a096b305f Do not mangle functions with inline classes when the only inline class
in arguments is kotlin.Result.
Fix returnTarget for suspend function views.
2019-06-26 22:28:08 +03:00
Dmitry Petrov b3b7e26985 Make InsertImplicitCasts work with Descriptors and KotlinTypes again
This is a temporary change to make sure IrType infrastructure work is in
master.

It causes some of irText tests to work incorrectly (as in master).
2019-06-26 10:07:13 +03:00
Dmitry Petrov 8da5f6b955 IR: fixes after rebase 2019-06-26 09:39:17 +03:00
Dmitry Petrov 339291b01f psi2ir: update testData 2019-06-26 09:39:16 +03:00
Dmitry Petrov 760806a1ac IR: IMPLICIT_DYNAMIC_CAST
Generate IMPLICIT_DYNAMIC_CAST for implicit casts from `dynamic` to `T`
2019-06-26 09:39:16 +03:00
Dmitry Petrov 1d9cb39915 psi2ir: fix nullability assertion generation for platform types
Incorporate PR from Steven Schäfer into IrType-based implicit cast
insertion (commit 17b925636e8717e7648c5d7b792c6ab4d18f776d).

NB this still uses originalKotlinType to determine if the type was
nullability flexible. It is somewhat error-prone and something we want
to get rid of. However, it boils down to some design questions related
to implicit null checks in Kotlin - e.g., it might be Ok to just treat
nullability flexible type `T!` as `T?` in IR, generate null checks for
all usages of type `T?` where a non-null type is expected, and later
eliminate the null checks that are redundant according to the (quite
conservative) criterion in the redundant null check elimination.
2019-06-26 09:39:16 +03:00
Dmitry Petrov ab38430ded psi2ir: irText/.../types: NI vs OI 2019-06-26 09:39:15 +03:00
Dmitry Petrov 38ad56fb78 psi2ir: Update testData for intersection type tests
Actually, IrType-based InsertImplicitCasts provides proper casts here.
2019-06-26 09:39:15 +03:00
Mikhail Zarechenskiy c77f18fbe6 [NI] Support callable references on qualified types with generics
#KT-32154 Fixed
2019-06-26 00:23:12 +03:00
Pavel Punegov e9aec54f59 Ignore test in native because it doesn't support 40 parameters 2019-06-25 19:12:41 +03:00
Ilmir Usmanov c613e04962 Do not try to create view of suspend function descriptor on IR BE
Keep container source in wrapped descriptor
2019-06-25 16:30:02 +03:00
Ilmir Usmanov 60cbf0696d Do not generate tests with experimental coroutines on JVM_IR backend
Enable working tests.
2019-06-25 16:30:01 +03:00
Ilmir Usmanov 379390c472 Introduce add continuation pass, which transforms each suspend function
and call to have additional continuation parameter.
2019-06-25 16:30:00 +03:00
Mikhail Zarechenskiy 60a0cf1fcc [NI] Fix exception: don't try to compute type depth on null type
#KT-32184 Fixed
2019-06-25 14:09:42 +03:00
Mikhail Zarechenskiy a26cf86af7 [NI] Fix exception: callable reference is used with an unresolved LHS
#KT-32187 Fixed
2019-06-25 14:09:38 +03:00
Mikhail Zarechenskiy bc0773b219 [NI] Capture receiver of invoke-based call
#KT-32133 Fixed
2019-06-25 14:09:34 +03:00
pyos 54d1df3147 JVM_IR: fix unbound function references 2019-06-25 12:29:23 +02:00
Mikhail Glukhikh d41c50d6cf FIR: support type inference for assignments, fix related lambda inference 2019-06-24 18:51:03 +03:00
pyos 6a21285aed JVM_IR: do not generate two nullary constructors
when the primary constructor with @JvmOverloads has default values for
all arguments.
2019-06-24 14:58:45 +02:00
Svyatoslav Kuzmich 0b19a4a32b [JS IR BE] Initial version of member namer 2019-06-21 17:02:01 +03:00
Dmitry Petrov 79d4b46d2b KT-32044 Fix unsigned integer coercion in loop intrinsics 2019-06-21 16:30:23 +03:00
victor.petukhov bfeb9537ee Exclude functional types for the warning reporting about implicitly inferred a type parameter to Nothing 2019-06-21 15:52:01 +03:00
Mikhail Zarechenskiy fe0282809e [NI] Skip fake call for descriptor from object in builder-inference
This call have interesting rules for resolution, see
 `KtQualifiedExpression.elementChain` function and it's usages:
 resolution results for such call can be omitted and be replaced with
 some other information, while diagnostics will be reported from
 builder-inference.

 To mitigate this problem, we'll just skip this call from builder-inference
 as such calls can't have type parameters anyway

 #KT-32094 Fixed
2019-06-21 11:56:09 +03:00
Mikhail Zarechenskiy bebdf6fcef [NI] Added test for KT-32094 2019-06-21 11:52:44 +03:00
Mikhail Zarechenskiy f3e4c9cdb3 [NI] Don't avoid Nothing-like constraints if Nothing was in initial type
#KT-32081 Fixed
 #KT-32951 Fixed
2019-06-21 11:52:39 +03:00
pyos 8cca74c932 JVM_IR: support vararg & defaults in function references 2019-06-20 22:37:56 +03:00
Mikhail Glukhikh c8003518a5 FIR: set super type reference properly 2019-06-20 15:26:40 +03:00
Mikhail Glukhikh ca401cb01d FIR2IR: support backing field symbols from FIR, fix test data 2019-06-20 15:26:40 +03:00
Mikhail Glukhikh 54078c4e9c FIR resolve: support inferring property type from getter 2019-06-20 15:26:39 +03:00
Roman Artemev 88e92be091 [IR] Fix name clash between properties with the same fqn
Promote ABI version
2019-06-20 12:08:55 +03:00
Mikhail Glukhikh b7da2f2ad8 FIR resolve: check early receivers on kotlin.* only
To provide more stable behaviour, the check introduced in the previous
commit is now applied only to extensions from kotlin.* package.
2019-06-19 22:48:52 +03:00
Mikhail Zarechenskiy 796cdea50e [NI] Require all proper constraints for Exact return type
Consider call `foo(bar())` where bar() returns some type variable `T`;
 We had a contract that call `bar` can be completed without completion
 of foo (type variables can be inferred from the current context) if `T`
 has at least one proper lower constraint (ProperType <: T).
 Indeed, new constraints can be added only as upper ones, so there is
 no need to grow constraint system.

 Unfortunately, we have Exact annotation that is used on return type of
 elvis. Now, consider the following situation:
 ```
 fun foo(a: Any) {}
 fun bar(e: T): @Exact T

 foo(bar("str"))
 ```

 Here, because of Exact annotation, constraint with `Any`-type will be
 added as an equal one => our prerequisite that there will be no new
 lower constraints is false. `bar("str")` is inferred to Any in OI,
 this seems conceptually wrong, but it's another topic of discussion.

 In NI we can't just grow constraint system to use outer call because
 of another important use-case:
 ```
 fun <T> generic(i: Inv<T>) {}

 fun test(a: Inv<*>?, b: Inv<*>) {
     generic(a ?: b)
 }
 ```

 Common constraint system for these two calls can't be solved
 (fundamentally) for this example, only if (a ?: b) and generic(result)
 are computed separately.

 So, to mitigate initial issue, we'll grow constraint system only if
 there is at least one non-proper constraint.

 #KT-31969 Fixed
2019-06-19 11:07:31 +03:00
Mikhail Zarechenskiy ca997de6a7 [NI] Test data to understand changes in the next commit
##KT-31969 In Progress
2019-06-19 10:47:05 +03:00
Roman Artemev 50ad21e388 [IR BE] Fix symbol remapping for IrField/IrProperty
- Use appropriate wrapped descriptor
 - Add test
2019-06-19 10:24:15 +03:00
Mikhail Zarechenskiy 5cf7c7e5bf [NI] Fix composite substitution for stubbed type in builder-inference
#KT-32038 Fixed
2019-06-18 19:38:04 +03:00