Commit Graph

6074 Commits

Author SHA1 Message Date
Kirill Rakhman 9ea4afe7c8 [FIR] Fix isValidTypeParameterFromOuterDeclaration check for local class
This fixes an IllegalArgumentException when
symbolProvider.getClassLikeSymbolByClassId is called with a local
class ID.

#KT-63656 Fixed
2023-11-23 14:24:47 +00:00
Roman Efremov fa20eb73f2 [Tests] Don't ignore expected file if diagnostic output is empty
Because of this, `checkDiagnosticFullText.fir.diag.txt` was
obsolete, because nothing was reported, but test was green.

^KT-62559
2023-11-23 12:17:34 +00:00
Roman Efremov fcc6f873c7 [FIR] Prevent reporting ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT twice in CLI
It is duplicated because we have two checkers: FIR (for IDE support
in simple cases) and IR ("honest" checker supporting all cases).
Fix this by running FIR checker only in IDE.

FIR checker behavior remains covered by tests in
`LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated`.

^KT-62559 Fixed
2023-11-23 12:17:34 +00:00
Brian Norman c1f6fe1e76 [FIR] Do not include transitive friend dependencies in symbol provider
When flattening a dependency FirSymbolProvider, make sure transitive
dependency FirSymbolProviders are not included. This requires checking
that nested symbol provider sessions match the composite symbol provider
session when they are both source sessions.

^KT-60614 Fixed
2023-11-22 19:43:24 +00:00
Egor Kulikov 43fc4ccf40 [FIR] Source for implicit iterator calls in for should not be null
^KT-62111 fixed


Merge-request: KT-MR-13029
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-22 17:15:24 +00:00
Roman Efremov 6a90926e2e [K2] Support reporting of IMPLEMENTATION_BY_DELEGATION_IN_EXPECT_CLASS
^KT-59983
2023-11-22 16:40:06 +00:00
Nikolay Lunyak 427c067cd8 [FIR] Forbid typeRef-named labels without +ContextReceivers
^KT-63068 Fixed
2023-11-22 13:22:45 +00:00
Kirill Rakhman 865b8a4175 [FIR] Create special hidden override for Java signature clash due to rename
This fixes CharBuffer.get resolving to CharBuffer.charAt

#KT-61282 Fixed
2023-11-22 08:46:17 +00:00
Anastasia.Nekrasova fb0461f422 [K2] Disappeared UNSUPPORTED_FEATURE (3)
Added a check for the enabled context receivers feature flag for @ContextFunctionTypeParams.

^KT-59913
2023-11-22 06:04:13 +00:00
Anastasia.Nekrasova c04767f1f4 [K2] Disappeared UNSUPPORTED_FEATURE (2)
Added a check for the enabled context receivers feature flag for declaration.

^KT-59913
2023-11-22 06:04:13 +00:00
Anastasia.Nekrasova 685c8e4fe7 [K2] Disappeared UNSUPPORTED_FEATURE (1)
Added a check for the enabled context receivers feature flag for typeRef.

^KT-59913
2023-11-22 06:04:13 +00:00
Evgeniy.Zhelenskiy 67b1bb448a [FIR] Report repeating parameters in dynamic functions in Kotlin/JS
^KT-59988
2023-11-21 13:12:46 +00:00
Ivan Kylchik fd4a3a0b88 [FIR] Forbid to use equality and unsigned comparison in const expression
#KT-62683
2023-11-21 09:48:58 +00:00
Dmitrii Gridin 0b253dc815 [FIR] resolve delegate field return type in correct scope
We should resolve it in the same way as delegate constructor call
to avoid access to nested class scopes

