90 Commits

Author SHA1 Message Date
Dmitriy Novozhilov f288163cbc [Test] Use rethrow for checked exception in java-written tests
In 9b5a9ccb `throws Exception` was removed from java test sources and
  all checked exceptions were wrapped with `RuntimeException`

But it was forgotten that there is a `rethrow` utility, which doesn't
  wrap exception but makes the javac happy at the same time
2024-03-14 11:04:02 +00:00
Kirill Rakhman 5e83350576 [Infrastructure] Assert dumps don't exist without directive
#KT-58697 Fixed
2024-02-29 08:36:16 +00:00
Kirill Rakhman 5bbec23123 [Test gen] Consolidate file reads for checking directives 2024-02-28 15:20:30 +00:00
Nikita Nazarov 407448d8e3 [JVM] Implement new inlined variable naming format
^KT-65478 fixed
2024-02-23 23:59:13 +01:00
Dmitriy Novozhilov 9b5a9ccba8 [Test] Don't generate throws Exception on methods of generated tests
This is needed to reduce the size of generated test files, which started
 to exceed default IDE limit
Also update some (mostly old) test utilities to remove exceptions from
 java signatures
2024-02-16 12:48:24 +00:00
Ivan Kylchik 71f2a2df8e [Tests] Drop JVM_WITH_OLD_EVALUATOR and JVM_WITH_IR_EVALUATOR targets
These targets were used in plugin, but not anymore.
2024-01-15 17:30:57 +00:00
Stanislav Ruban 8f79d519b8 Add @NotNull to return type of KtTestUtil.getJdk21Home 2024-01-09 18:45:59 +00:00
Ilya Chernikov 6dfcc927f4 IC tests: make exceptions from compiler more visible in tests
otherwise they are easily swallowed by the reporting logic.
This commit was needed to ensure that the problem described in
KT-63665 is reproducible in IC test
But some JS IC logic relies on handling compiler exceptions as a signal
for scope expansions, and the newly introduced exception logging
broke a few tests. To mitigate it, the directive was introduced
to disable exception logging for particular test.
2023-12-13 13:40:44 +00:00
Evgenii Mazhukin 834602b737 [Tests] Add javadoc for @TestMetadata
Merge-request: KT-MR-13338
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-12-04 17:29:42 +00:00
Nikolay Lunyak b8e2a17de1 [Test] Fix diagnostics arguments rendering when quotes are present
Non-capturing `(?:)` was now needed to avoid
getting an additional group that only
contains the last symbol before the closing `"`.

^KT-62711 Fixed
2023-11-03 08:14:28 +00:00
Ilya Goncharov e9cc2931cc [JS] Use kotlin-stdlib-js.klib instead of *.jar 2023-10-16 13:34:37 +00:00
Igor Yakovlev 983991d46c [Wasm] Add box and stdlib tests in wasi mode 2023-08-08 18:10:19 +02:00
Alexander Udalov 971b4e63e7 JVM: support enumEntries intrinsic for Java & old Kotlin enums
#KT-59710 Fixed
2023-07-25 09:55:43 +00:00
Alexander Udalov eeef70b2c8 Tests: remove TargetBackend.JVM_OLD
TargetBackend.JVM is equivalent to it at this point.
2023-07-17 16:55:24 +00:00
Nikolay Lunyak 110cc79ddd [FIR] Improve debugging of diagnostic ranges
`UNREACHABLE_CODE` is weird.
If we look into its
positioning strategy,
we'll see that this diagnostic
attempts to split the source
of its element into multiple ranges.
This is bad, because such smaller
ranges can easily overlap with other
diagnostics in such a way that
they are no longer hierarchical.
See the
`compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt` test
for an example of this behavior
(allow reporting `UNREACHABLE_CODE`
first). The problem will appear at
the condition of `case_7`.
2023-06-19 07:40:16 +00:00
Alexander Shabalin aea8bac7d2 [K/N] Do not compile for deprecated targets and legacy MM
^KT-56533
^KT-58853
2023-05-30 16:44:58 +00:00
Denis.Zharkov 67d51eb7ee Add a separate test configurations for JDK 21 dependent test
After it's released, there would be no need in them, but right now
they are unavailable through the toolchain, so we can't require it.
See KT-58765 for tracking

