Commit Graph

387 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 65ea4e184a [FIR] Fix enhancement of FlexibleNullability and EnhancedNullability
- Add utilities to add new attribute to ConeAttributes
- Get rid of FlexibleNullability attribute (it can be easily inferred
    for any flexible type at any moment)
- Fix determining of EnhancedNullability attribute
2021-03-11 13:10:04 +03:00
Dmitry Petrov 0cca07fa19 Bump d8 used in box tests to 2.1.75 2021-03-10 21:04:12 +03:00
Alexander Udalov 6ddca4a592 Add KClass.isValue to kotlin-reflect
#KT-44782 Fixed
2021-03-08 21:22:40 +01:00
Alexander Udalov e6476c39ca JVM IR: fix isMarkedNullable for nullability-flexible types
Since nullability-flexible types in IR are represented by an annotation
on an IrSimpleType, not a special instance, the common implementation of
`KotlinTypeMarker.isMarkedNullable` in `TypeSystemContext` doesn't work.

This method is used for example to generate `typeOf` in JVM IR, in
`TypeSystemCommonBackendContext.generateTypeOf`, and this issue led to a
difference in behavior of `typeOf` for nullability-flexible types.

 #KT-44726 Fixed
2021-02-22 12:52:48 +01:00
Dmitriy Novozhilov 7b7b8fbea7 [Test] Filter dependent modules by source kind in creating FirModuleInfo 2021-02-18 14:44:44 +03:00
Alexander Udalov 4d9cffccf2 Support structural equals/hashCode for type constructors of type parameters
Use the same logic as for type constructors of classes, based on the
fully-qualified name of the classifier, with special cases for error
types and local declarations, with an additional check that the type
constructors' declaration descriptors are structurally equal via
`DescriptorEquivalenceForOverrides`. The latter is required because type
parameters of overloaded functions must be different, even though their
full FQ name is the same.

This (hopefully) has no effect for the compiler, but is useful for
kotlin-reflect where `KType.equals` runs the type checker on the
underlying `KotlinType` instances, which eventually ends up comparing
type constructors. Descriptors and types in kotlin-reflect are cached on
soft references, so they may be suddenly garbage-collected and
recomputed, and we want copies of the same type parameter to be equal to
each other.

This fixes flaky codegen tests which started to fail after migration to
the new test infrastructure, where tests are now run in parallel in the
same process, thus with higher memory pressure and more soft references
being GC'd:

* `codegen/box/reflection/types/createType/typeParameter.kt`
* `codegen/box/reflection/supertypes/genericSubstitution.kt`

Also, add a new test to check that we do the instanceof check in
overrides of `AbstractTypeConstructor.isSameClassifier`.

 #KT-44850 Fixed
2021-02-17 14:41:07 +01:00
Ilmir Usmanov bad197e075 Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error 2021-02-16 20:59:21 +01:00
Mikhail Glukhikh 8bab208322 FIR2IR: use information about callable reference adaptation from resolve 2021-02-15 17:08:08 +03:00
Dmitry Petrov 3ebeca5852 JVM_IR: use indy SAM conversions in jvmTarget 1.8+, fix bridges
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:30 +03:00
Alexander Udalov 401f0ac583 Use TARGET_BACKEND instead of DONT_TARGET_EXACT_BACKEND in box against Java tests
"// TARGET_BACKEND: JVM" more clearly says that the test is
JVM-specific, rather than DONT_TARGET_EXACT_BACKEND which excludes all
other backends.
2021-02-11 13:50:08 +01:00
Mikhael Bogdanov 3dff225b98 Aligh test data with JDK 15 reflection output 2021-02-09 12:34:55 +01:00
Dmitriy Novozhilov 29b96aa15d [Test] Properly merge box against java testdata into codegen/box
Previous commit about it was 3199ce03 and it was completely wrong
2021-02-04 10:53:50 +03:00
Mikhael Bogdanov 1ea4fa4464 Fix android test with type annotations. Remove obsolete JVM 8 flavors
Remove some new test cause their originals would be executed on JvmTarget6OnJvm8
2021-02-02 14:32:50 +01:00
Alexander Udalov 8172ae5d89 Fix codegen test classLiteralWithExpectedType.kt on Android
Similar to changes in d022bb0248, this test started to fail because
`AnnotationTarget.TYPE` is mapped to `ElementType.TYPE_USE` if JVM
target is >= 1.8. In codegen tests on Android, we're running the
emulator of version 19 which is less than 26, where `TYPE_USE` has first
appeared.
2021-02-01 15:54:01 +01:00
Alexander Udalov d022bb0248 Switch default JVM target to 1.8
#KT-29405 Fixed
2021-02-01 11:54:04 +01:00
Dmitriy Novozhilov af5a635f85 [Test] Ignore error diagnostics from FIR in some BB tests 2021-01-12 18:35:39 +03:00
pyos 41f56729f9 FIR: serialize correct fqnames for local classes 2020-12-10 20:52:48 +03:00
pyos 12f936f6b7 FIR2IR: do not approximate reified type arguments to super class 2020-12-10 20:52:46 +03:00
Ilmir Usmanov 0d55c9108d IC: Forbid inner classes inside inline classes
#KT-43067 Fixed
2020-12-04 05:45:53 +01:00
Mikhail Glukhikh 0a0b5b5d2b [FIR DFA] Don't consider anonymous object as stable initializer to bind
#KT-43332 Fixed
2020-11-26 16:29:06 +03:00
Svyatoslav Kuzmich f9503efb74 [JS IR] Make WITH_RUNTIME imply KJS_WITH_FULL_RUNTIME
There is a lot of intersection between these
2020-11-25 21:22:39 +03:00
Alexander Udalov f2b8c67962 Fix JvmTarget6OnJvm11 tests after 7b5544ebd3 2020-11-19 18:49:55 +01:00
Ilmir Usmanov 89d45bf909 IC mangling: Use old mangling scheme in FIR tests
instead of ignoring them.
This affects all unsigned tests.
2020-11-19 17:39:31 +01:00
Ilmir Usmanov f7164404c9 IC mangling: Ignore FIR tests 2020-11-19 17:39:26 +01:00
Mikhail Glukhikh fb961f7070 [FIR] Copy also synthetic setter during fake override generation 2020-11-12 13:37:37 +03:00
Alexander Udalov dd33ed9297 Fix suspend function with inline class types in reflection
#KT-34024 Fixed
2020-11-02 19:33:23 +01:00
Denis Zharkov 2bdb21793f FIR: Adjust test data 2020-10-28 11:43:25 +03:00
Mikhail Glukhikh 5c3269f489 [FIR] JvmMappedScope: don't add Java methods if Kotlin ones are here 2020-10-27 10:26:55 +03:00
Mikhail Glukhikh caafe21e84 [FIR] Add CheckLowPriorityStage to callable reference resolve 2020-10-26 20:07:37 +03:00
Igor Chevdar 9b2aa0951b [box-tests] Turned on tests on typeof for K/N 2020-10-23 18:27:10 +05:00
Mikhail Glukhikh c50aa5f2ec [FIR TEST] Bad test data changes due to Java signature transformation
Both changes are related to getOrDefault. We should either make Java
version low priority or remove it at all.
2020-10-23 08:12:16 +03:00
Mikhail Glukhikh 23e7468e57 [FIR2IR] Cache Java field-based properties more correctly #KT-42805 Fixed
Before this commit, we cached such IR properties by FIR property
which was created by Java field each time when we referenced it.
This led to signature clashes. Now we cache such IR properties
directly by associated FIR field.
2020-10-22 13:05:00 +03:00
Roman Artemev d7db643422 Add box test for KT-33992 2020-10-16 16:02:02 +03:00
Jinseong Jeon 5f64d6ec76 FIR2IR: add support for callable reference to Java field
#KT-42656 Fixed
2020-10-15 08:47:46 +03:00
pyos 1663619606 JVM_IR: add local delegated property metadata to non-synthetic classes
Otherwise kotlin-reflect won't find it (and it won't even be serialized
anyway).

 #KT-42562 Fixed
