Commit Graph

319 Commits

Author SHA1 Message Date
Pavel Kirpichenkov b316aa7d1d [AA] stub-based library symbol providers for non-JVM platforms
Use existing stub-based JVM library symbol provider for .knm and
.kotlin_metadata files. The only real difference is the scope filtering
by file types

KT-58769
2023-07-25 09:15:29 +00:00
Brian Norman 363b336b7a [FIR] Only overridable members should report JvmName inapplicable
Instead of checking for only open declarations, check for overridable
declarations, since private declarations cannot be overridden even if
they are marked as open. While normally these modifiers are exclusive,
a declaration can be made open via a compiler plugin like AllOpen.

#KT-60183 Fixed
#KT-57223 Fixed
2023-07-17 12:06:09 +00:00
Pavel Kirpichenkov 630c8e9df6 [AA, tests] Limit scopes of test libraries to their roots, add JDK_HOME
Without the fix, all libraries share the global scope for all project
libraries. JDK_HOME was used implicitly for things such as providing
Record support, but was not included as a test library/sdk.

KT-59637
2023-06-27 10:29:22 +00:00
Stanislav Ruban e6d5df18b8 [tests] Add new (and refactor existing) tests for @SubclassOptInRequired
KT-54617
2023-05-23 12:33:51 +00:00
Alexander Udalov e4e1bcefbd JVM: remove tests on JVM target 1.6 2023-05-19 13:23:59 +00:00
Alexander Udalov 3120a35a88 JvmDefault: remove most tests on @JvmDefault
The tests are removed because JvmDefault is going to be deprecated with
error in KT-54746 and removed later in KT-57696.

Many of the removed tests already had existing counterparts with the new
modes `all` and `all-compatibility`. In this change, I've added such
tests where they were missing, and removed tests which were testing
behavior specific to the JvmDefault annotation, such as some
diagnostics.

 #KT-54746
2023-04-25 14:33:00 +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
Ilya Gorbunov b8da3e69ce KT-55268 Make k.c.Volatile stable 2023-04-08 15:07:56 +00:00
Kirill Rakhman 085df96afe [FIR] Make Volatile diagnostics applicable to kotlin.concurrent.Volatile
#KT-55628 Fixed
2023-04-04 10:36:39 +00:00
Kirill Rakhman 91adb88eff [K1] Make Volatile diagnostics applicable to kotlin.concurrent.Volatile
#KT-55628
2023-04-04 10:36:39 +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 2139914061 [FIR] Add diagnostic when annotation argument is resolved ambiguously
Annotation arguments that are resolved in COMPILER_REQUIRED_ANNOTATIONS
phase are resolved again in ANNOTATION_ARGUMENTS phase. If they resolve
to a different symbol, report an error.

KT-56177
2023-02-28 10:19:19 +00:00
Kirill Rakhman 9dda5e4fcd [Test] Remove redundant FIR_DISABLE_LAZY_RESOLVE_CHECKS directives
KT-56177
2023-02-28 10:19:18 +00:00
Ilya Kirillov 1bbcae5ed2 [FIR] fix resolve contract violation from scopes
We cannot call lazy resolve to STATUS phase from scopes as scopes may be accessed on a STATUS phase or earlier

^KT-54890
^KTIJ-23587 fixed
2023-01-13 21:32:51 +00:00
Ilya Gorbunov 916f733f73 Make k.c.Volatile since 1.9 in JVM and Common KT-55268, KT-55609
Leave it experimental since 1.8 for K/Native.
2023-01-04 17:28:46 +00:00
Mikhail Glukhikh 0d50f71fb8 K2: expand type aliases in annotation position #KT-55615 Fixed 2023-01-04 10:06:39 +00:00
Ilya Gorbunov e2d96da396 Introduce experimental kotlin.concurrent.Volatile annotation KT-55268, KT-55609
Use this annotation in tests to ensure it works the same at least on JVM
2022-12-23 19:07:30 +01:00
Ilya Kirillov 644d1bf0d0 [FIR] ignore tests which fail because of resolve contracts violation 2022-12-12 16:21:07 +00:00
Evgeniy.Zhelenskiy 002f6bd34a [FIR] Fix JvmName annotation diagnostics
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55143
2022-11-25 16:30:22 +01:00
Nikolay Lunyak b6f950ed75 [FIR][FE 1.0] KT-47933: Warn about redundant @Repeatable
Merge-request: KT-MR-7318
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2022-10-07 13:33:49 +00:00
Nikolay Lunyak fcd3e4f4c5 [FIR JS] KT-51740: Alter positioning of NO_VALUE_FOR_PARAMETER 2022-09-30 21:39:20 +03:00
Ilya Kirillov 556b7894d5 [Low Level FIR] do not search for declarations from kotlin. package in source modules 2022-09-30 12:15:49 +02:00
Mikhail Glukhikh 7333589663 K1/K2: add Enum.entries unconditionally and filter them out in tower
Before this commit, we added Enum.entries only in case when
LanguageFeature.EnumEntries was ON (with an exception in K1/Java case).
In this commit we add Enum.entries unconditionally, and in case
the language feature is OFF we filter them out during tower resolve.
2022-08-12 09:35:27 +00:00
Ivan Kochurkin 792aa24a04 [FIR] Throws by star import wins builtin Throws, ^KT-52407 Fixed, ^KT-52517 Fixed 2022-05-29 23:41:27 +03:00
Ivan Kylchik 51ccc32a3f Update test data after introducing IntrinsicConstEvaluation annotation 2022-05-18 21:19:57 +03:00
Mikhail Glukhikh c8453ec8b4 FIR: report ambiguity-like errors in type resolve 2022-03-10 20:42:42 +00:00
Simon Ogorodnik 4ba5a55626 FIR. Add visibility/deprecation filtering to type resolve 2022-03-10 20:42:39 +00:00
Ivan Kochurkin 73b45a1254 [FIR] Report UNSUPPORTED on array literals not from annotation classes ^KT-50750 Fixed 2022-02-23 14:21:57 +03:00
Dmitriy Novozhilov c80cfb0fdb [FIR] Replace single supertype scope with list of scopes of supertypes in use site scopes
This big refactoring is needed to cleanup building of overrides
  mappings and prevent creating redundant intersection overrides in
  cases when there is no need in them:

```kotlin
interface A {
    fun foo()
}

interface B {
    fun foo()
}

interface C : A, B {
    override fun foo()
}
```

Before this refactoring there was next override tree:
C.foo
  intersection override (A.foo, B.foo)
    A.foo
    B.foo

Also this commit fixes special mapping of overrides in jvm scopes
  for declarations which have kotlin builtins in supertypes with
  special java mapping rules (collections, for example)
2022-01-19 15:24:43 +03:00
Mikhail Glukhikh 0739925869 Drop QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE diagnostic in 1.7.0
#KT-49016 Fixed
2021-12-23 17:45:49 +03:00
Mikhael Bogdanov 7e99ba30f3 Remove obsolete USAGE_OF_JVM_DEFAULT_THROUGH_SUPER_CALL diagnostic
#KT-47000
2021-12-09 11:30:06 +01:00
Mikhail Glukhikh 533e802c8d FIR: support JVM_DEFAULT_WITH_COMPATIBILITY_* diagnostics (FE 1.0 sync) 2021-12-09 13:26:40 +03:00
Mikhail Glukhikh 178290eac3 FIR: drop JVM_DEFAULT_THROUGH_INHERITANCE diagnostic (FE 1.0 sync) 2021-12-09 13:26:39 +03:00
Mikhael Bogdanov a2395ec8bb Additional diagnostics for @JvmDefaultWithCompatibility 2021-12-06 14:20:25 +01:00
Mikhael Bogdanov c0ffbe03c6 Remove '-Xjvm-default-allow-non-default-inheritance' flag. Enable such inheritance by default
#KT-47000 Fixed
2021-12-03 06:39:38 +01:00
Denis.Zharkov 7eb758fab1 FIR: Avoid propagation of @Exact annotation through elvis 2021-11-26 19:39:52 +03:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Mads Ager b79ca7d7df [FIR] Allow annotation instantiation.
This commit disables the frontend error reporting for supported cases.
2021-11-09 23:51:48 +03:00
Mikhail Glukhikh 7243d30869 Split property use-site targets during FIR building 2021-10-12 16:22:58 +03:00
Ivan Kochurkin e97933a9e5 [FIR] Add POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION 2021-09-13 20:48:55 +03:00
Ivan Kochurkin 55f33999f1 [FIR] Add REPEATED_ANNOTATION, REPEATED_ANNOTATION_WARNING 2021-09-10 00:49:07 +03:00
Ivan Kochurkin f414a91c66 [FIR] Implement FirInterfaceDefaultMethodCallChecker
Add diagnostics: INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET,
INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER,
DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET
2021-09-10 00:49:04 +03:00
Ivan Kochurkin 2baed77598 [FIR] Add JVM_SYNTHETIC_ON_DELEGATE diagnostic
Extract JVM names to common JvmNames
2021-09-10 00:49:03 +03:00
Ivan Kochurkin 3725c58794 [FIR] Add INAPPLICABLE_JVM_FIELD, INAPPLICABLE_JVM_FIELD_WARNING 2021-09-10 00:49:02 +03:00
Ivan Kochurkin cfd2835254 [FIR] Add JVM Default diagnostics 2021-09-10 00:48:59 +03:00
Nikolay Lunyak 1a3f47badd [FIR] Make FirJvmStaticChecker more consistent with the legacy version 2021-09-09 20:18:49 +03:00
Nikolay Lunyak 2a2c92d8b3 [FIR] Add support for JVM_STATIC_ON_EXTERNAL_IN_INTERFACE diagnostic 2021-09-09 20:18:49 +03:00
Nikolay Lunyak 7006426304 [FIR] Add support for JVM_STATIC_ON_CONST_OR_JVM_FIELD diagnostic 2021-09-09 20:18:49 +03:00
Nikolay Lunyak f3d61c199b [FIR] Add support for JVM_STATIC_ON_NON_PUBLIC_MEMBER diagnostic 2021-09-09 20:18:49 +03:00
Nikolay Lunyak c2e5583780 [FIR] Add support for JVM_STATIC_NOT_IN_OBJECT_OR_COMPANION diagnostic 2021-09-09 20:18:49 +03:00