But there should be a dedicated Build configuration with JDK_21_0 env
properly set.

^KT-58716 Fixed
2023-05-22 09:19:52 +00:00
Alexander Udalov fb900d2e2a JVM: remove most usages of JvmTarget.JVM_1_6 2023-05-19 13:24:00 +00:00
Roman Golyshev d4cffb8a5a [213] Switch to 213 platform
KTI-1114
2023-04-21 13:19:04 +00:00
Dmitriy Novozhilov 6287968511 [FIR Test] Migrate AbstractFirLoadCompiledKotlin to new test infrastructure
Also introduce two different modes for those tests:
- load metadata compiled with K1
- load metadata compiled with K2
2023-04-19 14:33:25 +00:00
Dmitrii Gridin b3cb47e8a1 [tests] add new custom extension 'reversed' for tests
the new test will be introduced in the next commits

^KT-55750
2023-03-20 20:17:51 +01:00
Pavel Kunyavskiy 0506d39d8a [K/N] Support ignoring test with legacy mm 2023-03-14 12:59:13 +00:00
Dmitriy Novozhilov da581f38e1 [Test] Require specifying parser for FIR test. Unify names for FIR tests
Now all tests with `Fir` in name are named accordingly to parser which
  is used in them -- `FirPsi` or `FirLightTree`. This is needed to keep
  consistency between different types of tests, because there is no
  single default in parser mode between different scenarios of using FIR
2023-02-24 11:15:26 +00:00
Dmitriy Novozhilov a0bdecd22b [Test] Ignore Native codegen test with IGNORE_BACKEND_...: ANY directive 2023-02-07 09:49:20 +00:00
Mikhail Glukhikh 0c4a0360ac Deserialization/class reading: pass chosen JvmMetadataVersion whenever possible 2023-01-16 18:16:07 +01:00
Marco Pennekamp 88ac5727cc [LL FIR] KT-50732 Add support for LL FIR-specific tests (.ll.kt)
- `.ll.kt` test data can be added in cases where LL FIR resolution
  legally diverges from K2 compiler results.
- Each `.ll.kt` test is prefixed with an `LL_FIR_DIVERGENCE` directive
  which must explain why the test may diverge from K2 compiler results.
  - `LLFirDivergenceCommentChecker` ensures that each `.ll.kt` file
    contains an `LL_FIR_DIVERGENCE` directive.
- `LLFirIdenticalChecker` results in an assertion error if the `.ll.kt`
  test and its base test are completely identical, including in their
  meta info (but ignoring `LL_FIR_DIVERGENCE`).
  - The checker additionally ensures that the base source file and the
    `.ll.kt` source file have identical Kotlin source code (ignoring
    meta info and `LL_FIR_DIVERGENCE`). This ensures that both tests
    test the exact same thing.
- `.ll.kt` files are ignored by select test generators, in addition to
  `.fir.kt` files.
2023-01-16 15:20:50 +00:00
Vladimir Sukharev 924898afb7 [K/N] KFC-446: K2 platform: Native alpha
Merge-request: KT-MR-7905
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-01-04 16:10:40 +00:00
Ilya Chernikov 5b3816cce5 Test infra: refactor IGNORE_BACKEND directive
treat it as a general one, introduce *_K1 and *_K2 variants for
more specific ignoring
2022-11-12 16:28:23 +01:00
Hung Nguyen cdbbead157 Handle changes to inline functions/property accessors with @JvmNames
If we detect a change in an inline function `foo` with @JvmName
`fooJvmName`, we have two options:
   1. Report that function `foo` has changed
   2. Report that method `fooJvmName` has changed

Similarly, if we detect a change in an inline property accessor with
JvmName `getFoo` of property `foo`, we have two options:
   1. Report that property `foo` has changed
   2. Report that property accessor `getFoo` has changed

The compiler is guaranteed to generate `LookupSymbol`s corresponding to
option 1 when referencing inline functions/property accessors, but it is
not guaranteed to generate `LookupSymbol`s corresponding to option 2.
(Currently the compiler seems to support option 2 for *inline*
functions/property accessors, but that may change.)

