Commit Graph

35 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 f5d2ce3022 AA: render containing file and JvmClassName 2023-12-21 15:34:34 +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
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 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
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
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
Dmitrii Gridin 37d688ae83 [AA] introduce FirReceiverParameter
^KT-54417
2022-11-17 09:50:09 +00:00
Ilya Kirillov a0f0fa5a47 [Analysis API FIR] fix candidate collection for delegatedConstructor call
^KTIJ-20446
2022-07-22 00:58:59 +02:00
Mikhail Glukhikh 76d5d3a2ec Extract separate FirModifierRenderer 2022-07-14 09:38:39 +00:00
Mikhail Glukhikh 2b235e1188 FE10 Analysis API: use compact renderer for flexible types even in debug 2022-06-29 16:50:06 +00:00
Mikhail Glukhikh 38f4a35be2 FIR: introduce flexible types pretty rendering for no arguments case
#KT-52020 Fixed
2022-06-29 16:50:05 +00:00
Mikhail Glukhikh 31ec10142b FirRenderer: add renderAllModifiers and renderDetailedTypeReferences
Related to KT-52020
2022-06-29 16:50:04 +00:00
Stanislav Erokhin 66851c7afd [Analysis API] Add KtReceiverParameterSymbol#correspondingSymbol 2022-06-27 19:32:44 +00:00
Stanislav Erokhin 2234813363 [Analysis API] Add KtCallableMemberCall#typeArgumentsMapping 2022-06-23 07:50:21 +00:00
Stanislav Erokhin 8d8fc6e291 [Analysis API] Add type to KtReceiverValue
Maybe in the future we could remove type from the
KtImplicitReceiverValue, because it has ktSymbol, and in theory
that should be enough to create corresponding KtType.
Unfortunately that is not the case for KtClassOrObjectSymbol --
it doesn't have the API for "default" type creation currently.

Regarding code in KtFirCallResolver.kt -- it seems like code there
needs some love in the future. Psi created via custom code there,
because for call x() FIR has receiver x with psi = null
2022-06-23 07:50:21 +00:00
Ilya Kirillov 2c1074ac37 [Analysis API] actualize testdata 2022-06-22 09:31:45 +02:00
Denis.Zharkov 21b86123e8 FIR: Adjust analysis test data after changes in how we load Java types
Especially, it's about types based on type parameters
2022-05-19 16:54:05 +00:00
Dmitriy Novozhilov 23af5510a6 [FIR] Render full declaration header in diagnostic messages 2022-02-18 17:44:38 +03:00
Mark Punzalan afb34d3193 Analysis API: Implement KtCallResolver.collectAllCandidates for FE 1.0. 2022-02-17 19:51:35 +01:00
Mark Punzalan 3f3873dc50 Analysis API: Return KtCallCandidateInfo instead of KtCallInfo in
KtCallResolver.collectAllCandidates().
2022-02-11 13:22:58 +01:00
Mark Punzalan 58c6c25fe9 Analysis API: Handle other FirElements in
KtCallResolver.resolveCandidates() and copy over remaining tests.
2022-02-11 13:22:58 +01:00
Mark Punzalan 9b9da94a09 Analysis API: Fix issues related to implicit invoke calls:
- Correctly set explicit receiver value.
- Restore original function call from FirImplicitFunctionCall (i.e.,
calls implicitly resolved to `invoke`) to get the correct name for
getting all candidates.
- Collect candidates at all tower levels.

Also make order of candidate calls in tests deterministic.
2022-02-11 13:22:58 +01:00
Mark Punzalan ace826c570 Analysis API: Get argument mapping from candidate and type parameters
from candidate symbol.
2022-02-11 13:22:58 +01:00
Mark Punzalan 0ed802bca4 Analysis API: Add tests for KtCallResolver.resolveCandidates(). 2022-02-11 13:22:57 +01:00