Commit Graph

4533 Commits

Author SHA1 Message Date
Mark Punzalan 79fef09bf5 [JVM IR] Add tests for KT-15971. 2020-03-11 14:33:31 +01:00
Mark Punzalan 2239b5ceab [JVM IR] Maintain KT-36188 bug compatibility between non-IR and IR
backends.
2020-03-11 14:33:31 +01:00
Mikhail Glukhikh 8231377f6b FIR2IR: convert qualifiers inside getClass properly 2020-03-11 16:01:57 +03:00
Mikhail Glukhikh 1812b490a1 FIR: set anonymous object constructor return type properly 2020-03-11 16:01:57 +03:00
Zalim Bashorov c8efe8c4ec Add tests for equals, hashCode, toString in String and Number 2020-03-11 12:54:42 +03:00
Dmitry Petrov 90d012cecb Handle unbound extension receiver in callable reference adaptation 2020-03-10 16:56:48 +03:00
Dmitry Petrov e175ff0d73 KT-36953 break/continue/return/throw have kotlinType Nothing 2020-03-10 16:56:48 +03:00
Mikhail Glukhikh 603685b5a4 Mute FIR2IR test (pushed as unmuted accidentally?) 2020-03-10 15:19:35 +03:00
Mikhail Glukhikh ed6c9e67a1 FIR2IR: convert qualifiers to companion objects, if any 2020-03-10 15:19:34 +03:00
Alexander Udalov 676ffff015 Minor, fix builtinFunctionReferenceOwner.kt for android-tests
In codegen tests on Android, everything is being run with kotlin-reflect
in the classpath. So a package is no longer represented by a
reflect-less PackageReference, but by a full-blown KPackageImpl. Use a
less specific supertype ClassBasedDeclarationContainer instead, the one
which is a supertype of both PackageReference and KPackageImpl, and
which still allows to get the underlying jClass.
2020-03-10 12:59:54 +01:00
Alexander Udalov d668808b44 Migrate Experimental->RequiresOptIn in project sources 2020-03-10 12:07:15 +01:00
Alexander Udalov 795d6ab407 Migrate UseExperimental->OptIn in project sources 2020-03-10 12:07:14 +01:00
Roman Artemev 7430bfe518 [KLIB] Update test data
- mute temporary broken test
 - add regression test
2020-03-10 11:12:08 +03:00
pyos 735fae0e5a JVM_IR: apply TailCallOptimizationLowering to all suspend functions
Even if a function is known to be tail call because it's a compiler
generated bridge, the tail return might still need to be added in case
of Unit return type.
2020-03-09 19:21:32 +01:00
pyos dc388f3f3a JVM_IR: add a test for suspend inline fun with defaults in a class
This is one example of a function replaced by a lowering after
AddContinuationLowering mentioned in the last commit: the lowering that
makes default stubs static is further down. Although this is not a
lambda, calling getOrCreateSuspendFunctionViewIfNeeded on it in the
inliner is fatal all the same.
2020-03-09 17:05:42 +01:00
Mark Punzalan 368b0d9b0b [JVM IR] Use reference equality when comparing enums. 2020-03-06 23:01:32 +01:00
Mark Punzalan a732e8f5fe [JVM IR] Ensure there is one accessor for each super access from a
subclass when there are multiple subclasses in a file.
2020-03-06 22:59:52 +01:00
Steven Schäfer 34fb636904 JVM: Generate generic signatures for delegate fields 2020-03-06 21:51:30 +01:00
pyos 20ea77d55d JVM_IR: refactor ToArrayLowering and make matching more precise
* If `toArray` is inherited from Java, it may take an argument or
    return a value of a flexible type, which looks nullable in IR;
  * The returned array may also have `out` variance of the type
    argument;
  * `Array<T>` is not the same as `Array<Any?>` if `T` is neither `Any`
    nor `in Something`, so presence of `toArray(): Array<T>` does not
    mean we don't need to generate a new `toArray`.
2020-03-06 18:33:25 +01:00
Alexander Udalov 98aecbef6b Optimize runtime representation for callable reference subclasses
Instead of generating overrides for getOwner/getName/getSignature in
each anonymous class representing a callable reference, pass them to the
superclass' constructor and store as fields. This occupies some small
memory but helps to reduce the size of the generated class files, and
will be helpful for adding further runtime information to callable
references, such as information about implicit conversions this
reference has been subject to.

Represent owner as java.lang.Class + boolean instead of
KDeclarationContainer, so that the unnecessary wrapping Class->KClass
wouldn't happen before it's needed, and also to make sure all callable
references remain serializable.

Note that the argument type where the "is declaration container a class"
is passed is int instead of boolean. The plan is to pass the
aforementioned implicit conversion information as bits of this same
integer value.

 #KT-27362 Fixed
2020-03-06 16:55:07 +01:00
Alexander Udalov 8d7c8672ac Generate reference to existing class for builtin function references
Instead of non-existing `kotlin.KotlinPackage`, which led to
NoClassDefFoundError as soon as reflection tried to call getOwner on a
builtin callable reference, use a reference to a new physical class
`kotlin.jvm.internal.Intrinsics$Kotlin`. This will allow to support
KT-17151.

