Commit Graph

109733 Commits

Author SHA1 Message Date
Alexander.Likhachev 99e13318dc [BTA tests] Allow passing strategy config once to Project instance
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev f634f9dacf [BTA tests] Get BTA implementation version via the API
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 3f6b5ae86d [BTA tests] Introduce BaseTest providing CompilationService instance
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev cf8e65b3c5 [BTA tests] Specify TestDataPath/TestMetadata test data navigation
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev b970b87667 [BTA tests] Split compatibility tests and business logic test suits
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 8051fa56f2 [BTA tests] Split test infra and actual tests
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev b5fbb3f925 [BTA tests] Introduce shortcut assertion expectFailWithError
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 16a07e82bc [BTA tests] Add KDoc to clarify meaning of some symbols
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 60ccdf0e2c [BTA tests] Add example tests
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 15a24319d5 [BTA tests] Add README.md
Also rename `default` to `snapshot` in the test suit names
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 2347f732db [BTA tests] Rename the compatibility tests annotation
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 2a3cc758cf [BTA tests] Add a way to customize IC options
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 74e5b4d844 [BTA tests] Make the module scenario DSL cache key explicit
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 3466153668 [BTA tests] Cache compiled modules in scenario DSL tests
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 566d9852a3 [BTA tests] Finish project compilation after a test
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev a234e4149b [BTA tests] Add scenario DSL for writing typical IC tests
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 7141b4dcbb [BTA tests] Add base assertions DSL
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev c952d74f7c [BTA tests] Implement basic infrastructure for compilation tests
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 90fee75eba [Build, BTA] Add the Build Tools API tests to the aggregate tasks
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 4afb393ff1 [Build, BTA] Add the build tools api tests module
The module is configured to run a bunch of test suites defined as API pairs. Currently those are `CURRENT API` – `CURRENT IMPL`, `CURRENT API` – `1.9.20 IMPL`, `1.9.20 API` – `CURRENT IMPL`
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev 0196928af7 [BTA] Add debug logging about the used compilation strategy
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Alexander.Likhachev dda6b92c13 [BTA] Fix incorrect default value for IncrementalJvmCompilationConfiguration.outputDirs
^KT-61860 In Progress
2024-03-09 01:36:22 +00:00
Anna Kozlova 943d829fa7 [AA] treat named arguments as write access
^KTIJ-16835 fixed
2024-03-08 22:12:25 +00:00
Pavel Kunyavskiy 1222ef7fac [IrFakeOverrideBuilder] Do not compute signatures in Fir2IR
No one need them, while it requires significant time usage

^KT-66281
^KT-66441 Fixed
2024-03-08 21:36:59 +00:00
Anton Lakotka 5779465366 [Gradle] Don't resolve platform classpath configuration consistently ...
... with metadata dependencies. As it can cause unexpected version
downgrades.

This change restores behavior that existed previous versions. While
the separation between different source set trees remained.

The proper implementation should be done as part of KT-66375.

Related tests that were verifying the fact that platform dependencies
are also resolved consistently is ignored with reference to KT-66375

^KT-66372 Verification Pending
^KT-66154 Verification Pending
^KT-66375
2024-03-08 17:50:09 +00:00
Ilya Goncharov c3a0a41524 [Wasm] Use named imports in test-loader, runUnitTests generating into static dir
KT-65777
2024-03-08 16:30:24 +00:00
Ivan Kylchik c07781326b [K2] Remove performanceManager from CompilationContext 2024-03-08 15:58:33 +00:00
Ivan Kylchik 1eabff337d [K2] Move Generation perf calculation inside generateCodeFromIr
1. We don't need to include `GenerationState` initialization time
2. We don't need to include diagnostic reporting time
2024-03-08 15:58:33 +00:00
Ivan Kylchik fd961452b3 [K2] Move IRTranslation perf calculation inside convertToIr* methods 2024-03-08 15:58:33 +00:00
Ivan Kylchik 8275c92cd4 [K2] Move Analysis perf calculation inside corresponding fronted runner
This way it is easier to understand where `notifyAnalysis*`
methods were called. Also, in K1, we are not including
`checkKotlinPackageUsageFor*` in the analysis time.
2024-03-08 15:58:33 +00:00
Ivan Kylchik cbda22ab48 [K2] Don't include IRTranslation time as total Generation time
Such behavior is more on par with K1.

