Commit Graph

7250 Commits

Author SHA1 Message Date
Kirill Rakhman 2005446296 [FIR] Preserve enhanced mutability when nullability was enhanced for warning
#KT-56989
2023-11-15 08:43:55 +00:00
Kirill Rakhman a63ec9efdc [FIR] Implement warnings for java nullability upper bound violation 2023-11-15 08:43:55 +00:00
Kirill Rakhman 2df1e9dde6 [FIR] Implement warnings for java nullability type mismatch on override
#KT-56989
2023-11-15 08:43:55 +00:00
Kirill Rakhman a6fdeeb7df [FIR] Implement warnings for java nullability type mismatch
#KT-56989
2023-11-15 08:43:55 +00:00
Nikolay Lunyak 80cccce8d0 [FIR] Use the proper processAll* functions for CONFLICTING_OVERLOADS
The `*leaf*` functions were
introduced due to my false
assumption. The normal processing
functions only collect leafs
already. `*leaf*`s are bad, because
they don't cache anything.

The change in
AbstractFirOverrideScope reflects
KT-63290, and is needed to avoid
duplicate `CONFLICTING_OVERLOADS`
and `VIRTUAL_MEMBER_HIDDEN`.
2023-11-15 07:56:32 +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 41c5934d4e [FIR] Don't forget to ignore hidden imports
^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
Svyatoslav Kuzmich 1c230c8f27 [Wasm] Port WasmImport/WasmExport checker to K2 (KT-56849) 2023-11-14 12:24:10 +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
Mikhail Glukhikh 9903b70e0a K2: add test to confirm KT-58874 now works properly
#KT-58874 Obsolete
2023-11-13 12:26:28 +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
Ilya Kirillov 8fbd6ab02b [LL FIR] do not provide cloneable for non-jvm platforms
It's a jvm-specific thing

^KT-62935 fixed
2023-11-10 06:41:03 +00:00
Ilya Kirillov bffbbe6293 [LL FIR] add LL FIR tests based on AbstractFirPsiNativeDiagnosticsTest
^KT-62910 fixed
2023-11-10 06:41:03 +00:00
Brian Norman 6df97dd199 [FIR] Add test cases to prove resolution of backlog tickets
^KT-41728 Fixed
^KT-46586 Fixed
^KT-49696 Fixed
^KT-51160 Fixed
^KT-53308 Fixed
2023-11-09 19:28:26 +00:00
Marco Pennekamp 730f98ba38 [FIR] Fix top-level property initialization checks in scripts
- While `collectionInitializationInfo` unwrapped a script's top-level
  declarations, `check` forgot to do it, so a script effectively had no
  top-level properties in the mind of the checker.

^KT-63286 fixed
2023-11-09 13:09:39 +00:00
Marco Pennekamp 1cc2390af6 [FIR] Add tests for top-level property initialization in scripts
- The test data is missing initialization checks and will be fixed with
  the subsequent commit.
- The test data is originally taken from
  `backingField/TopLevelPropertyInitialization` and has been simplified.
- I didn't add `const val` properties to the test data (compared to the
  original) due to KT-20110.

^KT-63286
2023-11-09 13:09:39 +00:00
Dmitrii Gridin a25bac4bf9 add tests on implicit type with inaccessible annotations
^KT-63042
2023-11-09 13:07:14 +00:00
Ivan Kochurkin 64db96eda3 [K1, K2] Use safe names when accessing to type parameters
^KT-57529 Fixed
2023-11-09 12:21:43 +01:00
Ivan Kochurkin 3188f01720 [FIR] Handle ConeIntersectionType in createSimpleType
^KT-62819 Fixed
2023-11-09 11:19:07 +00:00
Dmitriy Novozhilov fe66f3a384 [FIR2IR] Manage constructor symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)

There was an exception from FIR2IR that was fixed with this change,
 so fir2ir test SuperClass started to pass along with IrActualizer,
 which reported some new errors
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 3c0f153de4 [FIR2IR] Manage function symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)

There was an exception from FIR2IR that was fixed with this change,
  so fir2ir test expectDeclarationWithWeakIncompatibilities started to
  pass along with IrActualizer, which reported some new errors
2023-11-09 10:43:31 +00:00
Kirill Rakhman d54068b8ab [FIR] Report NONE_APPLICABLE on callable references with multiple failed candidates 2023-11-08 15:45:48 +00:00
Kirill Rakhman 6d2ab92d91 [FIR] Set positioning strategy for UNRESOLVED_REFERENCE_WRONG_RECEIVER 2023-11-08 15:45:48 +00:00
Kirill Rakhman 789f886d3c [FIR] Implement ADAPTED_CALLABLE_REFERENCE_AGAINST_REFLECTION_TYPE diagnostic
#KT-59401 Fixed
2023-11-08 15:45:48 +00:00
Kirill Rakhman d91000e39c [FIR] Report INAPPLICABLE_CANDIDATE or more specific diagnostic for callable references
... instead of just UNRESOLVED_REFERENCE when something went wrong
during resolution.

#KT-59401 related
2023-11-08 15:45:48 +00:00
Kirill Rakhman 6b7eeec181 [FIR] Fix candidate success check by checking if no diagnostic is unsuccessful
Checking the current applicability isn't enough because in the presence
of multiple diagnostics, the lowest applicability can be successful but
a higher one isn't.

#KT-63147 Fixed
2023-11-08 15:45:48 +00:00
marat.akhin d5fe86559d [Tests] Add test for KT-59493
This is to record the red->green change in behavior between K1 and K2,
when K2 correctly handles resolution/inference of an extension function
with definitely non-nullable type.
2023-11-08 14:05:56 +00:00
Brian Norman ad4d075125 [FIR] Do not allow vararg function to be used as synthetic setter
^KT-63172 Fixed
2023-11-08 12:22:29 +00:00
Ivan Kochurkin 54ab3d39db [FIR] Fix crash on incorrect call on ILT
^KT-62306 Fixed
2023-11-08 10:27:44 +00:00
Kirill Rakhman eba1fdec1d [Tests] Check for duplicate file names in FIR diagnostic tests with IR
The relative path of a test file is just its name, even if it's in a
module.
Diagnostics in IR are mapped to the file path and so it's reported on
all files with the same path, i.e. name.
This doesn't happen in production code because no two files can have
the same path.

The proper fix would be to prefix the test files' paths with the module
name.
Unfortunately, this breaks a bunch of test runners that rely on the
current behavior.
Especially, some JS runners turned out to be hard to fix.
The linked YouTrack issue contains a WIP, incomplete patch of fixing
some runners.

#KT-61592 Fixed
#KT-63252
2023-11-08 08:25:19 +00:00
Nikita Bobko 45c5fd7a2d [FE] Introduce a language feature entry for expect actual classes
^KT-62885 Fixed
2023-11-07 20:05:59 +00:00
Nikita Bobko 7b8445f914 [FIR] 2/2 Support more wider actual member visibility, if the expect member is effectively final
^KT-61955 Fixed

Introduce LV vs don't introduce LV:

introduce LV:
- K1 IDE and K2 project: IDE accurately shows compiler errors
- K2 IDE and K1 project: There are cases when IDE shows red but in reality it's green

don't introduce LV:
- K1 IDE and K2 project: There are cases when IDE shows red but in reality it's green
- K2 IDE and K1 project: There are cases when IDE shows green but in reality it's red
2023-11-07 15:53:54 +00:00
Anastasia.Nekrasova 93ebd83ecd [K2] Disappeared OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN (4)
Added checking usages of markers as qualifiers in properties and function calls.

^KT-59998
2023-11-07 13:12:46 +00:00