Commit Graph

43827 Commits

Author SHA1 Message Date
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
Mikhail Glukhikh af7d6b1bb3 K2: drop nullable results for generated synthetic callees 2023-05-04 11:48:37 +00:00
Mikhail Glukhikh 3964ee38be K2: fix handling of synthetic calls in delegate inference
This commit is intended to avoid the second resolve of delegate when
we need to consider provideDelegate() possibility in inference.
Also here we provide correct completion of synthetic calls during
delegate inference.

#KT-58013 Fixed
2023-05-04 11:48:37 +00:00
Ilya Chernikov 2e393e8fb7 Stop publishing obsolete kotlin-script-util
#KT-58366 fixed
2023-05-04 11:35:08 +00:00
Dmitrii Gridin fce8172b0d [FIR] mark value parameter for "it" as resolved
^KT-56550
2023-05-04 10:03:45 +00:00
Pavel Punegov 3d65907b8c [K/N][test] Ignore test in Native K1
This test doesn't work with K1 in Native

Merge-request: KT-MR-9934
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-05-04 08:50:42 +00:00
Ilya Gorbunov 568d4b11af Use 'run' function instead of 'synchronized' in KT-51036 test
It should be enough to reproduce the issue and makes the test runnable on all backends
2023-05-04 02:44:26 +00:00
Mikhail Glukhikh 2e69c643cb K2: add test for KT-57649 2023-05-03 17:02:18 +00:00
Simon Ogorodnik 3b979fb60e Tests. Add defineJDKEnvVariables to tests of FIR2IR
Some tests use environment variables JDK_8, JDK_11, and JDK_17.
To ensure that the tests work out of the box,
we should set these variables in the tests.
2023-05-03 14:07:51 +00:00
Ivan Kylchik 568b593da7 [IR] Switch forbidden list in ONLY_BUILTINS mode onto allowed one 2023-05-03 12:47:35 +00:00
Ivan Kylchik 7747643945 [IR] Filter chars and codePoints from allowed to interpret function
These two functions apparently are represented in Kotlin as methods
of `kotlin.String`. Because of that we accidentally treated them as
builtins.

To also minimize such cases, added filtration by return type. We are
allowing to interpret only these functions that have primitive or
unsigned return type.

#KT-57028 Fixed
2023-05-03 12:47:35 +00:00
Ivan Kylchik 81fe411ef6 [IR] Extract some common code in EvaluationMode into extension val 2023-05-03 12:47:34 +00:00
Pavel Kunyavskiy af318fdfb0 [K/N] Fix default arguments in suspend functions
AddContinuationToFunctionsLowering was rewritten in way the order
of this lowering and defaults lowering doesn't matter.

^KT-58214
2023-05-03 12:14:53 +00:00
Pavel Kunyavskiy fa1b22cf31 [K/N] Make klib manifest saving platform-independent
^KT-57126
2023-05-03 12:12:58 +00:00
Alexander Korepanov 97024edf8a [JS IR] Replace canonicalPath with absolutePath
Since canonicalPath is slow, replace it with
absolutePath in SourceMaps and CompilationOutputs.

^KT-58187 Fixed
2023-05-03 10:39:40 +00:00
Nikolay Lunyak 1d9db1b9f8 [FIR] Use proper moduleData in fake override generator Ti
^KT-58145 Fixed
2023-05-03 10:04:25 +00:00
Nikolay Lunyak efbcfb4994 [FIR] Prevent duplicate FileAnalysisException-s 2023-05-03 10:04:25 +00:00