Commit Graph

30 Commits

Author SHA1 Message Date
Dmitrii Gridin faebef171d [Analysis API] add regression tests for data class copy arguments usage
This issue is not reproducible against the K2 compiler

^KT-64884
2024-02-13 16:07:17 +00:00
Dmitrii Gridin 31852c6c05 [LL FIR] FileStructure: support dangling modifier list in non-end position
The root cause of the exception is that we missed such an element, and
it led to unresolved declaration during iteration over file declarations

^KT-65562 Fixed
2024-02-12 23:14:12 +00:00
Marco Pennekamp eabbe21b66 [AA] Add diagnostics tests for sealed classes/interfaces
- KT-62895 cannot be reproduced on the Analysis API side. Still, it is
  useful to add tests here for better coverage in the future.
- The reason is likely that Analysis API tests specifically use
  `SealedClassesInheritorsCaclulatorPreAnalysisHandler` to compute
  sealed class inheritors (which are usually the breaking point for
  problems in `when` exhaustiveness checking), so the tests do not use
  the production implementation. See KT-64505 for future work on this
  problem.

^KT-62895
2024-01-10 10:13:23 +00:00
Yan Zhulanow 5179462632 [Analysis API] Support non-JVM platforms in code fragments
The 'evalJs' test is not available, as there is no proper support for
klib loading in non-standalone Analysis API yet.

^KT-64197 Fixed
2024-01-05 16:04:14 +00:00
Dmitrii Gridin 2bad2f37ce [LL FIR] add missed ClassId check for combined Java classes symbol provider
findClasses works over regular `PsiElementFinder`, which doesn't know
about out ClassId conception. So, `a/b/A.B` and `a/b/A/B` are the same
from `FqName` point of view.
`FirJavaFacade` has this check, so this problem appears only in the case
of combined provider.

^KT-62892 Fixed
2024-01-03 21:35:12 +00:00
Dmitrii Gridin 7efbcad121 [Analysis API] add diagnostic tests for inner Java class usage
^KT-62892
2024-01-03 21:35:12 +00:00
Dmitrii Gridin 8a3f850bca [LL FIR] StubBasedFirMemberDeserializer: deserialized properties must have default getter/setter
In FIR we always have either real getter/setter or the default one

^KT-62888 Fixed
^KT-62651 Fixed
2024-01-03 13:39:42 +00:00
Dmitrii Gridin faf33e4fa4 [Analysis API] add diagnostic test of type inference from getValue delegate
^KT-62888
2024-01-03 13:39:41 +00:00
Dmitrii Gridin d88249bda7 [Analysis API decompiler] materialize delegate declarations in stubs
We should materialize delegated declarations to process callables
in scopes correctly. Standalone mode works the same way as it
deserialize directly into FIR.
Another solution is to rework proto and stub serializer/deserializer to
restore FirFields like `$$delegate_0` correctly to work with
`FirDelegatedMemberScope`

^KT-62896 Fixed
^KT-64584 Fixed
2023-12-28 08:48:08 +00:00
Dmitrii Gridin 3f337bf62d [Analysis API] add diagnostic test for delegate from library
^KT-62896
2023-12-28 08:48:08 +00:00
Dmitrii Gridin 441072c6fe [LL FIR] StubBasedFirDeserializedSymbolProvider: fix loading of nested classes
We cannot load nested class without an outer as in this case we will
miss a symbol of the outer class, which is crucial in some cases
(e.g., during status calculation).
So we have to load the topmost class as it will load all nested classes
with the correct context as well

^KT-62891 Fixed
2023-12-26 16:53:36 +00:00
Dmitrii Gridin 1ec994cd0d [Analysis API] add diagnostic test for FP expose diagnostic from library
^KT-64468
^KT-62891
2023-12-21 19:48:22 +00:00
Dmitrii Gridin 69a2bc9abc [Analysis API] add regression test on error diagnostics for functional interfaces
^KT-63432 Obsolete
2023-12-21 19:36:44 +00:00
Dmitrii Gridin 1538c125c3 [LL FIR] LLFirReturnTypeCalculatorWithJump: use declaration-site ScopeSession
We should use the declaration-site session to have stable
resolution order. The same scheme is applicable during
regular lazy resolution calls

^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin e3841a1728 [Analysis API] add test for duplicated callable during implicit type
^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 51f6525238 [LL FIR] LLFirCompilerAnnotationsLazyResolver: pass correct ScopeSession
We should use the declaration-site session to have stable
resolution order. The same scheme is applicable during
regular lazy resolution calls.