Note that for API version less than 1.4, this will still lead to
NoClassDefFoundError, but this is not worse than the current situation
where it happens anyway.
2020-03-06 16:55:05 +01:00
Dmitriy Novozhilov 1c0fd7342f [FIR] Support completion of lambdas with type variable as expected type
#KT-37310 Fixed
#KT-37304 Fixed
2020-03-06 18:10:52 +03:00
pyos 037b442e86 JVM_IR: do not explicitly initialize Refs to default values 2020-03-06 17:58:36 +03:00
pyos 13b04e63be JVM_IR: wrap inline class objects in unboxed refs 2020-03-06 17:58:36 +03:00
pyos 8487211ae1 JVM_IR: refine the condition for mangling names of multifile members
Private $$forInline versions of public suspend functions should not
be mangled. (Note that there are no $$forInline versions of private
suspend functions, as those are effectively inline-only.)
2020-03-06 14:33:50 +01:00
Igor Chevdar 93394656a3 [IR] Supported fake overrides in SAM lowering + enabled test 2020-03-06 12:47:00 +03:00
Dmitriy Novozhilov af67aff303 [FIR] Support Clonable
#KT-36762 Fixed
2020-03-06 10:44:14 +03:00
Steven Schäfer bb5a639153 JVM IR: Turn static callable references into singletons 2020-03-05 22:19:53 +03:00
Pavel Kirpichenkov ac5c255c20 [NI-TESTS] Add regression tests
^KT-33638 Obsolete

Add test for case mentioned in KT-33629.
Used to be runtime failure instead of error diagnostic.
2020-03-05 20:20:47 +03:00
Dmitriy Novozhilov 3742586209 [FIR-TEST] Unmute some blackbox tests 2020-03-05 16:48:48 +03:00
Dmitriy Novozhilov e3e7b40f85 [FIR] Fix determining coercion to Unit 2020-03-05 16:48:48 +03:00
Dmitriy Novozhilov 770dfb69ba [FIR] Analyze all statements in block except last one in independent mode
Some broken tests will be fixed in next commit
#KT-37176 Fixed
2020-03-05 16:48:47 +03:00
Alexander Udalov 0f7122a88a Support MutablePropertyReferenceN supertypes in LambdaInfo
#KT-37087 Fixed
2020-03-05 14:01:30 +01:00
Ilmir Usmanov 354fb3c4ba JVM_IR: Generate fake continuations and their constructors as public
#KT-37093 Fixed
2020-03-04 21:32:35 +01:00
Ilmir Usmanov c94f8d3767 JVM_IR: Do not generate nullability annotation for synthetic result field
of continuation class.
 #KT-37084 Fixed
2020-03-04 21:32:34 +01:00
Ilmir Usmanov 4b4a6101c1 JVM_IR: Generate inline functions with reified generics as public synthetic
Otherwise, proguard will remove them.
 #KT-37004 Fixed
2020-03-04 21:32:31 +01:00
Ilmir Usmanov f8903ca04b JVM_IR: Generate private suspend functions as synthetic package-private
Do not generate accessors for them.
 #KT-37086 Fixed
2020-03-04 21:32:29 +01:00
Ilmir Usmanov 5826db97c7 JVM_IR: Do not duplicate inline suspend functions with reified type parameters
They are inline-only.
Generate $$forInline versions of inline suspend functions as private.
This way, there is no nullability annotation on there parameters and return
values. Unfortunately, old BE does generate them.
 #KT-37088 Fixed
2020-03-04 21:32:27 +01:00
Dmitry Petrov 3bf2c17f9e KT-37024 Optimized delegated property metadata generation in inline fun 2020-03-04 18:48:03 +03:00
Mikhail Glukhikh 0fee8a6946 FIR2IR: cache functions and their parents properly 2020-03-04 16:55:33 +03:00
Mikhail Glukhikh 940567b8bd FIR2IR: set enum class modality properly for complex entries case 2020-03-04 16:55:33 +03:00
Mikhail Glukhikh 50c4c3f4fb FIR2IR: extract fake override generator 2020-03-04 16:55:32 +03:00
Mikhail Glukhikh 0bb3a42ceb FIR2IR: mute black box test due to parent logic problems 2020-03-04 16:55:32 +03:00
Mikhail Glukhikh cfa626ad77 FIR2IR: introduce conversion scope, remove dispatch receiver for lambdas 2020-03-04 16:55:31 +03:00
Mikhael Bogdanov f84ac5e3f9 Remove configuration kind from AbstractDumpDeclarationsTest tests 2020-03-04 14:51:18 +01:00
Georgy Bronnikov 8b559b20e2 Add a test for getOrDefault() bridge 2020-03-04 16:02:54 +03:00
Georgy Bronnikov 394c660a82 Mute a FIR test 2020-03-04 01:34:17 +03:00
Dmitry Petrov f678db2f89 KT-36813 Generate optimizable null checks in JVM_IR 2020-03-03 22:38:21 +03:00
Georgy Bronnikov 0c266f9f45 Add hashtable test 2020-03-03 20:01:27 +03:00
Roman Artemev adc022fde8 Fix some coroutine tests 2020-03-03 18:54:36 +03:00