Commit Graph

43643 Commits

Author SHA1 Message Date
Mikhail Glukhikh 0906258d03 K2: handle suspend anonymous functions properly in various compiler parts
#KT-58332 Fixed
2023-05-09 09:19:38 +00:00
Mikhail Glukhikh aec0def5ca FE: add test for KT-58332 (K2 fails with ARGUMENT_TYPE_MISMATCH) 2023-05-09 09:19:37 +00:00
Pavel Kunyavskiy 2f3947d8e5 [K/N] Unmute some actually passing tests 2023-05-09 09:15:41 +00:00
Dmitriy Novozhilov af60681705 [FIR] Save declarations in metadata in source order
^KT-54792 Fixed
^KT-54801
^KT-54800
2023-05-09 07:36:32 +00:00
Dmitriy Novozhilov b359a5538c [FIR] Get rid of FirSerializerExtension.customClassMembersProducer
This service was needed in FE 1.0 because of different scope structure
  for Java classes, but seems like it has no sense for FIR
2023-05-09 07:36:32 +00:00
Anna Kozlova e47561e70b [FIR tests] do not distinguish builtins & library origins
fir which is retrieved by LL symbol providers based on stubs,
receives builtin origin when found in kotlin_builtins

pure compiler providers found the same fir declarations in stdlib
and thus receive Library origin

to avoid splitting the testdata, let's ignore the difference
2023-05-09 07:36:11 +00:00
Anna Kozlova 89a03a74e4 [FIR] make use of FirFromMissingDependenciesNamedReference
during java annotations mapping in IDE, kotlin classes are not available,
thus FirFromMissingDependenciesNamedReference is created

Corresponding test in IJ repo:
K2HighlightingMetaInfoTestGenerated.Uncategorized#testJavaTypes
2023-05-09 07:36:10 +00:00
Anna Kozlova 366c67a668 extract StandartNames.NAME constant 2023-05-09 07:36:10 +00:00
Anna Kozlova 5ca052f87b [LL] [cls] use stubBased symbol provider for builtins
this gives the following benefits:
1. no protobuf in memory, all data is already present in stubs
2. given that symbol provider for libraries is already stub based,
we can get rid of complicated code to find source psi by deserialized fir
3. it's also possible to reduce number of index access,
when fir is requested for given ktElement
2023-05-09 07:36:09 +00:00
Anna Kozlova c46a95aad7 [Light classes] do not write explicit options for IDE
those options are configured explicitly by test
2023-05-08 20:30:24 +00:00
Yahor Berdnikau 1860683a71 Fix explicit api issues in kotlin-build-tools-api
Explicit api mode was not working due to the bug.

^KT-57653
2023-05-08 19:43:43 +00:00
Mikhail Zarechenskiy 6d7dc45ce6 K1: Add test for compatibility check of Enum.entries
Basically, the test checks that adding Enum.entries feature doesn't
break the existing code where it clashes with the user-defined "entries"
declaration; it's better to have a black-box test to be sure
that the compiler doesn't invoke something different at runtime

 The test covers KT-53153 and KT-56587

Merge-request: KT-MR-9798
Merged-by: Michail Zarečenskij <Mikhail.Zarechenskiy@jetbrains.com>
2023-05-08 15:35:25 +00:00
Nikolay Lunyak 76df0f9ad1 [FIR] KT-48870: Allow resolution to InaccessibleImplicitReceiverValue
^KT-48870 Fixed
2023-05-08 14:25:54 +00:00
Mikhail Glukhikh f472f68dc5 SymbolTable: replace assert with require in createOwnerSafe
Related to KT-57049
2023-05-08 13:32:18 +00:00
Mikhail Glukhikh dbdefe90a3 FIR2IR: add workaround for SymbolTable conflicts in property/field situation
Related to KT-57049
2023-05-08 13:32:18 +00:00
Mikhail Glukhikh 6c5afa4b87 SymbolTable: unmute the symbol comparison condition
#KT-57049 Fixed
2023-05-08 13:32:18 +00:00
Mikhail Glukhikh e92cb49b24 K2: fix SymbolTable accessing in getIrClassSymbolForNotFoundClass
Related to KT-57049
2023-05-08 13:32:18 +00:00
Mikhail Glukhikh db45f5f7db FIR2IR: drop unused members from Fir2IrBindableSymbol & its inheritors 2023-05-08 13:32:18 +00:00
Dmitrii Gridin b9dd2f736a [LL FIR] avoid redundant recursive type resolve for type aliases
In LL FIR we will do this by crawlSupertype