Therefore, we will choose option 1 as it is cleaner and safer.

^KT-54144 In progress

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress

Extract KotlinClassInfo to a separate class

to reduce the size of IncrementalJvmCache and prepare for the next
change.

^KT-54144 In progress

Ignore inline functions that are not found in the bytecode

^KT-54144 In progress

Add unit test for handling `@JvmName`s

Test: KotlinOnlyClasspathChangesComputerTest
             #testFunctionsAndPropertyAccessorsWithJvmNames
^KT-54144 Fixed

Update unit tests for handling `@JvmName`s

In a previous commit, we made a behavior change for inline property
accessors: The existing behavior is that if the implementation of an
inline getter has changed, only usages of the getter will be impacted
but not usages of the setter (and vice versa).

After that previous commit, usages of *both* the getter and setter will
now be impacted (i.e., we might compile slightly more files). This is
because a change to either the getter or the setter will now be
considered a change to the property, which will help simplify our change
analysis.

This commit updates the relevant unit tests to reflect the new behavior.

Test: Updated Incremental*TestGenerated.PureKotlin#testInlinePropertyInClass
      and Incremental*TestGenerated.PureKotlin#testInlinePropertyOnTopLevel

^KT-54144 Fixed
2022-11-10 10:03:55 +01:00
nataliya.valtman 9b212cfa86 Revert "Extract KotlinClassInfo to a separate class"
This reverts commit ec3da62672.
2022-11-07 13:59:32 +01:00
Hung Nguyen ec3da62672 Extract KotlinClassInfo to a separate class
to reduce the size of IncrementalJvmCache and prepare for the next
change.

^KT-54144 In progress

Handle changes to inline functions/property accessors with `@JvmName`s

If we detect a change in an inline function `foo` with @JvmName
`fooJvmName`, we have two options:
   1. Report that function `foo` has changed
   2. Report that method `fooJvmName` has changed

Similarly, if we detect a change in an inline property accessor with
JvmName `getFoo` of property `foo`, we have two options:
   1. Report that property `foo` has changed
   2. Report that property accessor `getFoo` has changed

The compiler is guaranteed to generate `LookupSymbol`s corresponding to
option 1 when referencing inline functions/property accessors, but it is
not guaranteed to generate `LookupSymbol`s corresponding to option 2.
(Currently the compiler seems to support option 2 for *inline*
functions/property accessors, but that may change.)

Therefore, we will choose option 1 as it is cleaner and safer.

^KT-54144 In progress

Ignore inline functions that are not found in the bytecode

^KT-54144 In progress

Add unit test for handling `@JvmName`s

Test: KotlinOnlyClasspathChangesComputerTest
             #testFunctionsAndPropertyAccessorsWithJvmNames
^KT-54144 Fixed

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress
2022-11-07 13:10:02 +01:00
Dmitriy Novozhilov 097a86deb5 [Test] Check that FIR tree does not contain stub types and type variable types after resolution 2022-11-03 08:30:08 +00:00
Nikolay Krasko 1630386712 Move to JDK_X_Y variables 2022-09-21 22:53:19 +00:00
Nikolay Krasko 2df9203336 Add ability to configure jdk with two backup properties 2022-09-21 22:53:18 +00:00
Hung Nguyen 03f83ff339 New IC: Include inline property accessors in class/package members
Problem: ClasspathChangesComputer (a core component of the new IC) uses
the existing inline function analysis from the old IC
(IncrementalJvmCache.InlineFunctionsMap). If an inline property accessor
has changed, the inline function analysis will report the name of the
property accessor, not the name of the property.
ClasspathChangesComputer doesn't see the property accessor's name in the
list of class/package members, so it will throw an exception.

Solution: There are 2 options:
  1. If an inline property accessor has changed, the inline function
     analysis can report the name of the property instead of the
     property accessor.
  2. ClasspathChangesComputer can include property accessors in the list
     of class/package members.

In this commit, we will choose option 2 as it is simpler.

