Commit Graph

6896 Commits

Author SHA1 Message Date
Brian Norman 833072e1fb [FIR] Add checker for MISSING_DEPENDENCY_CLASS
#KT-59371 Fixed
2023-08-28 15:00:04 +00:00
Nikolay Lunyak 13a7bb95b3 [FIR] Relax MULTIPLE_DEFAULTS_* to account for the K1 behavior
^KT-56442
^KT-36188
2023-08-28 10:57:40 +00:00
Nikolay Lunyak 3f1bf6112f [FIR] Report MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES
Reporting it for `VIRTUAL_MEMBER_HIDDEN`
is ok, because `VIRTUAL_MEMBER_HIDDEN`
has always been an error, so we are
allowed to treat these as overrides
implicitly.

^KT-59408 Fixed
^KT-59419 Fixed
^KT-57076 Fixed
2023-08-28 10:57:40 +00:00
Mikhail Glukhikh 3e330241b4 K1/K2: add a test to fix state of KT-55168 2023-08-28 09:40:26 +00:00
Ivan Kochurkin d9b5d37baf [K2, MPP] Forbid matching actual callable with dynamic return type
to expect callable with non-dynamic return type

^KT-59251 Fixed
2023-08-28 09:29:05 +00:00
Kirill Rakhman c30ce4aabe [FIR] Print operator keyword and token to unresolved diagnostic message
#KT-55672 Fixed
2023-08-28 08:12:25 +00:00
Kirill Rakhman 85bb7faf10 [FIR] Report WRONG_NUMBER_OF_TYPE_ARGUMENTS on typealias in super types
#KT-59893 Fixed
2023-08-28 08:02:31 +00:00
Stanislav Ruban 44a4c4ee1c [tests] BI (1P&1TV/1TIO): add tests for target types
single builder parameter
single postponed type variable
single origin of type information

relevant issues:
KT-60719
KT-60720
KT-60855
KT-60877
KT-60880
2023-08-25 14:01:56 +00:00
Nikolay Lunyak 77feb86a85 [FIR] Report the use of inline on primary constructor parameters
^KT-59664 Fixed
2023-08-25 12:23:56 +00:00
Ilya Chernikov b821009617 K2: add missing checks for integral parameter type on implicit coercion
#KT-61418 fixed
#KT-61442 fixed
#KT-61441 fixed
2023-08-25 08:55:58 +00:00
Anastasia.Nekrasova aef6787e87 [Test] Add a test covering changes in the evaluation semantics of safe call with smart cast in K2
Addition to other safe call tests that are already present in tests.

^KT-41034
2023-08-24 11:38:13 +00:00
Kirill Rakhman 8de36c416e [RAW FIR] Put destructuring statements outside of main lambda block
This fixes a false positive REDECLARATION when you want to shadow
a destructured lambda parameter inside the lambda.

#KT-60771 Fixed
2023-08-24 11:07:45 +00:00
Kirill Rakhman 8d7c5b375e [FIR] Replace usages of FirExpression.typeRef with coneTypeOrNull
#KT-59855 Fixed
2023-08-24 07:54:57 +00:00
Nikolay Lunyak 82c18ff26b [FIR] Report NON_MEMBER_FUNCTION_NO_BODY
^KT-59944 Fixed
2023-08-24 07:49:20 +00:00
Roman Efremov 6b217369a8 [FE1.0] Fix false reporting of non-matching annotations in IDE...
...when typealiased expect class used in class literal.

^KTIJ-26700 Fixed
2023-08-23 13:15:20 +00:00
Roman Efremov 77ab13400e [FE1.0] Fix false reporting of non-matching actual annotations in IDE
It was reported because in composite module analysis we have both expect
and actual annotation descriptors, which may differ.
This may lead to bugs in the checker of ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT
diagnostic.

`fqName` comparison can be safely removed, because we already check
types in `areCompatibleExpectActualTypes`.

Tests:
- typealiasedAnnotation.kt - for annotation use (so it has different
ClassId)
- typealiasedAnnotationAsArgument.kt - when typealiased annotation
used in another annotation as argument
- sourceRetentionAnnotationsWhenTypealias.kt - tests same as
compiler/testData/diagnostics/tests/multiplatform/annotationMatching/sourceRetentionAnnotationsWhenTypealias.kt

