Commit Graph

15942 Commits

Author SHA1 Message Date
Alexander Udalov 13ca189825 Support -Xjdk-release=8 as alias for -Xjdk-release=1.8
#KT-53278 Fixed
2022-09-01 12:15:47 +02:00
Alexander Udalov 19bbcc5869 Do not generate metadata for callable reference classes
After an accidental change in 846537b367, we started generating metadata
into anonymous classes for callable references. This metadata contained
the Kotlin representation of the referenced function. In KT-53794, this
led to a problem where Java's protected visibility could not be
represented in Kotlin terms, which crashed the backend.

But also, this metadata is useless because there's no real use case for
interpreting it (since you already have a function reference object at
runtime with all the needed information), so it would take some extra
space in the bytecode.

 #KT-53794 Fixed
2022-09-01 12:15:25 +02:00
Alexander Udalov a76de14026 Remove obsolete compiler argument -Xsingle-module
#KT-51622
2022-08-31 20:54:50 +02:00
Alexander Udalov abaffeddab Remove LocalClassProtoTestGenerated, replace with kotlinp tests
This test uses a hacky mode of the compiler which is not worth it to
support further (especially in K2), `USE_SINGLE_MODULE`, where
everything is compiled in one module. The purpose of the test is just to
check that metadata for local/anonymous classes is written correctly.
So we can replace it with the tests on kotlinp, which uses
kotlinx-metadata-jvm and dumps all loaded metadata to text.

This replacement is not perfect, in particular because it won't check
that the reflection machinery is able to load this metadata, and because
it won't check that annotations are loaded correctly from the bytecode.
But IMHO it's good enough, there are box tests on reflection on local
classes (e.g. `reflection/annotations/localClassLiteral.kt`), so this
way is better than having to support the weird compiler mode for just
one test.
2022-08-31 20:54:50 +02:00
Denis.Zharkov 490382b77f Add test for KT-52782
It just demonstrates/fixate the current "broken" behavior in K1
that we unfortunately have and that is fixed in K2
2022-08-31 09:45:54 +00:00
Denis.Zharkov db1bd4f232 Add test for KT-53124
The issue itself is supposed to be fixed after eb19d39cbf reverted

^KT-53124 Fixed
2022-08-30 15:56:31 +00:00
Denis.Zharkov 42c41a1916 Revert "[FE 1.0] Build captured type's supertypes in an alternative way: use own projection type as a first supertype, then supertypes from the corresponding type parameter's upper bounds"
This reverts commit eb19d39cbf.
2022-08-30 15:56:30 +00:00
Sergej Jaskiewicz 17f22c7204 [JS IR] Use a special executor for stepping tests
This will hopefully fix flakiness for some tests
2022-08-30 13:38:47 +00:00
Denis.Zharkov f4a3ab877f Add test for parsing issue KT-53719
^KT-53719 Related
2022-08-30 11:21:51 +00:00
Denis.Zharkov 3d7969ec8f Revert "KT-35811: Type parameter angle brackets followed by equal sign are parsed incorrectly if whitespace is missing"
This reverts commit 2053363def.

^KT-35811 Open
2022-08-30 11:21:50 +00:00
Denis.Zharkov 211d662708 Revert "KT-8263: Conditional operators are not parsed correctly"
This reverts commit ec8da2033c.

For the reason for the revert see KT-53719

^KT-8263 Open
^KT-53719 Fixed
2022-08-30 11:21:50 +00:00
Simon Ogorodnik 154e53c701 K1: add diagnostic BUILDER_INFERENCE_STUB_RECEIVER
It's reported on receivers in extension function calls with stub type,
as such calls can shadow members of finalized stub types causing
change of resolve when corresponding type argument specified explicitly

It works by checking extension receiver during call resolution parts run
That way we can easily detect if we found an extension applicable to
stub receiver and report call diagnostic for it