^KT-63522 Fixed
^KT-63042
2023-11-21 08:11:21 +00:00
Dmitrii Gridin b3b184f00d [FIR] add more tests diagnostic tests on data and delegated classes
^KT-63522
^KT-63512
^KT-63042
2023-11-21 08:11:20 +00:00
Evgeniy.Zhelenskiy 9383d0bfa4 [FIR] Check type arguments in inner/outer local classes as in K1
^KT-59922 ^KT-59951
2023-11-20 20:04:45 +00:00
Mikhail Glukhikh 3b7f43a9c2 K2: don't throw an exception for type parameter case in isJavaTypeOnThePath
#KT-63569 Fixed
2023-11-20 15:35:58 +00:00
Evgeniy.Zhelenskiy f5168527ae [FIR] Report type-parameterized implicit invoke call over type-parameterized property access
^KT-59988
2023-11-20 14:59:06 +00:00
Evgeniy.Zhelenskiy 86c09a1c78 [FIR] Report recursive typealias when loop is in type annotations
^KT-59908
2023-11-20 14:39:47 +00:00
Dmitriy Novozhilov d85d671b26 [FIR] Update few MPP diagnostic tests
Updated tests contain errors which are incompatible with fir2ir conversion
  (like `PACKAGE_OR_CLASSIFIER_REDECLARATION` and `EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE`),
  so running fir2ir on such code may lead to exceptions
2023-11-20 13:36:27 +00:00
Mikhail Glukhikh 5cd3f8bb97 K2: don't report inline access errors on const properties in annotations
#KT-60604 Fixed
2023-11-20 10:32:05 +00:00
Mikhail Glukhikh bb8002d9f1 K2: reproduce KT-60604 2023-11-20 10:32:05 +00:00
Aleksandra.Arsenteva af63763da2 KT-62138 add testcases 2023-11-17 15:47:34 +00:00
Stanislav Ruban 196f5760f8 [tests] BI (1P&1TV/1TIO): add test data for sinks & sources of type information [1/X]
single builder parameter
single postponed type variable
single origin of type information

cover member properties as type info sinks;
cover extension functions as type info sinks;
cover extension properties as type info sinks;
cover extension functions as type info sources;
cover extension properties as type info sources;
cover input values of builder arguments as type info sinks;
cover input values of builder arguments as type info sources;
cover return types of builder parameters as type info sources;

relevant issues:
KT-61907
KT-61909
KT-63477
2023-11-17 07:02:15 +00:00
Mikhail Glukhikh 0fba58eee7 K2: repeat K1 logic around SAM-based candidates discrimination
#KT-56614 Fixed
2023-11-16 20:12:34 +00:00
Ivan Kochurkin df43226a08 [FIR] Fix CAST_NEVER_SUCCEEDS for definitely not null types 2023-11-16 19:29:58 +00:00
Ivan Kochurkin 3b9095a5ab [FIR] Use isSubtypeOfClass with platform types mapping instead of isSubtypeOf during checking CAST_NEVER_SUCCEEDS
Refactor and generalize code

^KT-62783 Fixed
2023-11-16 19:29:58 +00:00
Brian Norman e92fab65aa [FIR] Support including flow information when dumping CFG dot file 2023-11-16 18:04:26 +00:00
Stanislav Ruban 73aaa1ce28 [tests] Add code examples from exploration of KT-62239 2023-11-16 16:39:35 +00:00
Roman Efremov 722d901d69 [Tests] Decline bug KT-62886 and change comment accordingly
^KT-62886
2023-11-15 16:47:04 +00:00
Nikolay Lunyak 44d6d10233 [FIR] Only check conflicting callables that may clash with declared ones
This change improves performance, as
checking callables via scopes in
`4e587157` turns out to be quite
slow, and it also prevents some redundant
diagnostics.
2023-11-15 07:56:32 +00:00
Nikolay Lunyak 9e57aba448 [FIR] Add a test for KT-26045
^KT-26045 Fixed

Merge-request: KT-MR-13023
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-11-15 07:52:11 +00:00
Stanislav Ruban c7caca8ccd [tests] Refactor code examples relevant to exploration of KT-22004 2023-11-14 17:58:20 +00:00
Stanislav Ruban d0958068c9 [tests] Add code examples from exploration of KT-22004 2023-11-14 17:58:20 +00:00
Nikolay Lunyak 425d5e808b [FIR] Link some tests with issues
Just in case.