Test: New KotlinOnlyClasspathChangesComputerTest.testPropertyAccessors

Small cleanup - PLS SQUASH INTO PREVIOUS COMMIT

  - Address review
  - Fix failed tests
  - Add some trivial changes

^KT-53871 Fixed
2022-09-19 11:50:08 +02:00
Alexander Udalov 87d3ce6ded Write a copy of SMAP to a new annotation
To make it available for dynamically attached JVMTI agents.

`@SourceDebugExtension` annotation value is equal to the
SourceDebugExtension attribute value, which is checked now for all box
tests. The difference is that the annotation stored in the constant
pool, which is available for dynamically attached JVMTI agents.

 #KT-53438 Fixed
2022-09-09 14:32:35 +02:00
Nikita Bobko 2a4f3f41aa 2/5 Replace source dependency on kotlin-reflect with binary dependency
Review: https://jetbrains.team/p/kt/reviews/6753

Meaningful semantic change was splitted into 5 commits to simplify the
change review. Sinle commit would be too big.

Why replace source to binary: to get rid of kotlin-reflect in Kotlin
plugin artifact KTIJ-22276

Note: Kotlin Maven artifacts (./gradlew publish) changed their
dependency on kotlin-reflect
2022-08-22 15:43:49 +02:00
Nikita Bobko 0874fb71c6 Replace all kotlin-reflect-api dependencies with kotlin-reflect
Review: https://jetbrains.team/p/kt/reviews/6753

Why: I'm going to replace source dependency on kotlin-reflect with
binary dependency. Normalize reflect dependency before global
processing.
2022-08-22 15:43:11 +02:00
Abduqodiri Qurbonzoda cf44753aed Remove :compiler:tests-common-jvm6 project and JvmTarget6OnBaseJvm tests 2022-08-13 01:33:48 +03:00
Dmitriy Novozhilov 928416c9c5 [CLI] Introduce new compiler arguments for registering compiler plugins
With new syntax each plugin should be registered in separate argument with syntax
`-Xcompiler-plugin=classpath1,classpath2[=argument1=value1,argument2=value2]`
2022-07-20 09:07:26 +00:00
Alexander Udalov bd0fe2f146 Remove dependency of compiler tests on fir2ir tests
Compiler tests use the old test infrastructure, but fir2ir tests use the
new one (tests-common-new). Removing this dependency means that now the
two big modules, `:compiler:compileTestKotlin` and
`:compiler:tests-common-new:compileTestKotlin` can be compiled in
parallel, which improves the total build time.
2022-07-18 13:13:01 +02:00
Ilya Chernikov 03cbfea737 FIR LT: Introduce source file abstraction, carry it from parsing to IR
along with source lines mapping, allows to "emulate" usage of the
PSI files which allows to extract source file and line mapping info
on every stage from source element.
It makes sense to use this mapping for the error reporting too.
2022-03-30 08:34:30 +00:00
Dmitriy Novozhilov c6994768d7 [Test] Drop redundant Condition class 2022-02-09 19:35:54 +03:00
Vyacheslav Gerasimov f7a9065b75 Build: Use intellij maven repo instead of downloaded IDEA
#KTI-82
2021-12-16 21:48:23 +03:00
Victor Petukhov d8366a2861 Don't use hardcoded getJdkHome's parameters as fallback in KtTestUtil.java 2021-12-10 10:23:50 +03:00
Dmitriy Novozhilov e56c87a17a [Build] Move utils for generation JUnit 5 tests to :generators module 2021-10-12 17:26:18 +03:00
Victor Petukhov 70d70b9042 Use warn mode by default for jspecify nullability annotations in 1.6
^KT-48851 Fixed
2021-09-30 20:08:35 +03:00
Dmitriy Novozhilov de7fb9606a Migrate all JDK 9 related tests to JDK 11 2021-09-28 13:01:47 +03:00
Dmitriy Novozhilov ce3562f0e8 Migrate all JDK 15 related tests to JDK 17 2021-09-28 13:01:45 +03:00
Ilmir Usmanov 486c6b3c15 Remove obsolete experimental coroutines support
in compiler.
2021-08-13 22:31:30 +02:00