KT-53739
2022-08-30 10:19:26 +00:00
Simon Ogorodnik 105358dcf6 K1: add diagnostic BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION
Let's call builder lambdas (BL) a lambda that has non-fixed input type
projection at the moment of lambda arguments analysis, such lambdas
is a subject to be analyzed with builder inference
Due to bug in constraint system joining algorithm, currently system
of two or more such lambdas may lead to unsound type inference

Diagnostic added here should be reported in case when there are two
BL that shares a common constraint system, while not annotated with
@BuilderInference, as a protection against aforementioned bug

It's reported by ConstraintSystemCompleter when such situation has
occurred during builder inference phase, it is the same place that
decides wherever lambdas is subject to builder inference or not

KT-53740
2022-08-30 10:19:25 +00:00
Simon Ogorodnik 4227fd012f Fix test for two builder inference lambdas 2022-08-30 10:19:24 +00:00
Mikhail Glukhikh f6ad6fb816 Add test for stub type receiver and for KT-53639 2022-08-30 10:19:24 +00:00
Mikhail Glukhikh 5cbecd276c FE: add test reproducing builder inference problem from KT-53422 2022-08-30 10:19:23 +00:00
Dmitriy Dolovov 444cdaa2d8 [Native][tests] Re-enable internalFromFriendModule codegen box test
^KT-53723

This reverts commit 6594ebe487f0758e0fab880e2902d3d28eca7f44.
2022-08-30 07:56:18 +00:00
Igor Chevdar ea4a841056 [box-tests] Ignored a test for K/N for now
The test checks internal declarations visibility from friend module,
the K/N test system is broken for now if uses caches
2022-08-30 07:29:07 +00:00
Artem Kobzar 8b826a865b [K/JS, K/WASM] feat(Enum.entries): add support of new enum static field for JS and WASM. 2022-08-29 16:04:12 +00:00
Alexander Udalov 690322b203 Add flag -Xno-new-java-annotation-targets
Do not generate TYPE_USE/TYPE_PARAMETER Java annotation targets when
this flag is specified.

 #KT-53712 Fixed
2022-08-29 13:43:49 +02:00
Alexander Udalov a09fd45ade Do not generate TYPE_USE/TYPE_PARAMETER when compiling against JDK 1.6
#KT-53712
2022-08-29 13:43:32 +02:00
Artem Kobzar dbda8dcad1 [K/JS] test: add @file:JsExport tests for each @JsExport test + auto-generate TypeScript export tests. 2022-08-26 09:51:59 +00:00
Pavel Mikhailovskii d65775ca1a KT-47475 Do not copy InnerClass attribute for WhenMapping classes 2022-08-25 21:41:14 +00:00
Pavel Kunyavskiy 895a8ff149 [K/N] Basic support of Enum.entries for Native
No forward compatibility yet, with old klib IR linker will fail.

^KT-53324
2022-08-25 12:40:30 +00:00
Ilya Gorbunov 6aff3c6d07 Update misc test data after introducing rangeUntil member #KT-52933 2022-08-24 22:22:54 +00:00
Ilya Gorbunov baf7cbb3ac Add 'until' function for unsigned arguments to interpreter test helpers #KT-52933
Required to evaluate rangeUntil members of unsigned types.
2022-08-24 22:22:54 +00:00
Ilya Gorbunov 203a00151d rangeUntil member operator in builtins #KT-52933 2022-08-24 22:22:53 +00:00
Dmitriy Novozhilov 66117367ad [FIR] Transform context receivers on properties during type resolution stage
^KT-53706 Fixed
2022-08-24 15:36:42 +00:00
Pavel Mikhailovskii 18e61315f4 KT-27936 Generate InnerClasses attributes 2022-08-23 22:06:10 +00:00
Svyatoslav Scherbina 0021333b91 [Native][test] Unmute more passing tests
They now pass likely due to better handling of reflection information
when renaming packages when grouping tests (see cee0731).
2022-08-23 17:05:59 +00:00
Sergej Jaskiewicz d57ddc5f83 [JS IR] Generate debug info for JS injections
Also, fix the JS parser to collect the "correct" debug info
(see the note in `translateJsCodeIntoStatementList`)