#KT-65094 Fixed
2024-03-08 15:58:33 +00:00
Dmitrii Gridin de74ca5902 [FIR] FirLocalVariableAssignmentAnalyzer: do not try to propagate empty information
`recordAssignments` merges properties into all parents which is
redundant work in the case of empty `VariableAssignments`.
This redundant work leads to critically poor performance in cases
with many local declarations.

^KT-66416 Fixed
2024-03-08 15:39:17 +00:00
Nikolay Lunyak 405852980d [FIR] Prohibit is-checks and casts for unrelated nullable types
This decision was made after a discussion
in Slack.
2024-03-08 15:37:45 +00:00
Nikolay Lunyak a4c33ee785 [FIR] Reuse shouldReportAsPerRules1() in FirCastOperatorsChecker
This change better aligns the checker with
the description in KT-57779.

^KT-57779
2024-03-08 15:37:45 +00:00
Nikolay Lunyak 4c0ec0fae4 [FIR] Remove redundant checks from isUpcast() and isExactTypeCast()
`T.() -> R` and `(T) -> R` should only be
different for resolution, but casts are only
about typechecking. Values of either of
these types can always be put into variables
of the other type.
2024-03-08 15:37:45 +00:00
Nikolay Lunyak fbdf7e33bd [FIR] Ensure KT-50293 is no longer a problem
PCLA-related changes led to this change in
behavior. In K1 an explicit cast was needed
to prevent ORA, but now in K2 this code
is green without casts.

^KT-50293 Obsolete
2024-03-08 15:37:45 +00:00
Nikolay Lunyak a5423032a3 [FIR] Remove an always false condition from replaceType()
Otherwise, bootstrapping fails.

This condition is `false` because of
`require(this is ConeKotlinTypeProjection)`,
since `ConeKotlinTypeProjection` is its
sibling, not a subtype.
2024-03-08 15:37:45 +00:00
Nikolay Lunyak 4cdddb1b08 [FIR] Unify checks for is and as 2024-03-08 15:37:44 +00:00
Nikolay Lunyak 88ff93df7f [FIR] Check is for impossibility
^KT-58203 Fixed
^KT-62646
2024-03-08 15:37:44 +00:00
Nikolay Lunyak 92d8da621e [FIR] Merge the two type operator checkers into a single one
This way it's easier to reason about where
useless casts/is checks come from, because
everything is on the same screen.

`USELESS_CAST` disappeared from
`FirPsiJsOldFrontendDiagnosticsTestGenerated.testDynamicCastTarget`
because
`LanguageFeature.EnableDfaWarningsInK2`
is disabled, and previously it only
affected `FirCastOperatorsChecker`, but
not `FirUselessTypeOperationCallChecker`,
which felt like an unintended mistake.
A related issue: KT-50965
2024-03-08 15:37:44 +00:00
Nikolay Lunyak 116ff60325 [FIR] Extract isRefinementUseless() to casting helpers 2024-03-08 15:37:44 +00:00
Nikolay Lunyak fab6cec93a [FIR] Utilize equality compatibility logic for cast checks
This makes it more consistent and fixes some
overlooked corner cases. Also it was decided
on the last equality applicability DM
(KT-62646) that we'd like
`is`/`!is`/`as`/`as?` to work similarly
to `===`/`!==`.

Also note that it now gives a clearer
explaination of why some corner cases work
the way they do. For example,
`FirPsiDiagnosticTestGenerated.testLambdaInLhsOfTypeOperatorCall`
yields `UNCHECKED_CAST` instead of
`CAST_NEVER_SUCCEEDS`, because
`toTypeInfo()` replaces all type arguments
with star projections, even when the argument
is not a type parameter. This is because
it has been desided to work this way in
KT-57779.

