Commit Graph

99221 Commits

Author SHA1 Message Date
Nikolay Lunyak 343deeec1c [FIR] Check FirReceiverParameter annotations' targets 2023-03-07 11:35:47 +00:00
Nikolay Lunyak 0c77de3049 [FIR] Add a test with an inapplicable receiver annotation 2023-03-07 11:35:47 +00:00
Nikolay Lunyak 1378d730d6 [FIR] Forbid all use-site targets of FirTypeRef annotations 2023-03-07 11:35:47 +00:00
Nikolay Lunyak 93ba0c3e70 [FIR] KT-56769: Ensure @receiver: is only allowed on receivers
Note that there's no code that checks that
FirReceiverParameter's annotation's use-site target
is indeed `@receiver:`, because otherwise the
annotation wouldn't have made it into
the FirReceiverParameter.

In contrast, in K1 all such annotations are treated
as annotations on a KtTypeReference.

^KT-56769 Fixed
2023-03-07 11:35:46 +00:00
Yahor Berdnikau 174f39aa46 Add '-opt-in' option into Gradle compiler options DSL
^KT-53924 Fixed
2023-03-07 09:40:09 +00:00
Pavel Kunyavskiy 2b4abb0c7b [K/N] Remove outdated boxing related functions and classes
^KT-55765
2023-03-07 08:51:00 +00:00
Zalim Bashorov 4d7cf81ed0 [Wasm] Stop supporting "_export.js" in test infra, use import/export capability in relevant tests
* It works slightly differently in SpiderMonkey.
* It was a hack.
2023-03-06 23:19:02 +01:00
Zalim Bashorov bec827b654 [Wasm] Update SpiderMonkey to 112.0a1 (2023-03-04-09-52-24) 2023-03-06 23:19:02 +01:00
Alexander Udalov 47c48efa33 JVM IR: do not generate extension receiver parameter as ACC_MANDATED
Otherwise Java reflection is not able to load its type as a
parameterized type.

 #KT-40857 Fixed
2023-03-06 20:57:52 +00:00
Sebastian Sellmair d23a4f46cc [Gradle] Split Tasks.kt into several source files (per class) (2/2)
^KT-57142 Verification Pending
2023-03-06 18:19:12 +00:00
Sebastian Sellmair 02ac54fe5f [Gradle] Split Tasks.kt into several source files (per class) (1/2)
^KT-57142 Verification Pending
2023-03-06 18:19:11 +00:00
Yan Zhulanow 0044f49af8 Revert "[LL API] Fix vararg parameter matching in PSI-FIR comparison"
This reverts commit 2d8c3c5aaf.
2023-03-07 02:49:41 +09:00
Yan Zhulanow 07fdbeca19 [LL API] Search declarations in dependencies as a fallback
'JvmClassFileBasedSymbolProvider' works incorrectly for some cases,
such as built-in classes. Moreover, the whole declaration binding logic
looks over-complicated and redundant, as we get a 'ClassId'/'CallableId'
from a 'KtDeclaration', and look for it again in indices.

This commit fixes a bunch of failing completion tests:
- HighLevelJvmBasicCompletionTestGenerated
- HighLevelMultiFileJvmBasicCompletionTestGenerated
- FirKeywordCompletionHandlerTestGenerated
2023-03-06 17:49:16 +00:00
Yan Zhulanow 342488e66e [LL API] Restrict accepted declarations for on-air resolution
After 1cfd2ae7ff, all non-local
declarations became targets for on-air resolution. However, some of
them, including secondary constructors, are not supposed to be used
in that way. The commit restores the previous behavior.

This commits fixes failing tests in the following groups:
- FirIdeDependentAnalysisSourceModuleIsUsedAsExpressionTestGenerated
- FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated
- FirOnAirResolveTestGenerated
2023-03-06 17:49:16 +00:00
Artem Kobzar 26f6661d1e [K/JS] Remove the possibility to have negative lines and columns in Source Maps 2023-03-06 16:55:26 +00:00
Pavel Kunyavskiy f2c1145462 [K/N] Disable failing test on mips, target is deprecated 2023-03-06 11:56:10 +00:00
Kirill Rakhman b80970b09f [FIR] Fix references to generic synthetic properties
When synthetic properties are built from a substitution override,
set originalForSubstitutionOverride, too.