No special test added for opt-in, because it's prohibited to have
expect/actual opt-ins by EXPECT_ACTUAL_OPT_IN_ANNOTATION checker.

^KTIJ-26700
2023-08-23 13:15:20 +00:00
Nikolay Lunyak 6e732f2f4d [FIR] Report NON_SOURCE_ANNOTATION_ON_INLINED_LAMBDA_EXPRESSION
^KT-59422 Fixed
2023-08-23 12:39:23 +00:00
Nikolay Lunyak ed6a0af0a6 [FIR] Report DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE
^KT-59418 Fixed
2023-08-23 12:38:38 +00:00
Nikita Bobko c42d19f0e5 Cover KT-60646 with regression tests
This behavior wasn't intended during KT-15470 coding. I only intended to
prohibit `@get:` target on things different from properties. But I
accidentally prohibited `@property` on things different from properties
too

But it's a bug fix anyway, so let's keep it.

I also re-checked the implementation of KT-15470, I don't see any other
unintentional prohibitions
2023-08-23 12:35:51 +00:00
Ilya Chernikov 85ca5294ef K2: add test for already fixed missing diagnostic issue
#KT-55956
2023-08-23 09:40:45 +00:00
Ilya Chernikov 4b7234d27e K2: add test for already fixed qualifier resolve issue
#KT-57845
2023-08-23 09:40:44 +00:00
Dmitrii Gridin 3debf36d60 [FIR] DFA: add missing unwrap for FirDesugaredAssignmentValueReferenceExpression
^KT-60319 Fixed
^KT-61407 Fixed
2023-08-23 09:15:25 +00:00
Kirill Rakhman 27d25b90b1 [Tests] Fix test data 2023-08-22 16:06:24 +00:00
Roman Efremov def4388c19 [FE, IR] Check annotations on expect and actual enum entries
^KT-60668
^KT-60936
2023-08-22 12:14:43 +00:00
Roman Efremov b57940a59b [FE1.0] Optimize search of expect class member in annotation checker
In the following scenario, when we search corresponding expect member
for actual `A.B`, we can skip checking compatibility of `B` scope.
```
class A {
  class B {
    fun foo() {}
  }
}
actual typealias AImpl = A
```

This is because:

1. Annotation checker runs no matter if found expect class is compatible
or not.
2. Class always has at most one corresponding `expect` class (unlike for
functions, which may have several overrides), so we are sure that we
found the right member.

^KT-60668
^KT-60936
2023-08-22 12:14:43 +00:00
Roman Efremov f1ea6545eb [IR] Fix incorrect position of reporting with fake overrides inside actual
^KT-60668
^KT-60936
2023-08-22 12:14:42 +00:00
Roman Efremov 58a30d524c [IR] Fix positioning of actual annotations diagnostic when reported on value
`parentsWithSelf` returns empty sequence if receiver is not a
`IrDeclarationParent`.

^KT-60668
^KT-60936
2023-08-22 12:14:42 +00:00
Roman Efremov ab1c0e3c48 [FE] Check annotations on actual class members including fake overrides
^KT-60668
^KT-60936
2023-08-22 12:14:42 +00:00
Mikhail Glukhikh 27afee8683 K2: generate bounds for inner-class based raw types properly
#KT-58579 Fixed
2023-08-22 11:40:26 +00:00
Mikhail Glukhikh 4e2067a163 K2: reproduce KT-58579 2023-08-22 11:40:25 +00:00
Mikhail Glukhikh 9846ec23df Raw FIR: generate 'return setValue' instead of just 'setValue'
#KT-61045 Fixed
2023-08-22 11:20:19 +00:00
Nikita Bobko ccfbb5f77a [FE] Don't issue a deprecation warning for open val deferred init when the property is unconditionally effectively final
^KT-61228 Fixed
Review: https://jetbrains.team/p/kt/reviews/11694/timeline
2023-08-22 10:15:22 +00:00
Nikolay Lunyak c33f1cda69 [FIR] Report MISSING_CONSTRUCTOR_KEYWORD
^KT-59407 Fixed
2023-08-22 09:13:16 +00:00
Roman Efremov 673b4b4d52 [FE] Add OptIn annotation to whitelist of annotation checker
It's valid to have `@OptIn` only on `expect` declaration.