In
`FirPsiOldFrontendDiagnosticsTestGenerated..NeverSucceeds#testNoGenericsRelated`
the diagnostic is introduced, because
`t2 as FC1` and `FC1` is a final class with
no `T5` supertype.

`UNCHECKED_CAST` in
`FirPsiOldFrontendDiagnosticsTestGenerated.testSmartCast`
disappeared, because previously we didn't
take smartcasts into account.

Note that
`FirPsiOldFrontendDiagnosticsTestGenerated.testMappedSubtypes`
is a false positive. It appears because `isSubtypeOf()` doesn't
take into account platform types in supertypes of the given types
(doesn't map them).
2024-03-08 15:37:44 +00:00
Nikolay Lunyak a5e43c9e3f [FIR] Remove a strange check from ArgumentInfo.smartCastType
Most probably it was there just to guarantee
that if `argument` is not a smartcast
expression then this property is exactly the
same thing as `originalType`, but it seems
there's not much point in that as none of
the tests fail.
2024-03-08 15:37:44 +00:00
Nikolay Lunyak 5ce3812f39 [FIR] Move some functions from the equality checker into a separate utils file
They will be used later for casts
2024-03-08 15:37:44 +00:00
Nikolay Lunyak cd3202ddd4 [FIR] Map platform types to Kotlin for equality checks
During the DM it was decided to support
such comparisons, if I remember correctly.

^KT-62646
2024-03-08 15:37:44 +00:00
Nikolay Lunyak 6607c8a056 [FIR] Allow Int? === null
It was decided to allow this comparison
duting the last DM.

^KT-62646
2024-03-08 15:37:44 +00:00
Nikolay Lunyak 4abfb2534a [FIR] Add the Int? === null test example
^KT-62646
2024-03-08 15:37:44 +00:00
Nikolay Lunyak a19994b8b6 [FIR] Rename canHaveSubtypes() and lowerThanBound() in K2
`lowerThanBound()` was renamed to:

- draw attention to its corner cases
- make its single usage less cryptic

We may want to reserve the pretty name for
a function that, for example, returns `true`
if `argument` suits all the bounds.

Similarly, `canHaveSubtypes()`
does some questionable logic in case of
`INVARIANTxINVARIANT`: some hypothetical
`Inv<Foo>` doesn't have subtypes so
checking "Foo has subtypes strictly above
Nothing || Foo has supertypes strictly below
the parameter bounds" doesn't seem correct.
`Foo` may have some, but `Inv<them>` are
not related to `Inv<Foo>`.
2024-03-08 15:37:44 +00:00
Nikolay Lunyak bb812add14 [FIR] Don't miss modality of anonymous objects in canHaveSubtypes()
They are not `FirRegularClassSymbol`, but are
final. `FirClassSymbol` is enough, because
`toSymbol()` returns `FirClassifierSymbol`, and:

- type parameters are always expected to have
  subtypes
- typealiases have been expanded in the
  previous line
2024-03-08 15:37:44 +00:00
Nikolay Lunyak 226d4df277 [FIR] Forbid erroneous ===-checks
It was decided to forbid such comparisons,
as we know how `===` works. Also, added some more
test cases, just for comparison.

Reusing the proper `canHaveSubtypes()`
from `TypeUtils` prevents a breaking change
in:

- `comparingTripleWithPair.kt`
- `comparisonOfGenericInterfaceWithGenericClass.kt`

But it does lead to warnings
(instead of errors) in
`incompatibleEnumEntryClasses.kt`, which is an
unrelated mistake that will be fixed in the next
commit.

The refactoring in `canHaveSubtypes()` is purely
cosmetic - otherwise reading these conditions is hard
(and they don't fit my screen vertically).

^KT-62646
^KT-65541
^KT-57779
2024-03-08 15:37:44 +00:00