^KT-56550
2023-05-08 12:06:55 +00:00
Dmitrii Gridin 46f987ba79 [LL FIR] do not try to access supertypeRefs for classes during super types phase
We should try to find supe type refs in a session firstly, otherwise
we can try to access by getResolvedSuperTypeRefsForOutOfSessionDeclaration

^KT-56550
2023-05-08 12:06:55 +00:00
Dmitrii Gridin 873c7d63ed [LL FIR] avoid redundant pass through the entire super type hierarchy for nested classes
We can omit this step in LL FIR because, according to the contract,
an outer class must be resolved before nested class
Also, it drops unsafe access to superTypeRefs from FIR transformer

^KT-56550
2023-05-08 12:06:55 +00:00
Dmitrii Gridin ee74e10f28 [FIR] avoid jumping from super type transformer for local classes to unresolved non-local classes
In the worst case, we will visit the entire hierarchy of a local class,
where non-local classes are not yet resolved

^KT-56550
2023-05-08 12:06:55 +00:00
Alexander Udalov 530725c6bf Kapt+JVM_IR: do not generate secondary constructor bodies
In addition to ceedad40f3, do not generate bodies of constructors which
delegate to super.

 #KT-58226 Fixed
2023-05-08 09:08:07 +00:00
Dmitrii Gridin ba08f2c08a [FIR] avoid jumping from status transformer for local classes to unresolved non-local classes
We must resolve a non-local declaration before access
if we want to jump from local to it to avoid possible problems
with parallel resolution

^KT-56550
2023-05-08 08:59:07 +00:00
Sergej Jaskiewicz 71c66cdb01 [test] Enable linkViaSignatures based on directive, not target backend
We want to be able to use signature-based linkage in other kinds
of tests.
2023-05-08 08:07:29 +00:00
Pavel Kunyavskiy 68a68b2763 [K/N] Refactor KonanSymbols to avoid descriptors when built over FIR
^KT-58437
2023-05-08 07:51:56 +00:00
Kirill Rakhman 7f9118d0f2 [FIR] Resolve property return type before resolving its annotations
This fixes TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM in a declaration
like `@Ann(myConst) const val myConst = ""`.

#KT-58080 Fixed
2023-05-08 07:45:57 +00:00
Mikhail Glukhikh 1c7ffb3276 ResultTypeResolver: don't allow Nothing as ILT subtype
#KT-58379 Fixed
2023-05-08 07:43:55 +00:00
Mikhail Glukhikh 6ae648f6f6 K2: reproduce KT-58379 2023-05-08 07:43:54 +00:00
Ivan Kylchik 73cc73115e [FIR2IR] Simplify logic around annotationMode
#KT-58005 Fixed
2023-05-05 16:15:00 +00:00
Dmitrii Gridin c2b09d3b1e [LL FIR] rewrite LLFirSuperTypeTargetResolver
The previous implementation had issues with
locks, publication and performance

Also, this change fixed a problem with mixed cycle inheritance

