Commit Graph

107 Commits

Author SHA1 Message Date
Nikita Bobko 8c0cf7d0bc [FIR] Fix disappeared ACTUAL_MISSING
^KT-59887 Fixed

Review: https://jetbrains.team/p/kt/reviews/13244
2023-12-04 13:08:23 +00:00
Nikita Bobko a1ce8ac175 [FIR] 1/2 match and check expect fake-overrides vs actuals
^KT-63550 Fixed
Review: https://jetbrains.team/p/kt/reviews/13094/timeline

Now it's required to create a new ScopeSession when searching for expect
members for actuals. If you keep reusing actualScopeSession then members
declared in platform may "slip into" the search results, resulting an
incorrect expect for actual (e.g. it happens in
supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.fir.kt)

I suppose that it always has been a bug that we reused
actualScopeSession because we were mixing actualScopeSession and
expect FirSession (which is a bad idea), but we simply didn't have cases
where this bug could be observed. Now after we started matching
fake-overrides, we have such cases.

But creating a new ScopeSession every time is a suboptimal solution. We
need to design a scope caching KT-63773
2023-11-24 18:02:47 +00:00
Nikita Bobko b7198c35b9 Update incompatibleClassScopesWithImplTypeAlias test
Caused by: KT-62590

Now we have the pipeline:
1. Match declarations
2. Run checkers on matched declarations

Since the constructors with empty parameters match we only report
"checking incompatibility" about their incompatible visibility

Before the pipeline introduction, we were running matching and checking
checks together
2023-11-06 14:41:26 +00:00
Nikita Bobko 75a0442b61 [FIR] 2/2 Cleanup: drop no longer necessary FirActualCallableDeclarationChecker
It became possible to drop it after KT-62590. Now, on a frontend, the
return type check is part of a common AbstractExpectActualChecker logic

Change in nestedAnnotationClassViaActualTypealias.fir.kt aligns the
behaviour with K1. KT-61964

Review: https://jetbrains.team/p/kt/reviews/12750/timeline
2023-11-06 14:41:23 +00:00
Nikita Bobko ddc1ae9ac6 [IR] Split INCOMPATIBLE_MATCHING to EXPECT_ACTUAL_MISMATCH & EXPECT_ACTUAL_INCOMPATIBILITY
KT-62590

Review: https://jetbrains.team/p/kt/reviews/12750/timeline
2023-11-06 14:41:22 +00:00
Alexander Korepanov 522952db1f [JS IR] Run diagnostics by IR before the klib serialization
Implement an infrastructure for checking IR before JS klib serialization.
Implement the EXPORTING_JS_NAME_CLASH and EXPORTING_JS_NAME_CLASH_ES checks.

^KT-61710 Fixed
2023-09-23 19:49:17 +02:00
Kirill Rakhman ed4386a962 [FIR] Fix rendering of NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS 2023-09-21 07:18:19 +00:00
Mikhail Glukhikh db03cd8cd7 LV 2.0: update diagnostic message in MPP integration test 2023-09-19 15:46:30 +00:00
Mikhail Glukhikh cc2be502f6 LV 2.0: mute two MPP integration tests 2023-09-19 15:46:28 +00:00
Mikhail Glukhikh 2a8b655294 Update tests after switching to LV 2.0
Related to KT-59171
2023-09-19 15:46:27 +00:00
Nikita Bobko 2127b2ce68 expect/actual classes: experimental -> Beta
KT-61573
^KT-61712 Fixed
Review: https://jetbrains.team/p/kt/reviews/12044/files

It's a follow up commit

According our guidelines, it must be in Beta
https://kotlinlang.org/docs/components-stability.html#stability-of-subcomponents

And the whole multiplatform was in Beta, so we can't make part of the
multiplatform to have lower stability level
2023-09-11 13:57:28 +00:00
Nikita Bobko 01fc708a0f Mark expect/actual classifiers as experimental
^KT-61573 Fixed
Review: https://jetbrains.team/p/kt/reviews/11969/timeline

Tests:
- MultiPlatformIntegrationTestGenerated
- CliTestGenerated
- MultiPlatformIntegrationTestGenerated
- DiagnosticTestGenerated.Multiplatform
- FirLightTreeOldFrontendDiagnosticsTestGenerated