^KT-63547 Fixed
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 4bd73e4ccd [Analysis API] add diagnostic test for compiler annotation with argument from another module
^KT-63547
2023-12-21 09:34:39 +00:00
Egor Kulikov 001e9a4489 [FIR] Source for property delegates should not be null
^KT-60327 fixed


Merge-request: KT-MR-13221
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-29 08:27:53 +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
Marco Pennekamp dd219cb6e6 [LL] Commit pending diagnostics from file checkers on script declarations
- In addition to file declarations and class members, we also need to
  commit pending diagnostics on declarations in scripts, to honor
  suppressions before the diagnostics are committed indiscriminately.

^KT-62899
2023-11-13 10:20:26 +00:00
Marco Pennekamp c482786bc4 [AA] Add tests for diagnostics suppression on top-level declarations in scripts
- `scriptUninitializedTopLevelProperty` is currently disabled in FIR
  because it fails with a mismatch between diagnostics from the file and
  the individual elements. It will be enabled in the next commit.

^KT-62899
2023-11-13 10:20:26 +00:00
Marco Pennekamp c9cb2062bd [LL] Commit pending diagnostics from file checkers on top-level declarations
- In KT-62899, diagnostics produced by file checkers weren't suppressed
  because the top-level declarations on which the diagnostics are
  reported were never visited by the same reporter.
  `LLFirDiagnosticVisitor` skips nested declarations by design, as
  diagnostics are collected for each structure element separately.
  However, suppression takes effect when diagnostics are committed on
  some element. If the element is not visited, suppression is skipped
  and the diagnostic is committed at the end without a check by
  `FileStructureElementDiagnosticsCollector.collectForStructureElement`.
- The fix ensures that diagnostics are committed on top-level
  declarations, similar to how this was already done for class members.

^KT-62899 fixed
2023-11-13 10:20:26 +00:00
Marco Pennekamp 88d307d52c [AA] Add tests for diagnostics suppression on top-level declarations and class members
- `testConflictingOverloadsAtTopLevel` is currently disabled in FIR
  because it fails with a mismatch between diagnostics from the file and
  the individual elements. It will be enabled in the next commit.

^KT-62899
2023-11-13 10:20:26 +00:00
Dmitrii Gridin 4d29d6e3b4 [LL FIR] FileStructure: accurate processing of generated declarations inside classes
We should process generated property as a part of the primary constructor.
This was already implemented in 8387ea8a, but some parts were missed.

ClassDiagnosticRetriever:
* dropped relation to properties generated from constructor parameters
as they should belong to the primary constructor only
* accurate logic to fully visit an implicit primary constructor to be
able to process nested declarations (e.g., inside a super type call)

SingleNonLocalDeclarationDiagnosticRetriever:
* add relation to generated properties as now they fully belong to
the constructor

FileElementFactory:
* dropped explicit resolution of generated properties from a constructor
* added explicit resolution of generated enum members for consistency.
Effectively, this is not required because we don't have compiler
checkers for such generated enum member declarations

ClassDeclarationStructureElement:
* do not collect mapping for generated properties from constructor
* explicitly declare that we should process only ClassDelegationField

^KT-62437 Fixed
2023-10-13 17:13:14 +00:00
Dmitrii Gridin 1a01dd4dd4 [Analysis API] add diagnostic tests for unresolved reference inside primary constructor
^KT-62437
2023-10-13 17:13:14 +00:00
aleksandrina-streltsova f18d600dc8 [LL FIR] Return class as structure element for super type reference
^KT-61755 Fixed
2023-09-08 07:25:36 +00:00
Brian Norman 997e062de9 [FIR] Check top-level property initialization via CFG
Now that files have a CFG, use it to validate properties are initialized
correctly. Update FirTopLevelPropertiesChecker to collect initialization
info for the property being checked - similar to
FirMemberPropertiesChecker - and validate proper initialization.

#KT-56683 Fixed
#KT-58531 Fixed
2023-08-31 12:50:52 +00:00
Yan Zhulanow 02af189066 [LL API] Support code fragment analysis 2023-08-07 16:22:01 +00:00
Yan Zhulanow 9873fe84f2 [FE] Fix exception from the 'UnusedChecker' on a destructuring
^KT-55973 Fixed
2023-01-25 08:05:58 +00:00
Tianyu Geng f197fc93db Analysis API: add test for KtDiagnosticsProvider 2021-12-09 15:56:52 +03:00