2020-10-12 21:14:00 +02:00
pyos e6c0575d3a JVM_IR: do not deep-copy suspend lambdas in initializers
This loses reflection metadata (and also sometimes fails). Which was
missing anyway - this is also fixed now.

 #KT-42554 Fixed
2020-10-09 22:11:00 +02:00
Pavel Punegov 260f66183c Don't ignore the test on JS backend as it doesn't fail any more. 2020-10-07 12:22:49 +03:00
Pavel Punegov 33d28b44fa Unmute typeOf tests in Native backend 2020-10-07 12:18:09 +03:00
Denis Zharkov 3dfbd36f15 FIR: Unmute passing blackbox tests 2020-10-01 17:49:02 +03:00
Jinseong Jeon 3151fc8577 FIR2IR: set dispatch receiver for companion member reference
#KT-42132 fixed
2020-09-29 11:51:21 +03:00
Dmitriy Novozhilov 40a9bb6eac [FIR] Assume nullable types as good types for ILT approximation
#KT-41982 Fixed
2020-09-23 14:05:10 +03:00
pyos 6e143a2656 JVM_IR: collect free type parameters when serializing FIR metadata
The "free" in "createFreeFakeLambdaDescriptor" and such refers to the
fact that there are no references to type parameters from outside the
current declaration. This is necessary because at the point where the
metadata is written, the type parameters may not even be in scope (e.g.
local delegated properties are serialized at class level, but may refer
to function-scope type parameters).
2020-09-22 09:35:50 +03:00
pyos aa58ed9234 JVM_IR: partially implement FIR local delegated property reflection
Type parameter references are broken, just like for lambdas. Also, the
code is super ugly.
2020-09-22 09:35:45 +03:00
Mikhail Glukhikh 4605a65f41 [FIR] Good test data fixes (around captured types) 2020-09-14 17:56:39 +03:00
Alexander Udalov 3d7619421f JVM IR: fix exception on star projection in type parameter upper bound
#KT-41761 Fixed
2020-09-09 17:07:52 +02:00
Alexander Udalov 5aca8ebda8 Minor, add test case on metadata of lambdas in constructors
KT-41465
2020-09-02 20:04:05 +02:00
Dmitriy Novozhilov b63257345b [FIR] Map Class to KClass in java annotations 2020-08-04 08:59:15 +03:00
Jinseong Jeon bff36e0199 FIR2IR: convert annotations on FirTypeRef 2020-07-30 11:25:36 +03:00
Zalim Bashorov 635869f15a Rewrite className helper to fix tests on android
Since android tests preprocess test data and
(at least) replace package for files and fix package usages
it's preferred to use fqnames explicitly
instead of assembly them from parts, as it was before.
2020-07-25 15:28:36 +03:00
Dmitriy Novozhilov 1ce4eca3a6 [FIR] Infer type arguments for captured parameters of inner classes
KT-38992
2020-07-20 14:38:16 +03:00