^KT-59874
2023-11-14 15:19:33 +00:00
Nikolay Lunyak c656a83a02 [FIR] Don't miss non-const annotation args
This code with `b()` crashes the JVM
backend.

^KT-59822 Fixed
^KT-59874
2023-11-14 15:19:33 +00:00
Nikolay Lunyak 5a1a23afac [FIR] Don't miss annotations on inits
^KT-59874
2023-11-14 15:19:33 +00:00
Nikolay Lunyak 63f461a6cd [FIR] Don't miss annotations on for loops variables
^KT-59874
2023-11-14 15:19:32 +00:00
Nikolay Lunyak d03039b949 [FIR] Don't generate property fields when context receivers are present
^KT-59874
2023-11-14 15:19:32 +00:00
Nikolay Lunyak 4b67a504be [FIR] Only support @ExtensionFunctionType on true functional types
^KT-59874
2023-11-14 15:19:32 +00:00
Dmitrii Gridin 28895a2613 [FIR] FirAnnotationArgumentsTransformer: fix scope problem with type parameters
We should wrap outer declaration to avoid FirTowerDataMode.CLASS_HEADER_ANNOTATIONS

^KT-63396 Fixed
2023-11-14 10:46:43 +00:00
Dmitrii Gridin 2ee9fcab9b [FIR] add diagnostic test for annotations inside type parameters
^KT-63396
2023-11-14 10:46:43 +00:00
Aleksandra.Arsenteva 83c90d0e4f Add one more test for KT-61959
Generate FE tests
2023-11-14 10:09:54 +00:00
Alexander Udalov e0b2f2040b Minor, add regression test for K1 issue KT-61101 2023-11-10 21:51:53 +00:00
Roman Efremov 37b839f2c2 [Tests] Refactor: move one more annotation arguments lazy resolve test
for `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` checker near to
other tests of this diagnostic. It is fine to move it out of
`multiplatformCompositeAnalysis` dir, because, actually, it tests
the case with comparison of FirAnnotationCall and FirAnnotationImpl,
which doesn't require composite analysis mode.

^KT-62559
2023-11-10 19:36:10 +00:00
Roman Efremov 99bf96e747 [Tests] Refactor: move annotation arguments lazy resolve test for
...`ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` checker near to
other tests of this diagnostic. This is because now such tests
are run in lazy resolve test suite, so no need to store them
separately.

^KT-62559
2023-11-10 19:36:10 +00:00
Roman Efremov c20a5fc650 [Tests] Fix .ll.kt KMP tests data added in previous commit
It is expected, that in some complex cases
`ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` reports in .ll.kt disappeared
at all. This is because FIR checker doesn't catch comlex cases,
which are handled by IR checker.

Also add comments about bugs KT-62886 and KT-63382 found by tests.

^KT-62559
2023-11-10 19:36:09 +00:00
Roman Efremov 29980c6b85 [Tests] Run KMP tests in Analysis API LL FIR test suites
New tests are red in current commit!
All `.ll.kt` files are just copies of `.fir.kt` or `.kt`. This will be
fixed in the next commit to clearly show difference between LL and FIR.

The original purpose of this change was to test
`ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic, for which FIR checker
will be run only in IDE (to be changed in next MR), so its reports
a lost from usual KMP tests.
But this looks like a useful change for all KMP tests, not only this
diagnostic.

^KT-62559
2023-11-10 19:36:09 +00:00
Roman Efremov 026ad1cebc [Tests] Refactor: move unrelated tests out of annotationMatching dir
It will be used only for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT
diagnostic tests.

^KT-62559
2023-11-10 19:36:09 +00:00
Mikhail Glukhikh 081e1de5af FE: fix a typo in irrelevantMapGetAbstract.kt diagnostic test
Related to KT-45053
2023-11-10 10:03:58 +00:00