#KT-53361 Fixed
2022-08-22 23:15:52 +00:00
Steven Schäfer a90c4d5dd5 JVM IR: Optimize equality on class literals 2022-08-23 00:14:11 +02:00
Rick Clephas 0a8cefc8a5 [FIR] Add NativeObjCRefinement checkers 2022-08-22 16:10:44 +02:00
Rick Clephas 203af3afdd [FE 1.0] Add NativeObjCRefinement checkers 2022-08-22 16:10:44 +02:00
Mikhail Glukhikh b78106e437 Don't report INFERRED_..._INTO_EMPTY_INTERSECTION with explicit arguments 2022-08-19 14:01:38 +00:00
Mikhail Glukhikh a6b90fcb8e Add a test with false positive "inferred into empty intersection"
Related to KT-50232
2022-08-19 14:01:37 +00:00
Mikhail Glukhikh d3648bce0c Run LoadJava.CompiledKotlin test group with stdlib if some enum is inside
This commit makes compiler tests working similarly to ResolveByStub IDE tests.
2022-08-19 10:08:11 +00:00
Mikhail Glukhikh fb1c80a7c9 K2: discriminate synthetic 'Enum.entries' during resolve 2022-08-19 10:08:11 +00:00
Mikhail Glukhikh 68ca453467 K2: don't report REDECLARATION on Enum.entries 2022-08-19 10:08:10 +00:00
Mikhail Glukhikh 730de8fd7c K1/K2: add test for enum class with 'entries' entry 2022-08-19 10:08:09 +00:00
Mikhail Glukhikh 8a4105e542 IR: fix origin of default getter of Enum.entries synthetic property 2022-08-19 10:08:08 +00:00
Arseniy Terekhov c0ab367281 [FIR] DeprecationProvider: fix test, remove FIR_IDE_IGNORE 2022-08-19 07:37:55 +00:00
Ivan Kylchik 3027ea9551 Add new jvm compilation key ignoreConstOptimizationErrors
This key suppose to be a workaround in keys if something goes
wrong in ir interpreter.
2022-08-18 16:50:06 +00:00
Ivan Kylchik 4e740e91f2 Safely unfold callable reference instruction in interpreter
There was an assumption that if receiver exists then parameter will
also exist. This is not true for references marked with `JvmStatic`.
Later in `JvmStaticInObjectLowering` dispatch receiver may be dropped.
2022-08-18 16:50:05 +00:00
Pavel Kunyavskiy 5034581788 [K/N] Fix references for inline function
Corresponding lowering creating wrappers from JS Backend was used.

Also, the lowering was changed to create local function, instead of
normal one in outer scope, as a lot of logic from local declarations
lowering should be duplicated otherwise for correct type parameters
handling.

^KT-38535
2022-08-18 13:23:10 +00:00
Ilya Goncharov 2f75ea585e [JS, Frontend] Not report warning with non-exportable super type
^KT-53539 fixed
2022-08-18 12:46:40 +00:00
Alexander Udalov 45abea5b0a Use platform class loader in 'kotlin' runner on JDK 9+
#KT-46312 Fixed
2022-08-17 22:23:10 +02:00
Iven Krall ec8da2033c KT-8263: Conditional operators are not parsed correctly 2022-08-16 10:00:54 +00:00
Iven Krall 2053363def KT-35811: Type parameter angle brackets followed by equal sign are parsed incorrectly if whitespace is missing 2022-08-16 10:00:53 +00:00
Simon Ogorodnik 513af2dfbc FIR. Refactor smart-cast representation in FIR tree
Make smart-casts non-transparent expression without delegation
to underlying FirQualifiedAccessExpression, as children delegation in
fir tree has unclear semantics
Remove two different kinds of tree nodes for smart-casts
2022-08-15 21:46:11 +00:00