^KT-61373
2023-08-22 09:02:20 +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
Kirill Rakhman d0cc86f52c [Tests] Update test data after changes to FIR diagnostic messages 2023-08-21 16:28:48 +00:00
Kirill Rakhman fa77e3952d [FIR] Bring equivalent call behavior closer to K1
#KT-61159 Fixed
2023-08-21 12:11:58 +00:00
Nikolay Lunyak 73b4a81663 [FIR] Forbid complex boolean expressions
Disabling the language feature is supported,
otherwise there are too many tests that
would need to be updated to account for
K2's inability to do it.

The `ifConstVal.kt` test is deleted,
because now it must also be ignored in K2,
and since it is ignored for both the
frontends, and the ignored backends
include all the target backends, this test
is basically unused.

Note that now both the frontends report
`CONST_VAL_WITH_NON_CONST_INITIALIZER`.
for `condition`.

^KT-55196 Fixed
2023-08-18 15:16:13 +00:00
Nikolay Lunyak f9c6af4d2a [FIR] Properly assign <local> packages to symbols
This prevents `FirConflictsExpressionChecker.kt`
from missing conflicting local functions. It used
to due to inconsistencies in assigning `<local>`,
and this commit makes it a bit more
straightforward.

The change in KtClassTypeQualifierRenderer
prevents `FirOverrideImplementTest.testLocalClass`
from failing in `intellij`. It didn't fail for
callables, because `KtCallableSignatureRenderer`
doesn't try to render packages.

^KT-59186 Fixed
2023-08-18 13:31:04 +00:00
Nikolay Lunyak cf655fd5ad [FIR] Report CONFLICTING_OVERLOADS for local functions
^KT-59186 Fixed
2023-08-18 13:31:04 +00:00
Kirill Rakhman 5b9c35de2e [Tests] Update test data with error suppression warnings
#KT-61129 Fixed
2023-08-18 13:29:20 +00:00
Kirill Rakhman 3255bcfbee [FIR] Add tests for #KT-54670 2023-08-18 13:08:25 +00:00
Nikolay Lunyak f674529558 [FIR] Report MIXING_SUSPEND_AND_NON_SUSPEND_SUPERTYPES
^KT-59367 Fixed
2023-08-17 21:45:42 +00:00
Kirill Rakhman 640d1e3fc8 [FIR] Fix augmented array set call on smartcasted receiver
#KT-60917 Fixed
2023-08-17 15:13:38 +00:00
Nikolay Lunyak dc9ed5656e [FIR] Revert FirMultipleDefaultsInheritedFromSupertypesChecker
It's possible to write a fix that
would prevent false positives with
this checker, but the core
intuition behind it is invalid.

This checker assumes that it's
enough to only check direct
overriddens, while in reality
even simple `Source` override
functions are not allowed to
contain default values, so they
can't be used to make judgements
about them.

^KT-59408 Open
^KT-59408 Open

^KT-61095 Fixed
^KT-61165 Fixed
^KT-61029 Fixed
2023-08-17 13:55:19 +00:00
Ilya Kirillov c963eadb44 [Analysis API FIR] fix KtSymbol creation for _ destructuring parameter
We need to have a corresponding declaration in the FIR tree,
so we can create a symbol for it

^KT-60904 fixed
^KT-60904 fixed
2023-08-17 13:01:02 +00:00
Vladimir Sukharev 8f03eb9314 [K/N] Fix stdlib import in DiagnosticsNativeTests
Merge-request: KT-MR-11635
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-08-16 08:27:16 +00:00
Nikolay Lunyak 97bbf69bdc [FIR] Don't ignore annotations on when subjects
^KT-53565 Fixed
2023-08-16 08:09:14 +00:00
Nikita Bobko 577d0db3f1 [FE] Skip delegation descriptors during default params matching
^KT-61163 Fixed
Review: https://jetbrains.team/p/kt/reviews/11599/timeline

They can be safely skiped because we check overridden descriptors
anyway.

IMO, it's a bug that delegated descriptors are copied with default
params. But it's much harder problem, and my IMO can easily be wrong for
some weird reason.
2023-08-15 16:34:23 +00:00
Kirill Rakhman 80200fc3c5 [FIR] Replace type variable types with error types in lambda completion
#KT-54568 Fixed
#KT-59882
2023-08-15 08:04:19 +00:00