^KT-56550
^KTIJ-25430 Fixed
^KTIJ-23520 Fixed
^KT-57623 Fixed
^KTIJ-25372 Fixed
^KT-58357 Fixed
2023-05-05 12:35:46 +00:00
Vladimir Sukharev 98be76295f [K2/N] Insert asserts to reveal wrongly recursive Fir2IrLazy*.overriddenSymbols
^KT-58459
[Merge-request: KT-MR-9962
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-05-05 12:06:22 +00:00
Stanislav Ruban 47c32ef37f KT-52671: Add CLI test
The issue in question was obsoleted by development of K2/MPP.

^KT-52671
2023-05-05 11:58:22 +00:00
Sergej Jaskiewicz bfa2c92c7f [IR] Support stable ordering in Kotlin-like IR dump
This is needed for signature tests to work with the same golden data
on both K1 and K2, since sometimes K1 and K2 produce IR with different
order of declarations and supertypes.
2023-05-05 11:12:37 +00:00
Nataliya.Valtman 71e81aa30e Fix build reports when no kotlin task is executed
#KT-58313: Fixed
2023-05-05 10:48:11 +00:00
Kirill Rakhman 3c66ae0f8b [FIR, LT] Report syntax error by traversing LT after parsing
#KT-57756 Fixed
2023-05-05 09:34:24 +00:00
Kirill Rakhman b07e4f26ef [LT, Parsing] Parse blocks and lambdas eagerly for Light Tree 2023-05-05 09:34:23 +00:00
Kirill Rakhman 6119606cb6 [FIR LT] Make syntax error reporting in tests consistent with cli 2023-05-05 09:34:23 +00:00
Kirill Rakhman bdf0b41026 [FIR] Consolidate SYNTAX and SYNTAX_WITH_MESSAGE diagnostics 2023-05-05 09:34:23 +00:00
Kirill Rakhman 871a148529 [FIR] Prevent duplicate SYNTAX diagnostic for top-level destructuring 2023-05-05 09:34:23 +00:00
Kirill Rakhman 9918526556 [FIR] Visit error properties in ErrorNodeDiagnosticCollectorComponent 2023-05-05 09:34:23 +00:00
Kirill Rakhman 9e34a5ad82 [FIR] Ignore error declarations in conflict checking 2023-05-05 09:34:23 +00:00
Kirill Rakhman 4c6b6dd700 [FIR] Render error properties and function in FirRenderer 2023-05-05 09:34:23 +00:00
Xin Wang 7b4e6bae0e JVM: ensure the $ENTRIES field is initialized before use
#KT-57784 Fixed
2023-05-04 23:11:39 +02:00
Evgeniy.Zhelenskiy d24eaf13b5 [FIR] Fix value parameter indexes when using context receivers
#KT-1179 #KT-10468
2023-05-04 16:44:18 +00:00
Evgeniy.Zhelenskiy bf5fa61ffb [IR] Unify MFVC bridge redirection, fix related bugs, support MFVC overriding functions with default parameters
#KT-1179
2023-05-04 16:44:18 +00:00
Sergej Jaskiewicz 89ecd1e0e2 [FIR] Respect exception suppression in Fir2IrResultsConverter
Only Fir2IrJvmResultsConverter respected
the IGNORE_FIR2IR_EXCEPTIONS_IF_FIR_CONTAINS_ERRORS test directive.
Fir2IrJsResultConverter didn't.

This is fixed here.
2023-05-04 14:58:06 +00:00
Sergej Jaskiewicz a74df3b4b4 [IR] Store manglers used for signature computation in IrBackendInput
We will need them in signature dump tests later.
2023-05-04 14:58:06 +00:00
Sergej Jaskiewicz 89ff7bd0db [IR] Add body printing strategy to Kotlin-like dumper 2023-05-04 14:11:19 +00:00
Simon Ogorodnik 82611ad124 FIR. BI: Fix stub type leakage in builder inference
Previously, updateTypeInBuilderInference was calling
updateTypeFromSmartcast to actually perform type update in
implicit receiver after stub types was inferred
Such action results in creation of following FIR:

FirSmartCastExpression(
    original=FQAE(FirImplicitThisReference, typeRef=R|Inv<Stub>|)
    typeRef=R|Inv<String>|
)

in receiver position during completion of calls

However, it wasn't the case in general situation due to
action of FirStubTypeTransformer, which, in turn visits and updates
type ref inside original expression, but only if there was at
least one call (that was completed) using that implicit receiver
As after such type update updateTypeFromSmartcast function does
nothing

Yet in situation, when there was only partially resolved calls
referencing that implicit receiver we actually create smart-cast
expression and don't update type

The change just removes usage of updateTypeFromSmartcast and
replaces is with direct type update
We still mutate state of implicit receiver, potentially
improperly, it should be addressed in future

^KT-54708
^KT-58365 Fixed
2023-05-04 12:46:28 +00:00