Commit Graph

80 Commits

Author SHA1 Message Date
Kirill Rakhman f231338cd6 [FIR] Render list of symbols with linebreaks as separators
#KT-61823 Fixed
2024-02-21 12:25:22 +00:00
Jinseong Jeon e91e5db0ce AA FIR: build argument mapping for SAM conversion node
^KT-64910 fixed
2024-01-19 17:05:06 +00:00
Denis.Zharkov b9019d3de1 K2: Adjust test data after PCLA implementation [red-to-green]
^KT-59791 In Progress
2024-01-10 14:56:30 +00:00
Jinseong Jeon f5d2ce3022 AA: render containing file and JvmClassName 2023-12-21 15:34:34 +00:00
Mikhail Glukhikh 83cfcc30c6 K2: handle type parameter vs nested class conflict in body resolve properly
This commit does two things:
- prioritize type parameter scopes against static scopes in body resolve
(effectively it's a revert of KT-58028 fix)
- consider type parameters as inapplicable callable, so during callable
resolve we can go up the tower and still resolve to static scope

This allows both KT-58028 and KT-63377 to work properly
#KT-63377 Fixed
2023-11-24 21:28:16 +00:00
Egor Kulikov c0a05e435c [FIR] Correctly process invalid implicit invoke
^KT-60170 fixed


Merge-request: KT-MR-12926
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-15 11:43:48 +00:00
Ilya Kirillov 4720a0faa7 [Analysis API FIR] fix NPE of == call resolve without builtins
We should not expect builtins to be always available as they are taken from indecies.

For K1 and FIR Standalone implementations, the builtins are always available.

^KT-62957 fixed
2023-10-31 12:24:16 +00:00
Alexander Kuznetsov 45792c2e60 [Analysis API] support unsigned arrays creation functions
IDEA-335151, KT-62663


Merge-request: KT-MR-12614
Merged-by: Alexander Kuznetsov <Aleksander.Kuznetsov@jetbrains.com>
2023-10-18 10:53:52 +00:00
Ilya Kirillov d98da87278 [FIR] Render dot-separated FQNs instead of slash-separated ones in diagnostics
^KT-62030 fixed
2023-09-22 10:48:31 +00:00
Roman Golyshev 23363ef1bd KT-61728 [LL API] Use ContextCollector in AllCandidatesResolver
Fix testdata for builder inference test in resolve tests - now it's the
same between K1 and K2
2023-09-08 14:41:39 +00:00
Roman Golyshev f39153b6e6 KT-61568 [FIR][AA] Add one more testcase for AllCandidatesResolver 2023-08-31 14:59:53 +00:00
Roman Golyshev 21dffe4639 KT-61568 [FIR][AA] Do not add redundant file scopes in AllCandidatesResolver
`firResolveSession.getTowerContextProvider` should already
contain all the relevant scopes, including default and
importing scopes for the file

Because of this, import and default scopes had presence over the
more local scopes, and the resolve was performed incorrecty - top level
candidates were given higher priority

^KT-61568 Fixed
^KTIJ-26824 Fixed
2023-08-30 14:30:21 +00:00
Kirill Rakhman d0cc86f52c [Tests] Update test data after changes to FIR diagnostic messages 2023-08-21 16:28:48 +00:00
aleksandrina-streltsova 52a95cb75f [AA] update test data after adding properties to KtClassLikeSymbol
KT-54846
2023-07-24 17:24:41 +00:00
Kirill Rakhman 97024d9ccb [FIR] Resolve array literal argument for non-primitive-array parameter as arrayOf call in annotation calls
This allows us to properly complete array literals arguments of
annotation calls fixing several false-negative type mismatch errors
as well as enabling the inference of generic type arguments.

#KT-59581 Fixed
#KT-58883 Fixed
2023-07-19 13:34:58 +00:00
Mikhail Glukhikh 9d9d7880af K2: render types in quotes in diagnostic messages 2023-07-13 09:07:39 +00:00
Mikhail Glukhikh c839cd3c11 K2: don't use debugging type renderer in error messages 2023-07-13 09:07:39 +00:00
Kirill Rakhman e7c213e06e [FIR] Report separate error for delegated constructor call to interface
#KT-59216 Fixed
2023-07-04 16:00:45 +00:00
Ilya Kirillov 048ecdf981 [Analysis API] add regression tests for KTIJ-24163
^KTIJ-24114 obsolete
2023-06-30 11:13:46 +00:00
Kirill Rakhman 911e62257a [FIR] Improve INVISIBLE_REFERENCE message
Report the nearest invisible containing declaration in cases where
the declaration itself is visible.

#KT-53820 Fixed
2023-06-21 08:36:46 +00:00
Mikhail Glukhikh 5304afb097 Fix AA/LC behavior accordingly to changes related to KT-54844 2023-06-14 07:09:15 +00:00
Jinseong Jeon 384ed9cc9e AA: regression test for default value that calls previous params 2023-05-04 18:26:32 +02:00
Jinseong Jeon fbe558a0de AA FIR: handle smartcasted arg when building call's argument mapping
^KTIJ-25112 Fixed
2023-04-17 13:57:08 +02:00
Kirill Rakhman 674397be82 [FIR] Trim rendered symbols in diagnostic messages 2023-04-05 08:44:56 +00:00
Dmitrii Gridin 72d8fa216a [AA] DebugSymbolRenderer: move annotations and type arguments renderer befor type to avoid resolve race
^KT-56046
2023-02-03 19:48:56 +00:00
Dmitrii Gridin 1e2d517c21 [AA] DebugSymbolRenderer: improve type render
to process all nested annotations and types

^KT-56046
2023-02-03 19:48:55 +00:00
Anna Kozlova b415aa7446 [FIR] take ready implicit unit type instead of return type calculation
and assert that symbol is not a substitution/intersection override
in the `compute` method otherwise.

Because `fakeOverrideSubstitution` should be calculated for all real
implicit types, no call to this method should actually happen.

Otherwise, it can be problematic to create a session
which would contain the full designation path:
`provider.getFirCallableContainerFile(symbol)`
returns `firFile` of a super class which might be from module `a`,
when declaration and its outer classes are from module `b`.

^KTIJ-24105
2023-01-31 11:21:17 +00:00
Kirill Rakhman 5e56845ce0 Analysis API: Add tests for KT-54648 2023-01-31 08:39:43 +00:00
Kirill Rakhman 1eb18f13bd FIR: Fix test data after making LHS of assignment an expression
KT-54648
2023-01-31 08:39:43 +00:00
Roman Golyshev 5ec626b29d [Analysis API] KTIJ-24453 Handle TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM error in KtFe10CallResolver.kt
It makes call with such type of errors completely unresolvable in
Analysis API

^KTIJ-24453 Fixed
2023-01-30 12:45:19 +00:00
Roman Golyshev 71a368e06e [Analysis API] KTIJ-24107 Fix resolution of qualified invoke calls on objects
^KTIJ-24107 Fixed
^KTIJ-24344 Fixed
2023-01-27 16:49:30 +00:00
Anna Kozlova e5b96561e0 [FIR] skip implicit call to enum constructor if super type call exists
otherwise, reference to the super type would be resolved even when it's not
e.g. for interface constructor
^ KTIJ-24437
2023-01-27 08:20:07 +00:00
Anna Kozlova b026678a34 [LL] retrieve fir from generated property of desugaring ++ operator
^ KTIJ-24385
Temp property to store receiver is generated for `a.b++` expression.
If this property's psi corresponds to receiver expr, then FirProperty
would be found by mapper if receiver is requested.
It works unexpectedly, because FirProperty is normally not expected by expression.
This change set fake sources for generated FirProperty, so it won't be found
by source psi
2023-01-25 11:03:29 +00:00
Anna Kozlova fd52cc4224 [AA] support qualified type in incomplete code
^ KTIJ-24373
when resolving selector expr of a dot qualified expression,
parent qualified expression is resolved
see `KtFirCallResolver.getContainingDotQualifiedExpressionForSelectorExpression`,
Fir is filled with the data. Then,
during final mapping from Fir -> psi, one need to perform the opposite:
take `selectionExpression` to get the initial KtCallExpression
2023-01-24 20:41:19 +00:00
Jinseong Jeon 2dca2b4827 AA FE1.0: Fix StackOverflowError during resolution to a function w/ recursive type parameter
^KT-55825 Fixed
2023-01-12 19:48:21 +09:00
Marco Pennekamp 5f554d0065 [FIR] KT-54980 Fix resolvability of too few/too many type arguments
- If too few or too many type arguments were provided, they were all
  thrown away in `TypeArgumentMapping`,
  `FirCallCompletionResultsWriterTransformer`, and `KtFirCallResolver`.
  The fix handles type arguments of the wrong arity more gracefully.
  - Note for `TypeArgumentMapping`: Excess type arguments are not needed
    for candidate resolution. Excess type arguments are still resolved
    due to the handling in `FirCallCompletionResultsWriterTransformer`.
- Post-processing in `AllCandidatesResolver`: When all candidates are
  resolved in `AllCandidatesResolver.getAllCandidates`, the function
  builds a FIR file. During that resolution, the
  `generic<String, String>` call (in example
  `functionCallWithTooFewTypeArguments.kt`) is correctly marked as
  inapplicable, but the missing type argument is inferred as an error
  type. `firFile` then contains a function call
  `generic<String, String, ERROR>` instead of `generic<String, String>`.
  This call is still marked as inapplicable. Despite that, the
  *subsequent* resolution by
  `bodyResolveComponents.callResolve.collectAllCandidates` disregards
  the call's inapplicability and resolves successfully into an
  applicable candidate. This is because `CandidateFactory` doesn't make
  any guarantees for already inapplicable calls. The fix adds
  post-processing to `AllCandidatesResolver` to preserve candidate
  inapplicability.
- Most tests that this commit changes had slightly different results due
  to type arguments becoming resolvable.
- `wrongNumberOfTypeArguments.kt` and
  `wrongNumberOfArgumentsInTypeAliasConstructor.kt`:
  `ConeDiagnostic.toFirDiagnostics` prefers specific errors. Because
  `ARGUMENT_TYPE_MISMATCH` is specific and `INAPPLICABLE_CANDIDATE` is
  not, only the former is reported. I see no reason to pass an illegally
  typed argument in either test, so the change reduces the errors to
  `INAPPLICABLE_CANDIDATE`.
- `typeAliasSamAdapterConstructors2.fir.kt`: See KT-55007.
- Disable `mismatchTypeParameters` JS backend test due to its handling
  of excess type arguments. See KT-55250.

^KT-54980 fixed
2023-01-02 16:36:02 +00:00
Dmitriy Novozhilov f3da26946b [FIR] Change priority of K2_VISIBILITY_ERROR CandidateApplicability
In K1 analogue of `K2_VISIBILITY_ERROR` is `K1_RUNTIME_ERROR`, so
  candidates with `K2_VISIBILITY_ERROR` should win over innaplicable
  candidates with `INAPPLICABLE`, `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
  or `INAPPLICABLE_WRONG_RECEIVER` applicability

This is needed to allow resolution to invisible symbols (and later
  suppress error with `@Suppress("INVISIBLE_SYMBOL", "INVISIBLE_REFERENCE")`

^KT-55026 Fixed
^KT-55234
2022-12-09 12:02:05 +00:00
pyos 0d46dfc1ba FIR: fix substitution of type arguments in SAM type aliases
^KT-54730 Fixed
2022-12-07 22:09:20 +00:00
Marco Pennekamp 93f560eb4d [Analysis API] Add call resolution tests for KTIJ-23373
- The Java functions aren't recognized as candidates during the test
  (`FULL_JDK` isn't helping), so I've replicated the tests with local
  extension functions and confirmed that they uncover the same
  exception.
2022-11-22 13:13:35 +01:00
Anna Kozlova e5ce32feeb [ANALYSIS API] introduce dedicated KtCall for incomplete code
KTIJ-23505 and duplicates
2022-11-18 20:59:31 +01:00
Marco Pennekamp c5e5140c08 [Analysis API] Fix exceptions around type parameters being treated as callables
- `toResolvedCallableSymbol`: cast defensively because
  the resolved symbol might not be a callable symbol.
- `toKtCallInfo`: Check that the resolved symbol is actually callable.

^KTIJ-23003 fixed
2022-11-17 18:58:38 +00:00
Dmitrii Gridin 37d688ae83 [AA] introduce FirReceiverParameter
^KT-54417
2022-11-17 09:50:09 +00:00
Jinseong Jeon b2e239a542 AA: tests about equals on sealed/data class
^KT-54844 In Progress
2022-11-09 07:12:36 +01:00
Anna Kozlova 79bed083e6 [FIR] allow primary constructors in interfaces to support invalid code
KTIJ-23504
2022-11-08 14:51:33 +01:00
Anna Kozlova f18d1e9067 [Analysis API FIR] support call expression resolve in class literal
KTIJ-23272
2022-11-04 08:10:09 +01:00
Ilya Kirillov 49f2f85927 [Low Level FIR] fix exception when creating symbol by invalid code 2022-10-04 12:56:07 +00:00
Ilya Kirillov 81c52e6886 [Analysis API FIR] fix call resolution on error elements 2022-10-03 16:02:23 +02:00
Ilya Kirillov ab3f916f3f [Analysis API FIR] fix call resolution of non-resolvable elements 2022-10-03 16:02:23 +02:00
Simon Ogorodnik 513af2dfbc FIR. Refactor smart-cast representation in FIR tree
Make smart-casts non-transparent expression without delegation
to underlying FirQualifiedAccessExpression, as children delegation in
fir tree has unclear semantics
Remove two different kinds of tree nodes for smart-casts
2022-08-15 21:46:11 +00:00
Ilya Kirillov a0f0fa5a47 [Analysis API FIR] fix candidate collection for delegatedConstructor call
^KTIJ-20446
2022-07-22 00:58:59 +02:00