^KT-56251 Fixed
2023-03-06 09:45:02 +00:00
Yan Zhulanow 37760d1f2a [Analysis API] Support script declarations (KTIJ-21108) 2023-03-05 19:18:21 +00:00
Yan Zhulanow e5e0575ab0 [LL API] Avoid dependencies in compiled element searcher
Library modules depend on all other project modules. Such a
simplification is useful for cross-library analysis. However, this
seems to be rather harmful for PSI->FIR binding as there might be
several versions of the same library in a project.
2023-03-05 19:18:20 +00:00
Yan Zhulanow 2d8c3c5aaf [LL API] Fix vararg parameter matching in PSI-FIR comparison 2023-03-05 19:18:20 +00:00
Yan Zhulanow 8b1be89507 [LL API] Check raw expect/actual modifiers in PSI-FIR comparison
There might be both common and JVM artifacts of the same library
in dependencies.
2023-03-05 19:18:20 +00:00
Yan Zhulanow 1cfd2ae7ff [LL API] Fix on-air analysis for scripts (KTIJ-21108)
The implementation is rather limited. Advanced cases, such as
replacing a script with another one with different import directives,
won't work because of non-trivial relationship between 'FirFile' and
'FirScript'.
2023-03-05 19:18:19 +00:00
Yan Zhulanow ae40ddcf03 [LL API] Provide basic support for scripts in K2 (KTIJ-21108) 2023-03-05 19:18:19 +00:00
Sergey Bogolepov ca7d1d0194 [K/N] Minor -Xcompile-from-bitcode enhancements 2023-03-04 16:13:43 +00:00
Johan Bay 349a6b6e82 Introduce flag for bitcode to native compilation
This enables splitting the compilation pipeline into multiple
invocations of the compiler.
2023-03-04 16:13:42 +00:00
vladislav.grechko 7033d78641 Fix SAM conversion generation condition
Remove check if array is passed to vararg parameter as it's not
relevant anymore and leads to ^KT-51821.

^KT-51821: Fixed
2023-03-04 12:53:48 +00:00
Yan Zhulanow c604577132 Embed DefaultErrorMessages extension list (KT-57102)
Normally, 'DefaultErrorMessages' extensions should only be loaded
from the main compiler JAR. However, in the in-process JPS build,
there are two versions of the compiler classes in the process, and
'ClassLoader's there are not fully isolated.

'ServiceManager' loads extensions from both 'META-INF' locations. If
the JPS plugin bundles newer compiler components, newly appeared
'DefaultErrorMessages' extensions will be loaded from the JPS (parent)
'ClassLoader', causing an exception.

Such a problem appeared with 'DefaultErrorMessagesWasm':

- - - - -
java.util.ServiceConfigurationError:
org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages$Extension: org.jetbrains.kotlin.wasm.resolve.diagnostics.DefaultErrorMessagesWasm not a subtype
- - - - -
2023-03-04 06:38:34 +00:00
Sergej Jaskiewicz f40278c036 An option to allow out-of-scope type parameters in IrManglerComputer
In the lowered IR there are often references to type parameters whose
containers are not in the current scope. This is incorrect semantically,
but it works in practice due to erasure, so when the mangler is used on
the lowered IR, we don't want to crash the compiler.
2023-03-03 22:08:57 +00:00
Sergej Jaskiewicz e3a4d6fa56 Use star-projected types for building ScriptProvidedPropertyDescriptors
Otherwise, the type parameters of the `kotlin.script.state` property
of type `AggregatedReplStageState` were undefined, which led to
building an ill-formed signature for the script class constructor.
2023-03-03 22:08:57 +00:00
Sergej Jaskiewicz 27adfa8370 [FIR] Provide the correct type parameters when building arrayOf function 2023-03-03 22:08:56 +00:00
Sergej Jaskiewicz 88e244c1cf [IR] Remove JS-specific manglers, as they don't customize any behavior 2023-03-03 22:08:56 +00:00
Sergej Jaskiewicz 1651199ed8 [IR] Add doc comments for KotlinMangleComputer and its inheritors 2023-03-03 22:08:56 +00:00
Sergej Jaskiewicz c447b91101 [IR] Factor out duplicated code in KotlinMangleComputer into base class 2023-03-03 22:08:55 +00:00
Ivan Kochurkin de5b475f7a [FIR] Use KlibBasedSymbolProvider in FirCommonSessionFactory
Unify logic of KLib resolving (Common and JS)

