Commit Graph

24 Commits

Author SHA1 Message Date
Kirill Rakhman 2f49272c42 [FIR] Create fake hidden versions of List.getFirst/getLast in JDK < 21
... so that overrides are marked as deprecated regardless of the JDK.

#KT-65440 Fixed
2024-02-14 13:13:01 +00:00
Kirill Rakhman 2d7cadc0ab [FE, Java Resolve] Filter out canonical record constructors
This fixes a false positive overload resolution ambiguity in FIR
when invoking a record constructor when it also defines a canonical
constructor (compact or explicit).

#KT-62151 Fixed
2023-11-02 12:39:45 +00:00
Kirill Rakhman ac203591e5 [FE, Java resolve] Support inheritors of sealed Java type without permits clause
This fixes a false negative NO_ELSE_IN_WHEN in K2 and incidentally
also fixes a false positive NO_ELSE_IN_WHEN in K1 since the fix is in
the common code.

#KT-62491 Fixed
2023-10-31 13:41:56 +00:00
Kirill Rakhman 6a2b6e03d4 [FIR] Fix false negative ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman 16ae83bde0 [FIR] Fix Java sealed class inheritors
This fixes NO_ELSE_IN_WHEN diagnostics when using java sealed
classes in an exhaustive when.

#KT-58216 Fixed
2023-09-11 07:37:37 +00:00
Dmitrii Gridin b67b37cdb3 [FIR] FirJavaFacade: do not duplicate record constructor
The fresh version of intellij has all record-related declarations,
so an additional fake constructor leads to errors like
KTIJ-25364 (OVERLOAD_RESOLUTION_AMBIGUITY)

^KTIJ-25366 Fixed
^KTIJ-25364 Fixed
^KTIJ-25368 Fixed
^KTIJ-25370 Fixed
2023-07-13 09:21:38 +00:00
Egor Kulikov 6f20ac4f38 [FIR] Enable asserts for not building AST tree in lazy mode
Make interface delegate expressions lazy
2023-05-10 11:49:42 +00:00
Dmitrii Gridin 72def186a3 [LL FIR] rework transformers, so transformers resolve only a specific set of declarations
The change is needed for the parallel resolution (^KT-55750), so we can resolve the declaration
under a lock that is specific to this declaration.
Previously, if LL FIR was resolving some FirClass, LL FIR  resolved all its children too, and it had no control over what parts of the FIR tree were modified.
The same applied to the designation path, sometimes the classes on the designation path
might be unexpectedly (and without lock) modified.

This commit introduces LLFirResolveTarget, which specifies which exact declarations should be resolved during the lazy resolution of the declaration.
All elements outside the declarations specified for resolve in LLFirResolveTarget, should not be modified.

The logic of lazy transformers is the following:
- Go to target declaration collecting all scopes from the file and containing classes
- Resolve only declarations that are specified by the LLFirResolveTarget, performing the resolve under a separate lock for each declaration

^KT-56543
^KT-57619 Fixed
2023-04-19 20:12:38 +00:00
Dmitrii Gridin 9a4a3d1f49 [LL FIR] introduce test with reversed resolve order
^KT-56543

Merge-request: KT-MR-9299
Merged-by: Dmitrii Gridin <dmitry.gridin@jetbrains.com>
2023-03-22 17:34:07 +00:00
Kirill Rakhman 9dda5e4fcd [Test] Remove redundant FIR_DISABLE_LAZY_RESOLVE_CHECKS directives
KT-56177
2023-02-28 10:19:18 +00:00
Dmitriy Novozhilov 0bbc61f459 [FIR] Unwrap flexible types in when exhaustiveness checker
^KT-56942 Fixed
2023-02-24 14:58:18 +00:00
Marco Pennekamp a777ffcd8a [AA] KT-55566 StandaloneProjectFactory: Setup JDK default module roots
- Setup JDK default module roots in `StandaloneProjectFactory` (compare
  with `KotlinCoreEnvironment`). The implementation is a distilled
  version of `ClasspathRootsResolver`'s default module handling.
- This fixes an issue where some LL FIR tests with JDK 17 and 11 had
  mismatched types between Kotlin and Java sources.

^KT-55566 fixed
2023-01-04 11:46:11 +00:00
Marco Pennekamp e68111c218 [AA] KT-55566 StandaloneProjectFactory: Setup Java language level before Java files are parsed
- LL FIR tests with Java `record` classes and other new syntax features
  failed because `file.packageName` in `findJvmRootsForJavaFiles`
  caused the Java file to be parsed before the Java language level was
  configured. The Java language level is now set up in
  `registerJavaPsiFacade`, which is early enough.
2023-01-04 11:46:10 +00:00
Mikhail Glukhikh 6111daa8f7 Fix a pair of broken lazy resolve tests after rebase 2022-12-12 17:27:19 +01:00
Ilya Kirillov 644d1bf0d0 [FIR] ignore tests which fail because of resolve contracts violation 2022-12-12 16:21:07 +00:00
Dmitriy Novozhilov d898e256ca [FIR] Don't update explicit delegated constructor calls of classes with @JvmRecord
^KT-54573 Fixed
2022-12-09 12:02:08 +00:00
Dmitriy Novozhilov c0ad67c4f9 [FIR] Generate java declarations for record components of java records
^KT-53964 Fixed
2022-10-03 15:48:17 +03:00
Vsevolod Tolstopyatov 0a5b3f1e13 [JVM IR] Adjust testData to address new static Enum.entries member 2022-08-12 09:35:26 +00:00
Ivan Kylchik 51ccc32a3f Update test data after introducing IntrinsicConstEvaluation annotation 2022-05-18 21:19:57 +03:00
Ilya Kirillov 66df69ea2c [low level fir, tests] temporary mute some tests with the latest full jdk
full jdk paths are not handled well after test infra rework
2022-04-13 12:53:27 +02:00
Mikhail Glukhikh 53d6ac24e5 Switch kotlin version to 1.7
* Change 1.6 to 1.7 constants
* Fix SAFE_CALL_WILL_CHANGE_NULLABILITY for testData
* Change EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_WARNING to EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_ERROR
* Change NON_EXHAUSTIVE_WHEN_STATEMENT to NO_ELSE_IN_WHEN
* Fix testData for SafeCallsAreAlwaysNullable
* Change T -> T & Any in test dumps
* Change INVALID_CHARACTERS_NATIVE_WARNING -> INVALID_CHARACTERS_NATIVE_ERROR
* TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING -> TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR
2022-02-25 11:46:27 +00:00
Dmitriy Novozhilov ce3562f0e8 Migrate all JDK 15 related tests to JDK 17 2021-09-28 13:01:45 +03:00
Tianyu Geng 10d4dfef04 FIR: check subclass of sealed class 2021-08-25 14:37:24 +03:00
Dmitriy Novozhilov fa1d09c778 [FE 1.0] Support java sealed classes
^KT-46778 Fixed
2021-08-01 22:23:45 +03:00