`getOrCreateXxx` methods have not very safe semantics: they sometimes
create an IR declaration if it was missing in caches before. For all
source declarations, this is not very good semantic, because we have
strict rules in which order source declarations should be created,
and usage of `getOrCreateXxx` may break this order.
So it's important to be able to track all invocations of such methods
to ensure that it's appropriate in each case.
To achieve that, a new `@GetOrCreateSensitiveAPI ` opt-in is introduced
Frontend may leak captured types into type arguments, so they should be
approximated before using them in fir2ir cast inserter to determine
a specific type from smartcast
^KT-62863 Fixed
The compiler had some code that looked for the same tools and files
in toolchains at different relative paths depending on the platform.
This commit improves that code by including `usr/` into the path to
the toolchain on macOS, which allows to unify the relative paths
inside the toolchains.
Co-authored-by: Johan Bay <jobay@google.com>
This change adds a Native Obj-C launcher that implements XCTestCase
and overrides defaultTestSuite property to provide XCTest with generated
test suites and test cases.
The defaultTestSuite method is essentially a starting point with runtime
initialization. It requires a `Konan_create_testSuite()` method to be
implemented in a Kotlin library that returns a list of XCTestCases.
This launcher should be compiled as a TEST_BUNDLE to be used then with
XCTest.
This commit is a part of ^KT-58928
Co-authored-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
Merge-request: KT-MR-12841
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
This is required for some checks on call site, and it seems that
this symbol can cover all cases.
One of the examples why this API was introduced is a request to
distinguish which vararg parameter is missed in arguments
of an annotation call from symbol light classes
^KT-62560
If the right-hand side of an equality comparison contains an assignment
to the variable used in the left-hand side, then implications about the
equality comparison within data-flow analysis cannot be applied, as the
value of the variable will be different after the comparison.
^KT-55096 Fixed
that causes flaky tests because the default positioning strategy
was dependent on the order of the reported messages.
The code led to it was introduced in an attempt to extract common
PSI-independent strategy because PSI is leaking into the abstract
diagnostic infrastructure. The approach is definitely problematic,
but to fix it now, the leaking dependency to the psi-based module
is introduced. This should be fixed in the future by introducing
better abstractions.
Fixes flaky tests touched in the commit.
#KT-63002 fixed
This test can be used to make small performance measurements of
the core commonizer on occasional basis. This test is not intended
for regular execution, e.g. at the CI server.
^KT-63159
"data objects" is only available since language version 1.9. But we should not use LV 1.9, because it is used in the Gradle build classpath and would be incompatible with Gradle Kotlin runtime.
Then only manually override equals/toString/ works here.
#KT-61657 Fixed
Merge-request: KT-MR-12759
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
- KT-62397 occurs in the IDE because enum entry symbols from libraries
are deserialized from stubs, which currently produce
`FirFromMissingDependenciesNamedReference`.
- During opt-in usage checks, the compiler only considered resolved
references when getting the severity name, but we can just take the
name from the `FirFromMissingDependenciesNamedReference`.
^KT-62397 fixed
The cleanup became possible after KT-62590
Review: https://jetbrains.team/p/kt/reviews/12750/timeline
`matchingCompatibilityToMembersMap.allMismatches()` is equivalent to
`ExpectActualMatchingCompatibility.MatchedSuccessfully !in
matchingCompatibilityToMembersMap`
The cleanup became possible after KT-62590
Review: https://jetbrains.team/p/kt/reviews/12750/timeline
incompatibility.allMismatches() always returns true for
mismatchedMembers => hasSingleActualSuspect always returns false =>
filterNot doesn't have any effect
incompatibility.allMismatches() always returns false for
incompatibleMembers => incompatibility.allMismatches() is redundant
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
Review: https://jetbrains.team/p/kt/reviews/12750/timeline
`AbstractExpectActualChecker` works on pairs obtain from
`AbstractExpectActualMatcher` and the last one always returns single
actual for single expect. That's why handling of multiple actuals
doesn't make sense
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
Those two functions are copy-paste of each other. They diverged since
the time they were copy-pasted. This commit makes
FirExpectActualMatchingContextImpl.areCompatibleExpectActualTypes
up-to-date.
I didn't update ExpectActualUtilsKt.areCompatibleExpectActualTypes
because I will drop it in the next commit.
Change in `dynamicTypesEqualToAnything` doesn't change any logic (yet.
This change in logic will take effect in the next commit), because:
1. `dynamicTypesEqualToAnything` is only changed in
AbstractExpectActualChecker.getCallablesCheckingIncompatibility. But
AbstractExpectActualChecker.getCallablesCheckingIncompatibility doesn't
check return types on frontend (it only check return types on backend).
2. `dynamicTypesEqualToAnything` is ignored on IR backend
I have no idea what is the difference between `createTypeCheckerState()`
and `actualSession.typeContext`, but it aligns these copy-pasted
versions and makes the tests behave like in K1 (at least
'typeUsageWithUnresolvedReference' and 'kt57320' are affected)
This commit is mainly a preparation for the next commit.
Review: https://jetbrains.team/p/kt/reviews/12750/timeline
- getCallablesStrongIncompatibility is unused (because it moved to the
"matcher" KT-62590)
- `checkClassScopesCompatibility` parameter is always `true` or unused
Review: https://jetbrains.team/p/kt/reviews/12750/timeline
- Migrate ExpectActualCompatibility -> ExpectActualCheckingCompatibility
where the "checker" is expect
- Migrate ExpectActualCompatibility -> ExpectActualMatchingCompatibility
where the "matching" is expect
KT-62590 in progress. A lot of tests start to fail now. I will fix them
in next commits
Review: https://jetbrains.team/p/kt/reviews/12750/timeline