Also add -Xexpect-actual-classes flag to all necessary ./libraries/* modules
Otherwise compilation of those modules failes because of `-Werror`
2023-09-04 12:21:37 +00:00
Stanislav Ruban 857bfeb92c [KMP] Fix multiplatform test data with ACTUAL_WITHOUT_EXPECT messages 2023-08-30 12:06:43 +00:00
Nikita Bobko 25c082f02b K1: Implement a checker that disallows to have different member scopes for expect open and its actual
^KT-22841 Fixed
Review: https://jetbrains.team/p/kt/reviews/11603/timeline

The commit also introduces `@AllowDifferentMembersInActual` annotation in
stdlib which allows to suppress the diagnostic
2023-08-21 19:51:08 +00:00
Ivan Kochurkin dc1f1fe979 Move optionalExpectationIncorrectUse from MPP integration to diagnostics tests 2023-08-10 17:46:08 +00:00
Nikita Bobko d4758014ec [FE] Type-safety refactoring: Make areCompatibleClassScopes to return Incompatible.WeakIncompatible
Review: https://jetbrains.team/p/kt/reviews/11039/timeline

For StrongIncompatible `actual` declaration is considered as overload
and error reports on expected declaration. For WeakIncompatible the
error is reported straight away

Before the refactoring `areCompatibleClassScopes` returned just
`Incompatible`. It is bad because StrongIncompatible isn't possible for
classes (classes can't be overloaded). Now all class incompatibilities
are weak.

The commit has a minor impact on observable behavior (cases where we
reported the compilation problems are still reported but on another
elements):
- We no longer report type parameter class incompatibilities on expect
  declaration, we report them only on actuals (it happened because all
  WeakIncompatible are reported only on actuals)
- In a sense, Java implicit actualization was the only way to "overload"
  classes (it would be a redeclaration compilation problem, so it
  doesn't count as a valid "overload"). And since type parameters
  incompatibility was StrongIncompatible for classes, we counted them as
  "overloads" and didn't report incompatibility problems on Kotlin
  class. Now we do report. (see
  implicitJavaActualization_multipleActuals)
2023-08-10 15:46:48 +00:00
marat.akhin 34b271b13d [KMP] Implement ACTUAL_TYPE_ALIAS_TO_NOTHING/TO_NULLABLE_TYPE errors
^KT-60650 Done
2023-07-27 09:13:37 +00:00
Roman Efremov 1a4ab9bb4b [FE] Implement FE logic of expect actual annotations matching
This implementation only checks annotations set on expect/actual
declarations and requires further refinement (e.g. checking of other
annotation targets, class scopes within typealiases).

^KT-58551
2023-07-24 09:48:48 +00:00
Nikita Bobko 4f3ecedbca [FE] Stop ignoring ABSTRACT_MEMBER_NOT_IMPLEMENTED for expect classes
^KT-59739 Fixed
Review: https://jetbrains.team/p/kt/reviews/11038/timeline
2023-07-24 09:15:11 +00:00
Roman Efremov d2eb4a0abf [FE] Prohibit default arguments in expect declarations actualized via typealias
Cases when default argument inhertied from super class are allowed.

Some tests for default arguments already exist and can be found in
`testData/diagnostics/tests/multiplatform/defaultArguments`, for example
`annotationsViaActualTypeAlias.kt`.

^KT-57614 Fixed

Merge-request: KT-MR-10356
Merged-by: Roman Efremov <Roman.Efremov@jetbrains.com>
2023-05-31 13:14:37 +00:00
Roman Efremov 439cc88525 [FE] Prohibit expect external and expect tailrec
^KT-58536 Fixed
2023-05-23 12:43:51 +00:00
Roman Efremov 456d3e0f42 [FE] Prohibit expect fun interface to have non-fun actual counterpart
In K1 .isFun is always false for Java classes, so extra check
is added for that. This is not needed for K2, because .isFun is
true for all Java classes. Here it is not necessary to check
that interface has only one method, because such check will be
done in the place where interface implementation is created.

^KT-39362 Fixed
2023-04-05 07:31:58 +00:00
Artem Kobzar 4da81b2b6e [K/JS] Remove an internal system property and replace it with the new compiler flag 2023-03-17 12:38:34 +00:00
Artem Kobzar eb2326eabb [K/JS] Add ability to exclude declarations from export by a new annotation @JsExport.Ignore. 2022-10-03 11:07:25 +00:00
Ilya Goncharov c726360ad2 Change policy with legacy compiler backend
[JS] Remove incremental js jps test

[JS] Remove test of maven js archetype

[JS] Fix another one test

[JS] Fix tests for jps

[JS] Try to fix maven test data

[JS] Fix test data

[JS] Fix test data for ant

[JS] Fix jsExtraHelp test

[JS] Fix test run from not-Gradle build tools

[JS] Set flag without compiler error

[JS] Disable warnings and errors in legacy compiler called from Gradle

[JS] Proofread messages

[JS] Not proofread messages

KT-42326
2022-09-29 13:56:30 +00:00
Ilya Goncharov bf8681296b [Gradle, JS] IR by default and report warnings for using legacy compiler
- just legacy - report warning about deprecation
- both - report warning about deprecation of legacy
- no compiler explicitly chosen - error about explicit setting compiler

warn from cli legacy compiler

nowarn flag - kotlin.js.compiler.nowarn

KT-42326
KT-53074
2022-09-16 09:48:41 +00: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
Stanislav Erokhin 748a2d2e7c [MPP] Performance optimization in expect/actual checker
Previously, the checker executed for every declaration i.e. every
declaration was considered as expect declaration. Because of that in
some cases this checker could eat 6% of compilation time.
After this commit only declarations marked with expect or actual
are checked. To achieve that, logic, that do reporting about missing
actual modifier was moved to the Actual part.

Please note, that in cases where there is no expect/actual modifier at
all other errors (like redeclaration and missing body on "actual"
declaration) would be reported.

Useful nodes:
- In this checker reportOn is always the same as
descriptor.sourceElement.ktElement. This is because the only case when
it isn't true is PropertyAccessors and they are filtered
- Annotation constructor descriptor isActual == true all the time
- previously for weak incompatible members ACTUAL_MISSING
was not reported
- the logic here is super complicated and crazy, but I don't think that
there is sense to refactor it in the old FE
2021-08-04 15:19:34 +03:00
Mikhail Glukhikh d8417fd622 Introduce -opt-in stable compiler option instead of -Xopt-in
#KT-47099 Fixed
2021-07-12 21:26:18 +03:00
Ilmir Usmanov cf73f182c7 Minor. Change warning message 2021-03-31 09:04:35 +03:00
Ilmir Usmanov d67e4f0c48 Rename inline class -> @JvmInline value class in stdlib and compiler 2021-02-25 16:06:51 +01:00
Dmitriy Novozhilov af94bcebea [IDE] Propagate KotlinFacetSettings version and completely drop isReleaseCoroutines flag
Also this commit removes number of tests related to support
  experimental coroutines
2021-01-12 16:47:55 +03:00
Dmitriy Novozhilov cc1a0bf6d7 [FE] Update testdata 2020-11-28 14:25:57 +03:00
Dmitriy Novozhilov eeb9b3214c Switch to 202 platform 2020-11-28 14:25:19 +03:00
Alexander Dudinsky 36dd883768 Update testData of testKt28385 for 202 version 2020-10-14 12:15:07 +03:00
Ilya Chernikov 69d5635aae [minor] Fix textdata after reapplying commit w\ CompilerMessageLocation 2020-06-09 10:34:38 +02:00
Ilya Chernikov 994897cee9 Fix textdata after reverting a commit about CompilerMessageLocation 2020-05-20 10:37:56 +02:00
Alexander Udalov 4597fff18a Prohibit OptionalExpectation on nested annotation classes
Because the new generation scheme based on module metadata does not
support them, and we don't plan to have them in the standard library
yet.
2020-05-12 19:28:58 +02:00
Ilya Muradyan d2fec96f38 Add new REPL API JVM implementation 2020-04-16 21:16:08 +02:00
Mikhail Zarechenskiy 9607739d30 Introduce synthetic scope for constructors of fun interfaces
#KT-37434 Fixed
2020-04-15 02:37:34 +03:00
Mikhail Zarechenskiy d1a8f57740 Disable New Inference in JS backend
See #KT-37163 for details
2020-03-02 18:03:41 +03:00
Mikhail Zarechenskiy 00469712d1 [NI] Don't use only platform specific checks for FIC in inference 2020-01-27 11:03:55 +03:00
Alexander Udalov 7742a3b697 Rename UseExperimental->OptIn, Experimental->RequiresOptIn in compiler tests 2020-01-14 21:04:42 +01:00
Leonid Startsev 1ed4930a2e Fix failing tests after 395d595b 2019-10-11 14:24:51 +03:00
Dmitry Savvinov 3989f351ff Use modules instead of files for MPP diagnostic
Using files turned to be a bad idea, because people often
use the same name for files with expects and with corresponding actuals.

This commits disambiguiates ambiguous message for
AMBIGUOUS_ACTUALS/AMBGIUOUS_EXPECTS diagnostics by using modules instead
of files

^KT-32582 Fixed
2019-10-02 16:52:40 +03:00
Dmitry Savvinov 4694a7963b Allow actuals with more permissive visibility
Allow non-virtual expects to have actuals with more permissive
visibility.

^KT-19664 Fixed
2019-01-31 12:29:27 +03:00
Dmitry Savvinov f174ee863d Don't run ExpectedActualDeclarationChecker on property accessors
One might think that it shouldn't be run because of 'if (declaration
!is KtNamedDeclaration) return' check in the 'check'-overload.

However, for default accessors we pass PSI for property, i.e.
KtProperty (see 'DeclarationCheckers.checkAccessors'), which
obviously passes this check

Note that we can't use `DescriptorToSourceUtils` here, because it's
returns `KtProperty` for default accessor too.

This commits adds specific check for that case, to avoid exception in
KT-28385. Ideal solution would be to either don't launch checkers on
such parameters, or explicitly declare semantic of the
'declaration'-parameter, e.g. to rename it to 'reportOn' (see KT-28403
for discussion)

^KT-28385 Fixed
2018-12-05 11:50:35 +03:00
Dmitry Savvinov 415fcf70e9 Add test on incomplete code in MPP
Currently, the behavior is undesired. See the next commit for the fix

^KT-28385 In Progress
2018-12-05 11:50:35 +03:00
Mikhail Glukhikh cb92009862 Fix maven build + ~50 compiler tests broken by UNUSED_PARAMETER in main 2018-10-26 19:51:20 +03:00
Denis Zharkov 956f8ad5e9 Support deserialized contracts in common code
#KT-26687 Fixed
2018-09-17 12:48:42 +03:00