If there is an expression receiver, we should process constructors only
of inner classes. Constructors of nested classes can be called only
on classifier
^KT-65333 Fixed
This diagnostic is reported in rare situations when
StubTypeForBuilderInference is kept as a parameter type
of for loop or lambda. Before this commit, we had in K1
"Could not load module <error module>" from IrLinker instead.
Related to: KT-52757, KT-53109, KT-63841, KT-64066
#KT-53478 Fixed
... when the expected type is not a function type.
Instead set it to a new type variable.
This fixes a bunch of false negative CANNOT_INFER_PARAMETER_TYPE.
#KT-59882 Fixed
Generally the wrapping anonymous initializer can be used as a
"containing declaration" for some elements, but since the initialiser
for the last script expression could be dropped (the expression could
be converted to the result property), this may lead to the surprises,
e.g. as described in KT-65984
This fix marks the last initialiser as local, preventing it from being
referenced as "containing declaration".
#KT-65984
Otherwise, when analyzing
`PsiTypeParameterListOwner` in the
related test, we (after flattening and
`nonSubsumed()`) get 2 `JvmMember.accept`
from the same very java enhancement
scope `JvmMember`.
^KT-65972
After this change the IO created for
`SimpleColoredComponent::setToolTipText`
will be `containsMultipleNonSubsumed == true`
while IOs created for classes in
`intersectionOverridesIntersection.kt`
will have this property set to `false`.
^KT-65972 Fixed
Allow multiple bases with default
implementations as long as there's a
non-abstract symbol from a class.
Our rules for Kotlin are stricter than
those in Java.
Check all members for `Visibility.Unknown`,
otherwise we miss them when they come
from supertypes. This is the reason why
the FP intellij build failed with a
cryptic stacktrace instead of a
human-readable diagnostic.
Also, do report the diagnostic at all
cases of `Visibilities.Unknown`. Turns
out, there are no "simple to reason
about" situations here :(
Also, an interesting detail:
`retrieveDirectOverriddenOf` returns an
empty list for intersection overrides.
But this doesn't seem to break anything...
Replacing `CANNOT_INFER_VISIBILITY`'s
type `KtDeclaration` with
`PsiNameIdentifierOwner` and the related
changes in `PositioningStrategies`
were needed to prevent an exception saying that
`PsiClassImpl` is not a subtype of
`KtDeclaration`.
This code does lead to inferring
`Visibilities.Unknown`, but it's not
reported anywhere. This is because it
happens inside `AbstractIntSet` which
comes to us "pre-compiled" by javac,
whereas `FirOverrideChecker` only checks
members within `KotlinClass`.
^KT-65972
The rule of thumb is the following:
If the `if` and `when` can be successfully replaced with `while`,
then it is used as a statement, otherwise, it is used as an expression.
#KT-59883
In some cases we transform flexible type into non-flexible during
enhancement, but don't add `@EnhancedNullability` attribute to them,
which breaks consistency with K1 on IR level
This commit fixes it
^KT-65302
A class can inherit two declarations that are compatible from the
overridability standpoint and are therefore combined to a non-trivial
intersection.
At the same time, the class can declare a member declaration that
only overrides one of the intersection's members.
In this case, we break up the intersection and only add the overridden
parts to the declared member's direct overridden list.
If the class doesn't override the intersection, it exists as
intersection override, like before.
#KT-65487 Fixed
When a declaration with an ObjC annotation is stored in a different
module, the annotation arguments are not resolved by default. This leads
to a bug in the checker. Before attempting to find the objCName, it is
necessary to resolve the annotation first.
#KT-64276
`testIntersectionOfPrimitiveBasedFunctions`
is fine, because we deprecate this
already in ^KT-63243.
`CANNOT_INFER_VISIBILITY` is
positioned as `DECLARATION_NAME`,
just in case we decide for
some reason that we do want to
report it along with
`MANY_*_NOT_IMPLEMENTED`. In that
case, we'd get a problem that
their bounds overlap, but not
completely contain one another.
^KT-63741 Fixed
^KT-59400 Fixed
Even though SO may not be correct
overrides sometimes, it feels more
natural to treat fake overrides as...
well, "overrides". And without it
we'd need to make the code in
`FirOverrideChecker` less intuitive.
The change in
`FirOptInUsageBaseChecker` is needed
to prevent `OPT_IN_OVERRIDE` on
intersection overrides where one
of the base functions requires opt-in.
We never designed this in such
a way that it's an error.
See:
`FirPsiOldFrontendDiagnosticsTestGenerated.testIncorrectTargetsForExperimentalAnnotation`.
According to KT-63741, the case like
`kt40510.fir.kt` should, in fact,
be an error. It will be addressed
separately.
In general, overrides should not
contain default values, and it's
better to make fake overrides be close
to proper overrides as much as
possible. It will be important when
we begin running `FirOverrideChecker`
for fake overrides.
^KT-63879 Fixed
^KT-65534