^KT-56354 Fixed
2023-03-03 20:58:24 +00:00
Ivan Kochurkin d829f8b684 [FIR] Drop using of JavaSymbolProvider and OptionalAnnotationClassesProvider in FirCommonSessionFactory
Drop using of all Java stuff inside FirCommonSessionFactory

^KT-56063
2023-03-03 20:58:24 +00:00
Svyatoslav Kuzmich 4be359ba02 [Wasm] Add @SinceKotlin("1.9") to js(code) 2023-03-03 19:39:12 +00:00
Svyatoslav Kuzmich c9c0b9fd10 [Wasm] Add more jsCode diagnostic tests with String properties 2023-03-03 19:39:11 +00:00
Svyatoslav Kuzmich 3566d918d2 [Wasm] Deprecate @JsFun with warning
kotlin.js.js("code") should be used instead
2023-03-03 19:39:11 +00:00
Svyatoslav Kuzmich 01fcc84d73 [Wasm] Refactor callingWasmDirectly.kt test from @JsFun to @WasmImport 2023-03-03 19:39:11 +00:00
Svyatoslav Kuzmich 7175b9f31c [Wasm] Migrate usages of @JsFun to js("code") 2023-03-03 19:39:10 +00:00
Svyatoslav Kuzmich 7a04999e4a [Wasm] Add K1 compiler diagnostics for js(code) calls (KT-56955)
This function is handled as intrinsics and supported in limited context
2023-03-03 19:39:10 +00:00
Svyatoslav Kuzmich 60ef7fcb49 [Wasm] Suppress unused parameters warning for functions with JS body
These parameters can be used in js(code)
2023-03-03 19:39:09 +00:00
Svyatoslav Kuzmich 71e6b19760 [Wasm] Support restricted version of js("code") (KT-56955) 2023-03-03 19:39:09 +00:00
Svyatoslav Kuzmich eb8c47343a [Wasm] Don't use js("code") in browser API
Use internal newJsObject to create new objects instead.

This is a preparation for restricted js("code") support (KT-56955)
2023-03-03 19:39:09 +00:00
Pavel Mikhailovskii 086d914f64 Regenerate tests 2023-03-03 19:27:24 +01:00
Pavel Mikhailovskii a6e1826bbc Reimplement the fix for KtSuperTypeList.findEntry 2023-03-03 15:38:12 +00:00
Vyacheslav Gerasimov 499ab48d30 Revert "[Build] Fix compilation of kotlinx-atomicfu-runtime in 1.9.0"
This reverts commit 4ab39b908e.
2023-03-03 15:06:23 +00:00
Vyacheslav Gerasimov 34fcbb32ff Revert "[Build] Fix compilation of kotlin-js(-ir) libraries in 1.9.0 (stdlib and test)"
This reverts commit d39fd9416a.
2023-03-03 15:06:23 +00:00
Andrei Klunnyi 661a2626f3 KT-56632 Script configuration isn't loaded for embedded code snippets
From now on we load script configurations for embedded Kotlin code
snippets. Potentially this might lead to an extra load during a file
analysis.

IDEA side test for the change is here:
`HighlightingTestGenerated.Uncategorized#testKotlinInJavaInjection`

^KT-56632 fixed
2023-03-03 12:49:38 +00:00
Svyatoslav Kuzmich 3c35328c09 [Wasm] Fix overriding external fun with default parameters (Fix KT-56976) 2023-03-03 12:33:53 +00:00