Compare commits

...

1586 Commits

Author SHA1 Message Date
Dmitry Petrov
ef461d4a3a JVM_IR KT-36646 fuze primitive equality with safe call 2021-04-27 16:22:53 +03:00
Dmitry Petrov
eaf870bfd4 JVM_IR update test for KT-36637 2021-04-27 16:22:52 +03:00
Dmitry Petrov
e8982765c8 JVM_IR use static 'hashCode' for boxed primitives on JVM 1.8+ 2021-04-27 16:22:52 +03:00
Andrey Zinovyev
0c6066db74 [KAPT] Don't fail on illegal delegate
Kapt ignores error diagnostics, but backend can't
 compile such code at all
This is workaround so backend won't fail.
#KT-46176 Fixed
2021-04-27 16:18:44 +03:00
Ilmir Usmanov
0c0710bb79 Fix outer class accesses inside suspendImpl functions
We need to generate this$0 fields to get to the outer class and generate
accesses to these fields inside suspendImpl function.
 #KT-46214 Fixed
2021-04-27 10:44:18 +02:00
Pavel Kirpichenkov
71365d2452 [IDE] Move library dependency filtering to dependencies cache
The primary client of LibraryDependenciesCache is LibraryInfo,
but it is also used for maintaining modification trackers of
source-dependent libraries. Moving dependency filtering to
cache allows keeping all client in sync.

^KT-45908 In Progress
2021-04-27 10:14:13 +03:00
Mikhael Bogdanov
dfc6d85aee Enable runtime string concatenation by default (for -Xjvm-target=9 or greater)
#KT-42522 Fixed
2021-04-27 09:08:28 +02:00
Ilmir Usmanov
dc2485ae71 Support suspend functions as superinterfaces
Forbid mixing suspend and non-suspend functional supertypes.
Since JVM BE generates suspend functional types as non-suspend ones
with SuspendFunction marker interface, there is not way to distinguish
non-suspend functional type from suspend one if they are mixed.
 #KT-18707 Fixed
2021-04-26 22:14:32 +02:00
Alexander Udalov
37ccd82b6c Fix some warnings in kotlin-gradle-plugin 2021-04-26 22:02:26 +03:00
Alexander Udalov
19a5c2f1c8 Fix warnings related to appendln in kotlin-gradle-plugin
`appendln` is deprecated, but its replacement `appendLine` can't be used
yet in kotlin-gradle-plugin because it's compiled with API version 1.3.
2021-04-26 22:02:25 +03:00
Alexander Udalov
e5128a8772 Improve generated code for Gradle properties
Fix warnings about double nullability and useless elvis.
2021-04-26 22:02:24 +03:00
Svyatoslav Kuzmich
ccc27b6a0c [IR] Add module property to IrFile 2021-04-26 18:52:42 +03:00
Vasily Levchenko
6f2af740cb [kotlin-native][tests][lldb] adds possibility to run simple lldb scenarious with simulator 2021-04-26 14:46:51 +00:00
Ilya Gorbunov
ed3542cdf5 Support covariant MutableMap.entries.remove in JS/IR
Workaround for KT-43321
Follow up to KT-41278
2021-04-26 17:45:27 +03:00
Anton Yalyshev
666ad1f9d5 1.5.0 Change-notes correction. Restore excessively removed items 2021-04-26 16:23:11 +03:00
Anton Yalyshev
ea7ea979ee 1.5.0 Change-notes correction according to KT-42522 2021-04-26 16:01:00 +03:00
Ilya Kirillov
e2acc507d4 FIR IDE: fix inconsistency in element collecting in DiagnosticTraversalCounterTest 2021-04-26 15:11:47 +03:00
Dmitriy Novozhilov
9cb740bfdb Fix tests broken in c6fa3634 2021-04-26 15:11:46 +03:00
Steven Schäfer
a1c1a32515 JVM: Fix unsigned literals in API version < 1.5 2021-04-26 15:11:45 +03:00
Mark Punzalan
af2d0ad36f FIR: Properly set light-tree source for all nested types (e.g.,
nullable function type) and error type refs.
2021-04-26 15:11:44 +03:00
Mark Punzalan
1835185b16 FIR: Remove duplicated diagnostics on annotations on types. 2021-04-26 15:11:43 +03:00
Mark Punzalan
edb6b337dc FIR: Resolve anonymous function bodies during
IMPLICIT_TYPES_BODY_RESOLVE phase.

This fixes an issue where some FirAnnotationCalls can be left with some
implicit type refs if they have anonymous functions in the arguments.
2021-04-26 15:11:42 +03:00
Mark Punzalan
e69b729e21 FIR checker: Create a new kind of checker FirTypeChecker and add
FirSuspendModifierChecker to report WRONG_MODIFIER_TARGET for `suspend`
on  non-functional types.
2021-04-26 15:11:41 +03:00
Dmitriy Novozhilov
4282d17467 [FIR] Optimize imports 2021-04-26 15:11:40 +03:00
Mark Punzalan
b88913af1d FIR checker: Report WRONG_MODIFIER_TARGET for suspend on
non-functional types.
2021-04-26 15:11:39 +03:00
Mark Punzalan
9a4742c08d FIR: Properly build nullable suspend function types, and aggregate
modifiers and annotations within KtTypeReference/REFERENCE_TYPE nodes.
2021-04-26 15:11:38 +03:00
Mark Punzalan
9cf5ac1fbd FIR: Render "?" on nullable function types. 2021-04-26 15:11:37 +03:00
Ilya Gorbunov
a9cc046ec9 Add missing constructor for expect annotation class JvmRecord
KT-46280
2021-04-26 10:41:49 +00:00
Alexander Dudinsky
2c29957cb8 Move tests from GradleImportingTestCase to MultiplePluginVersionGradleImportingTestCase 2021-04-26 13:20:00 +03:00
Alexander Dudinsky
e96f64e6c9 Refactor MultiplePluginVersionGradleImportingTestCase
By this commit:
- Used `isTeamcityBuild` flag for a separating local run of the tests from CI
  For local run by default uses master version of gradle-plugin and
  LATEST_SUPPORTED_GRADLE_VERSION of the Gradle.
  But you can specify versions for local run by overriding sysenv
  `IMPORTING_TESTS_LOCAL_RUN_PARAMS`.
  For example: export IMPORTING_TESTS_LOCAL_RUN_PARAMS=6.7.1:1.4.30
- Moved main logic from `GradleImportingTestCase` to
  `MultiplePluginVersionGradleImportingTestCase` for removing the first one later
- Removed `AbstractModelBuilderTest` as useless only
 `DistributionLocator` left from this class.
2021-04-26 13:19:59 +03:00
Ilya Gorbunov
b59f668a50 Change the way kotlin.js source map paths are postprocessed
The idea is that we do no longer use `sourceMapBaseDirs` parameter
of `compileKotlin2Js` task to remove prefix from source paths,
but instead preserve the full paths relative to the output directory.
This allows us to avoid duplicate file names and to identify
source files more reliably.
Then, after sources have been embedded in the source map, we remove
several relative prefixes from source paths.
2021-04-26 13:13:21 +03:00
Mikhail Glukhikh
29d2a6acee FIR: fold String arguments inside string concatenation call
Related to KT-28006
2021-04-26 12:50:57 +03:00
Mikhail Glukhikh
f278de8768 FIR: don't call toString() inside string concatenations 2021-04-26 12:50:55 +03:00
Igor Chevdar
7dcdbf283b [box-tests] Added test 2021-04-26 11:53:27 +05:00
Igor Chevdar
eb1dcdb344 [K/N][IR] Fixed bug with enum companion init
Fixes https://youtrack.jetbrains.com/issue/KT-46048
2021-04-26 11:53:27 +05:00
Igor Chevdar
476b3befaf [K/N][IR] Refactored enums lowering a bit 2021-04-26 11:53:26 +05:00
Andrey Zinovyev
01dd3d6ed4 [lombok] Refactoring, cleaning, better tests
Add assertions to tests
Add lombok license
Provide String.[de]capitalize() implementation
Get rid of weak map because it seems it is useless here
2021-04-25 18:18:18 +03:00
Andrey Zinovyev
c4147bc2fd [lombok] Add integration test for gradle plugin 2021-04-25 18:18:17 +03:00
Andrey Zinovyev
5a6819daa8 [lombok] Check that nullability actually works 2021-04-25 18:18:16 +03:00
Andrey Zinovyev
1fb4590978 [lombok] Some cleaning and docs 2021-04-25 18:18:15 +03:00
Andrey Zinovyev
9ebce7849c [lombok] Skip generation with AccessLevel.NONE 2021-04-25 18:18:15 +03:00
Andrey Zinovyev
be4a518a25 [lombok] Support for lombok.accessors.prefix config 2021-04-25 18:18:14 +03:00
Andrey Zinovyev
17e4a6142c [lombok] Strip prefixes defined in @Accessors 2021-04-25 18:18:13 +03:00
Andrey Zinovyev
f2c0b8c68d [lombok] Strip 'is' prefix in boolean properties 2021-04-25 18:18:12 +03:00
Andrey Zinovyev
8a2279de2b [lombok] Use config values as default in annotation parsing 2021-04-25 18:18:11 +03:00
Andrey Zinovyev
c7b2c731af [lombok] Basic @Value support 2021-04-25 18:18:11 +03:00
Andrey Zinovyev
97fc187e77 [lombok] @Data support 2021-04-25 18:18:10 +03:00
Andrey Zinovyev
99f9b79c87 [lombok] Add simple way to use lombok plugin in one project with kapt 2021-04-25 18:18:09 +03:00
Andrey Zinovyev
79d49e6dbd [lombok] Gradle sublugin for no-kapt project 2021-04-25 18:18:08 +03:00
Andrey Zinovyev
8011452c28 [lombok] Don't generate members that already exist 2021-04-25 18:18:07 +03:00
Andrey Zinovyev
d459cde010 [lombok] Run compiled code 2021-04-25 18:18:06 +03:00
Andrey Zinovyev
411441c332 [lombok] Generic classes support 2021-04-25 18:18:06 +03:00
Andrey Zinovyev
afcb2ca904 [lombok] Support @RequiredArgsConstructor 2021-04-25 18:18:05 +03:00
Andrey Zinovyev
b336a335bf [lombok] Support @AllArgsConstructor 2021-04-25 18:18:04 +03:00
Andrey Zinovyev
59f936fdef [lombok] Generate no-arg static factory method 2021-04-25 18:18:03 +03:00
Andrey Zinovyev
37926f333e [lombok] Generate no-arg constructor 2021-04-25 18:18:03 +03:00
Andrey Zinovyev
e9a33e0335 [lombok] Introduce synthetic constructors generation 2021-04-25 18:18:02 +03:00
Andrey Zinovyev
e0216cc9f4 [lombok] Add readme with (not) supported features 2021-04-25 18:18:01 +03:00
Andrey Zinovyev
e0a95ff556 [lombok] @With support 2021-04-25 18:18:00 +03:00
Andrey Zinovyev
7fd8f7b3bc [lombok] @Setter support 2021-04-25 18:17:59 +03:00
Andrey Zinovyev
70e3877efc [lombok] Basic config support 2021-04-25 18:17:57 +03:00
Andrey Zinovyev
5ceefa3e3b [lombok] Support for class level @Getter 2021-04-25 18:17:56 +03:00
Andrey Zinovyev
e4bd33eb4f [lombok] Support for fluent getters 2021-04-25 18:17:55 +03:00
Andrey Zinovyev
f71e08df4d [lombok] Experimental lombok plugin prototype
Add extension point for java descriptors
Add simple usage of this point to generate getter method
Add simple test infrastructure to test compilation with lombok plugin
2021-04-25 18:17:53 +03:00
Yahor Berdnikau
ac86ad252f Optionally make java executable path contribute to the daemon id.
This change will allow to start Kotlin daemon instances using different
from the current user JDK version and use it to compile Kotlin files.
Old behaviour, when java executable path is not set, is still working
 and still,by default, using current user JDK version.

For example, user for some reason wants to use JDK 1.8 as active one,
 but compile current project using JDK 16.

Main goal is to support Gradle toolchains.

^KT-45611 In Progress
2021-04-24 11:12:47 +03:00
Yahor Berdnikau
1d47f4ad2b Consolidate compiler id digest.
Change all calculations of compiler id digest to use
 'CompilerId#digest()' method.

^KT-45611 In Progress
2021-04-24 11:12:46 +03:00
Simon Ogorodnik
c6fa363487 [FIR] Add warning if FIR is used 2021-04-23 19:49:46 +03:00
Victor Petukhov
7a81d0de8a Regenerate tests 2021-04-23 19:28:26 +03:00
sebastian.sellmair
7be48a0b4b CommonizerHierarchicalIT: Enable test commonizeHierarchicallyMultiModule
^KT-46107 Fixed
2021-04-23 16:25:59 +00:00
sebastian.sellmair
63e5298be9 Update 'versions.kotlin-native' to 1.5.20-dev-5613
^KT-46107
2021-04-23 16:25:59 +00:00
Konstantin Tskhovrebov
b894b7df6e Add integration tests for "assembleAppleFrameworkForXcode" and "embedAndSignAppleFrameworkForXcode" tasks. 2021-04-23 19:23:58 +03:00
Konstantin Tskhovrebov
c8ef0715b9 Register "assembleAppleFrameworkForXcode" and "embedAndSignAppleFrameworkForXcode" tasks when gradle is run from Xcode.
#KT-27240
2021-04-23 19:23:57 +03:00
Alexander Udalov
0c3f2eefe0 Migrate bytecodeListing tests to new test infrastructure 2021-04-23 17:58:16 +02:00
Alexander Udalov
7e170770ea Minor, move around bytecode listing tests 2021-04-23 17:58:16 +02:00
sebastian.sellmair
28690b7f32 KotlinToolRunner: Add "java.system.class.loader" to execSystemPropertiesBlacklist
IDE integration tests will forward an unvailable intellij classloader
which will fail the execution.
2021-04-23 14:34:17 +00:00
sebastian.sellmair
7b8926f85b [Commonizer] Allow propagation of leaf targets
^KT-46248 Verification Pending
2021-04-23 14:34:17 +00:00
sebastian.sellmair
7c1520a424 [Commonizer] Implement SingleTargetPropagationTest to cover KT-46248
^KT-46248
2021-04-23 14:34:16 +00:00
sebastian.sellmair
965e328766 CommonizerIT: implement test KT-46248 single supported native target dependency propagation to cover KT-46248
^KT-46248
2021-04-23 14:34:15 +00:00
Mikhail Glukhikh
683872ecbf FIR: use more precise checkers when possible 2021-04-23 17:29:43 +03:00
Mikhail Glukhikh
5c224ad17c FIR: fix positioning in fun interface checker 2021-04-23 17:29:34 +03:00
Артём
393a19db54 FIR: introduce FunInterfaceDeclarationChecker 2021-04-23 17:29:25 +03:00
Victor Petukhov
867d7b5bca Allow type variable fixation into intersection type if it isn't meaningless (i.e. has one or more final classes, or two or more open classes)
^KT-46186 Fixed
2021-04-23 15:12:13 +03:00
Victor Petukhov
310d98c4f7 Don't require existence of the corresponding type argument during computing target type to apply type use annotation loaded from class file
^KT-46131 Fixed
2021-04-23 15:12:12 +03:00
sebastian.sellmair
13b1664edf CommonizerIT: Implement additional test KT-46142 standalone native source set
^46142
Before this test, the behaviour was tested as integration test in the IDE.
This Gradle integration test will detect issues even earlier.
2021-04-23 15:02:15 +03:00
Konstantin Tskhovrebov
ee4a1d173d Revert "Add integration tests for "assembleAppleFrameworkForXcode" and "embedAndSignAppleFrameworkForXcode" tasks."
This reverts commit 6db3960d
2021-04-23 12:11:42 +03:00
Konstantin Tskhovrebov
8840a9ecd1 Revert "Register "assembleAppleFrameworkForXcode" and "embedAndSignAppleFrameworkForXcode" tasks when gradle is run from Xcode."
This reverts commit c2cdf9c7
2021-04-23 12:11:19 +03:00
Ilmir Usmanov
f7a9bc3521 Minor. Make test actually suspend and add a test without suspension 2021-04-23 03:50:08 +02:00
pyos
23ffbe4d9e JVM_IR: do not box inline classes in suspend multifile bridges 2021-04-23 03:49:47 +02:00
pyos
7d95943b8b JVM_IR: do not box inline classes in suspend synthetic accessors 2021-04-23 03:49:43 +02:00
Alexander Likhachev
857bee6ced [Build] Remove empty source directories warning
There're should be no more cache misses on empty directories with Gradle 6.8. See https://docs.gradle.org/6.8/release-notes.html#more-cache-hits-when-empty-directories-are-present
2021-04-23 03:52:45 +03:00
Alexander Likhachev
03f9d78eb3 [Build] Add workaround to make local publishing serializable
Also signing plugin now being applied only when signing is required.
#KT-44611 In Progress
2021-04-23 03:52:41 +03:00
Sergey Igushkin
4e6c483ccc Add a final override for project in KotlinGradleFragmentInternal 2021-04-23 00:43:14 +03:00
Sergey Igushkin
bb35d9271f Minor fix: don't use lazy in KotlinPm20ProjectExtension.modules 2021-04-23 00:43:14 +03:00
Sergey Igushkin
53f02a53f0 Add caching to dependency resolvers in PM20 + some refactoring 2021-04-23 00:43:13 +03:00
Sergey Igushkin
1f0089c5de Refactor the dependency graph resolver to be more readable 2021-04-23 00:43:13 +03:00
Sergey Igushkin
d07c76fca4 Add kotlin-project-model artifacts to the set of trusted artifacts 2021-04-23 00:43:12 +03:00
Sergey Igushkin
6be33448d6 Rework adding sources to FilteringSourceRootsContainer in JVM tasks
Support adding lazily-evaluated file collections (i.e. tracking their
source roots lazily, as opposed to eagerly evaluating the source roots.
2021-04-23 00:43:12 +03:00
Sergey Igushkin
e59a57d11c Add ":kotlin-project-model" to the list of modules installed for tests 2021-04-23 00:43:11 +03:00
Sergey Igushkin
e7b81c52a7 Get rid of DependencyDiscovery in favor of DependencyGraphResolver 2021-04-23 00:43:11 +03:00
Sergey Igushkin
d602470027 Fix compilation of the tests in kotlin-project-model 2021-04-23 00:43:10 +03:00
Sergey Igushkin
fe351f26ef For now, publish the sources elements variant with usage=kotlin-sources 2021-04-23 00:43:10 +03:00
Sergey Igushkin
a94597d85a Experimental sources publication in the PM2.0 prototype 2021-04-23 00:43:10 +03:00
Sergey Igushkin
44fcd7e891 Use KotlinCompilationTaskConfigurator for metadata compilation tasks 2021-04-23 00:43:09 +03:00
Sergey Igushkin
4cb6303fa8 Get rid of kotlinPluginVersion in the constructors throughout the plugin
We passed the kotlinPluginVersion which was only used for a single
purpose in countless constructors.

In fact, the plugin version is easy to load at the call site, as it gets
loaded from the plugin's resources.

So rework the plugin version loading code so that it doesn't rely on the
applied plugin, and don't pass the plugin version in all those
constructors.
2021-04-23 00:43:09 +03:00
Sergey Igushkin
2a5d511b66 Minor fix: handle kotlinOptions more carefully, store them where needed 2021-04-23 00:43:08 +03:00
Sergey Igushkin
00e5e462ea Further refactor compile task configuration: extract the configurator 2021-04-23 00:43:08 +03:00
Anton Lakotka
1a85da5ff8 Make language settings nullable in KotlinModuleFragment
There is no lang settings when importing from klibs (yet)
2021-04-23 00:43:07 +03:00
Anton Lakotka
c3264a2979 Add language consistency checks for fragments
Migrate exiting consistency checker for source sets to be generic
and reuse it for fragments
2021-04-23 00:43:07 +03:00
Anton Lakotka
de4221afd8 Add immutable LanguageSettings interface and apply it to compilation
LanguageSettingsBuilder extends LanguageSettings
2021-04-23 00:43:06 +03:00
Sergey Igushkin
54c6ae2cce (minor) Rename modelClasses.kt -> KotlinJvmVariantFactory.kt 2021-04-23 00:43:06 +03:00
Sergey Igushkin
3be2734c63 Refactor the setup of compilation in the PM20 implementation prototype 2021-04-23 00:43:05 +03:00
Sergey Igushkin
c1fe0d7158 Add publishing configurator, call it from the variant factories 2021-04-23 00:43:05 +03:00
Sergey Igushkin
1271fabffa Fix Maven scope mapping for the runtime dependencies in PM20 publishing 2021-04-23 00:43:04 +03:00
Sergey Igushkin
27015a657c Don't pass the IDE paths to the extracted klibs that don't exist 2021-04-23 00:43:04 +03:00
Sergey Igushkin
470103bfac Don't rely on the current project in dep-resolution if module is given 2021-04-23 00:43:04 +03:00
Sergey Igushkin
f029179fe0 Add basic support for Kotlin/Native variants to the PM20 Gradle plugin 2021-04-23 00:43:00 +03:00
Sergey Igushkin
401fbae8d8 Handle dependency module IDs more carefully in dependency resolution 2021-04-23 00:42:37 +03:00
Sergey Igushkin
ea458e6848 Add some API interfaces for Gradle PM20 entities in the API module 2021-04-23 00:42:37 +03:00
Sergey Igushkin
a52c6858a9 Minor fixes in exposed configurations 2021-04-23 00:42:37 +03:00
Sergey Igushkin
134fb7741e Fix getChosenVariant implementation for project(...) dependencies 2021-04-23 00:42:36 +03:00
Sergey Igushkin
ec3fa2610e Support basic publishing with maven-publish in the PM20 plugin 2021-04-23 00:42:36 +03:00
Sergey Igushkin
0bf408e147 (minor) Add isAllowCommonizer stub to the PM2.0 project extension
This prevents the IDE from failures during Gradle project sync
2021-04-23 00:42:35 +03:00
Sergey Igushkin
4e0485c523 Expose compiled metadata for project deps, set capabilities on elements 2021-04-23 00:42:35 +03:00
Sergey Igushkin
147fd22cfb (minor) Fix static init issue with Gradle multi-threaded resolve 2021-04-23 00:42:35 +03:00
Sergey Igushkin
f1f97b4104 Support published MPP consumption with PM2.0 projects 2021-04-23 00:42:34 +03:00
Sergey Igushkin
70b88ada93 Gradle plugin prototype that uses the project model 2.0 2021-04-23 00:42:34 +03:00
Sergey Igushkin
d66f95b80e Resolve dependencies as graph, support multiple modules in a project 2021-04-22 23:42:06 +03:00
Sergey Igushkin
f1fb438d00 Refactor: make fragments resolver consistent with variant resolver 2021-04-22 23:42:05 +03:00
Sergey Igushkin
7103aa3100 ModuleOrigin -> ModuleIdentifier 2021-04-22 23:42:04 +03:00
Sergey Igushkin
66b8a444c2 Add a basic markdown doc explaining dependency resolution. 2021-04-22 23:42:02 +03:00
Sergey Igushkin
6aee396e4b Build PM2.0 in o.j.k.multiplatform (+ dependency resolution API) 2021-04-22 23:42:01 +03:00
Sergey Igushkin
994f940a31 Dependency resolution API in PM2.0 2021-04-22 23:42:00 +03:00
Sergey Igushkin
f189ebc983 Project Model 2.0 initial commit: core entities 2021-04-22 23:41:59 +03:00
Konstantin Tskhovrebov
6db3960d56 Add integration tests for "assembleAppleFrameworkForXcode" and "embedAndSignAppleFrameworkForXcode" tasks. 2021-04-22 20:33:20 +03:00
Konstantin Tskhovrebov
c2cdf9c796 Register "assembleAppleFrameworkForXcode" and "embedAndSignAppleFrameworkForXcode" tasks when gradle is run from Xcode.
#KT-27240
2021-04-22 20:33:20 +03:00
Alexander Udalov
99e022d023 IR: minor, remove duplicate visibility field 2021-04-22 17:42:18 +02:00
Dmitriy Novozhilov
d4162f876f [FIR] Fix some warnings 2021-04-22 14:32:06 +03:00
Dmitriy Novozhilov
234ab3b35d [FIR] Fix all illegal usages of declarationSiteSession in compiler
There are still some usages in IDE which should be investigated
2021-04-22 14:32:04 +03:00
Dmitriy Novozhilov
f98f41bbc3 [FIR] Rename session to declarationSiteSession in declaration builders 2021-04-22 14:32:03 +03:00
Dmitriy Novozhilov
c3b1be1a39 [FIR] Rename FirDeclaration.session to declarationSiteSession 2021-04-22 14:32:02 +03:00
Dmitriy Novozhilov
46f5c2073d [FIR] Make most of declarations a sealed classes/interfaces 2021-04-22 14:32:00 +03:00
Dmitriy Novozhilov
7f7373dad2 [FIR] Support sealed classes and interfaces in FIR tree generator 2021-04-22 14:31:59 +03:00
Dmitriy Novozhilov
951daeea3a [FIR] Add typealias to AbstractFirBasedSymbol<*> in FirDiagnosticsList 2021-04-22 14:31:58 +03:00
Vasily Levchenko
1ae41443a2 [kotlin-native][build] clean task fix 2021-04-22 11:16:55 +00:00
Jinseong Jeon
24d792fb49 FIR checker: warn useless elvis 2021-04-22 13:10:54 +03:00
Alexander Udalov
b2005302dc JVM, JVM IR: erase generic SAM supertypes
Also, do not try to use invokedynamic on SAM calls with intersection
types, because intersection type is not allowed as an immediate type
projection of a supertype, and constructing a fake override in
LambdaMetafactoryArgumentsBuilder led to an exception. This fixes the
problem which was worked around earlier in e6c089ef, effectively
reverting that commit.

The main motivation for this change is that LambdaMetafactory also
doesn't generate generic signature for SAM wrapper classes at runtime.
Since these classes are synthetic, nobody should rely on the fact that
they have generic supertypes, which was observable only via Java
reflection.

 #KT-46149 Fixed
 #KT-46238 Fixed
2021-04-22 10:53:15 +02:00
Andrey Zinovyev
1093bffc62 [KAPT] Cache annotation processors' classloaders
Adds experimental feature to cache annotation processors' classloaders
It should increase speed of KAPT for consecutive runs
Works for gradle only (it stores cl in gradle daemon)
#KT-28901 Fixed
2021-04-22 11:51:14 +03:00
Mikhail Glukhikh
e6b9935df9 FIR: drop source-based check from InferenceUtils 2021-04-22 10:26:47 +03:00
sebastian.sellmair
75d9cd3814 [Minor] KotlinLibraryResolverImpl: Improve readability in resolveDependencies 2021-04-21 20:05:57 +00:00
sebastian.sellmair
3c4d0a1814 CInteropCommonizerTask: Mark dependency on commonized native distribution as @Classpath 2021-04-21 20:05:56 +00:00
sebastian.sellmair
f4617b2c03 Do not forward external dependencies on c-interop commonization.
^KT-46109
^KT-46107 Fixed
2021-04-21 20:05:56 +00:00
sebastian.sellmair
22ea5c7de4 Demote fatal error to warning on unresolved libraries mentioned in Klib's manifest 'depends' for metadata compilation
^KT-46107
2021-04-21 20:05:55 +00:00
sebastian.sellmair
95a1a4e66a CommonizerHierarchicalIT: Implement test commonizeHierarchicallyMultiModule
^KT-46107
2021-04-21 20:05:54 +00:00
sebastian.sellmair
5fb30b05ff Implement CommonizerIT.test KT-46234 intermediate source set with only one native target to cover KT-46234
^KT-46234
2021-04-21 20:05:06 +00:00
Ilya Kirillov
e2786197ff FIR IDE: support reporting of FirLightSourceElement based diagnostics 2021-04-21 22:22:32 +03:00
Ilya Kirillov
47e8b2f9dc FIR IDE: remove copy-pasted code from DeclarationCopyBuilder 2021-04-21 21:17:00 +03:00
Ilya Kirillov
a76c5d66eb FIR: introduce FirDeclarationBuilder as a base class for all FIR declaration builders 2021-04-21 21:16:58 +03:00
Ilya Kirillov
da6c5e13d5 FIR IDE: add completion support to classes and to type aliases 2021-04-21 21:16:56 +03:00
Ilya Kirillov
a5c33c8d42 FIR IDE: simplify completion context retrieving 2021-04-21 21:16:55 +03:00
Mikhail Zarechenskiy
f8efe3b5df Make function open to overrie it IDE specific part
Namely, this function is overrided in 211 & 212 platforms, see ScriptDefinitionsManager
2021-04-21 20:00:22 +03:00
Dmitry Petrov
5324cbe729 Minor: update tests 2021-04-21 19:10:32 +03:00
Steven Schäfer
8c9ad81c76 Psi2Ir: Fold constants when generating IR
This is necessary to avoid stack overflow errors on large constant
expressions.
2021-04-21 19:10:31 +03:00
Steven Schäfer
e87d816994 Psi2Ir: Remove unused code 2021-04-21 19:10:31 +03:00
Steven Schäfer
d3d4e94cd6 JVM: Fix constant folding for unsigned values 2021-04-21 19:10:31 +03:00
Dmitry Petrov
732405895f Add tests for KT-45308 2021-04-21 17:36:12 +03:00
Dmitry Petrov
f228c3bb04 Add tests for KT-45236 2021-04-21 17:24:41 +03:00
Yahor Berdnikau
4f352950d9 Include Dukat generated sources into generic 'sourcesJar' output.
Gradle 7 complains that "sourcesJar" task uses inputs from Dukat
generate task outputs directory, but this tasks does not have explicit
dependency.

^KT-46006 Fixed
2021-04-21 16:48:16 +03:00
Mikhail Glukhikh
a097a58edf Introduce helper FirExpression.unwrapArgument() in fir:tree 2021-04-21 16:19:09 +03:00
pyos
e6d923f65c FIR: rename HIDDEN to INVISIBLE_REFERENCE
Some of them should be INVISIBLE_MEMBER though
2021-04-21 16:18:21 +03:00
pyos
f1cf6b54e7 FIR2IR: convert some error calls to non-error IR
This allows suppressing "invisible reference"-type errors, which some
people do in production code.
2021-04-21 16:02:01 +03:00
Mikhail Glukhikh
6833e83a6f Minor fix in FirInlineClassDeclarationChecker 2021-04-21 16:01:51 +03:00
Alexander Udalov
7fe10e27a1 Minor, fix failing codegen tests on different JDKs
#KT-46238
2021-04-21 14:43:10 +02:00
Anton Yalyshev
fe5e968896 Add change-notes for 1.5.0 release 2021-04-21 14:13:46 +03:00
Vladimir Dolzhenko
590a8d088d Refine locking to avoid dead lock
#KT-46215 Fixed
2021-04-21 11:01:12 +00:00
Mikhail Glukhikh
6ae4c3f281 Drop state from FirMethodOfAnyImplementedInInterfaceChecker 2021-04-21 13:22:14 +03:00
Mikhail Glukhikh
e0fe122ee9 Drop stored types from FirInlineClassDeclarationChecker 2021-04-21 13:22:13 +03:00
Mikhail Glukhikh
9bc3404833 Drop state from FirInapplicableLateinitChecker 2021-04-21 13:22:11 +03:00
Mikhail Glukhikh
e0c8a6658b FIR: handle annotations on non-containers more precisely 2021-04-21 13:22:10 +03:00
Mikhail Glukhikh
04daf8fce8 FIR: add messages for two accessor diagnostics 2021-04-21 13:22:09 +03:00
Julia
387dafb8c5 [FIR] Introduce AnnotationUsedAsAnnotationArgumentChecker 2021-04-21 13:22:07 +03:00
Alexander Udalov
27ddc31f15 Ignore codegen test using streams on Android 2021-04-21 11:39:08 +02:00
Dmitry Petrov
59de12c609 Minor: mute bytecode text check in some box tests failing in FIR 2021-04-21 11:27:12 +03:00
Dmitry Petrov
f519150c08 JVM_IR KT-46189 lower tailrec functions after local declarations 2021-04-21 11:27:11 +03:00
Sergey Bogolepov
645014092c Add a mention of KT-46231. 2021-04-21 15:14:33 +07:00
Ilya Gorbunov
4ae5efd6da Prevent calling AssertContentEquals with two Set arguments
It's unclear whether these sets are intended to be compared with
the unordered Set equality, or with the ordered Iterable equality.

KT-32996
2021-04-21 03:08:35 +03:00
Alexander Udalov
21e9bd7ea2 Add regression tests for obsolete issues
#KT-9304
 #KT-14961
 #KT-16549
 #KT-21080
 #KT-28234
 #KT-30102
 #KT-31994
 #KT-34291
 #KT-38099
 #KT-41174
 #KT-44622
 #KT-44701
 #KT-44781
 #KT-44849
 #KT-44978
 #KT-45081
 #KT-45286
 #KT-45383
 #KT-45444
 #KT-45907
2021-04-20 21:24:29 +02:00
Ivan Gavrilovic
2666a93e6a [Gradle] Avoid using dependsOn and add output provider to the file collection 2021-04-20 22:13:25 +03:00
Alexander Udalov
e6c089ef40 IR: fix SAM conversion for types with contravariant intersection argument type
In the added test, the problem was that the SAM type as computed by
`SamTypeFactory.createByValueParameter` was `Consumer<{BaseClass &
BaseInterface}>`, which was latter approximated in psi2ir during the
KotlinType->IrType conversion to `Consumer<out Any?>` (here:
3034d9d791/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt (L606)),
because intersection type argument is approximated to `out Any?`.

To avoid this, replace intersection type in immediate arguments of a SAM
type with the common supertype of its components at the same place where
we're getting rid of projections.

 #KT-45945 Fixed
2021-04-20 17:31:14 +02:00
Andrey Zinovyev
ac0af39660 [FIR][LT] Enable parallel execution for LT tests 2021-04-20 18:13:07 +03:00
Andrey Zinovyev
0a811bdd1a [FIR][LT] Don't store lexer in static context 2021-04-20 18:13:06 +03:00
Andrey Zinovyev
5fc1514104 [FIR][LightTree] Better expression identification
And some refactoring
Regenerate IDE parts
2021-04-20 18:13:06 +03:00
Andrey Zinovyev
2f7d6da22f [FIR][LightTree] Generate and fix missing tests
Add TYPE_PARAMETERS_LIST positioning
Use whole branch as source in when branches
2021-04-20 18:13:05 +03:00
Andrey Zinovyev
b9ae22207e [FIR] Fix tests data for diagnostic tests
For tests failed after light tree changes
2021-04-20 18:13:03 +03:00
Andrey Zinovyev
ee48fc320d [FIR][LightTree] Mark fake nodes in FOR loop
+ fix bunch of tests
2021-04-20 18:13:02 +03:00
Andrey Zinovyev
0a68edf3bd [FIR][LightTree] More fixes in diagnostic positioning
Keep tree padding for modifiers
More REFERENCE_EXPRESSIONS kinds
Fix source for some call expressions
2021-04-20 18:13:01 +03:00
Andrey Zinovyev
f3dc8dfb21 [FIR][LightTree] Use same fake elements kinds as in psi
Otherwise type resolution(!) for empty lambda works differently
2021-04-20 18:13:00 +03:00
Andrey Zinovyev
e8e9f67069 [FIR][LightTree] Enum and property source fixes
Also set dispatchReceiverType for properties from value params
2021-04-20 18:12:59 +03:00
Andrey Zinovyev
1fb8c3b1d7 [FIR][LightTree] Properly unwrap function inside parentheses 2021-04-20 18:12:58 +03:00
Andrey Zinovyev
05f0507cbb [FIR][LightTree] Proper source for enum constructor call 2021-04-20 18:12:57 +03:00
Andrey Zinovyev
bed45affe1 [FIR][LightTree] Don't report diagnostics on some nameless declarations 2021-04-20 18:12:56 +03:00
Andrey Zinovyev
684c4c2825 [FIR][LightTree] Don't position on trailing comments 2021-04-20 18:12:55 +03:00
Andrey Zinovyev
0d99b01dcb [FIR][LightTree] Pass source elements in FOR loop parts 2021-04-20 18:12:54 +03:00
Andrey Zinovyev
8bbdc20809 [FIR][LightTree] Pass source elements in when conditions 2021-04-20 18:12:54 +03:00
Andrey Zinovyev
9c8e92f5af [FIR][LightTree] Fix DEFAULT positioning strategy for object literals 2021-04-20 18:12:53 +03:00
Andrey Zinovyev
70f9b77cce [FIR][LightTree] Keep source in FOR loop elements 2021-04-20 18:12:52 +03:00
Andrey Zinovyev
27766c2575 [FIR] Consistent isLocal for objects inside Enum entries 2021-04-20 18:12:51 +03:00
Andrey Zinovyev
7084fec651 [FIR][LightTree] Position strategies fixes
Skip leading comments in DEFAULT strategy
Keep node offset 'padding' when getting child
2021-04-20 18:12:50 +03:00
Andrey Zinovyev
8ea3b52454 [FIR][LightTree] Fix finding error nodes in tree
When there are links to to 'upper levels' lt elements in fir tree
2021-04-20 18:12:49 +03:00
Andrey Zinovyev
dc19e39dd2 [FIR][LightTree] Properly locate return keyword 2021-04-20 18:12:47 +03:00
Andrey Zinovyev
088db0e138 [FIR] Report SEALED_CLASS_CONSTRUCTOR_CALL on expression 2021-04-20 18:12:46 +03:00
Andrey Zinovyev
48994976d4 [FIR][LightTree] Skip comments and whitespaces when marking elements 2021-04-20 18:12:45 +03:00
Andrey Zinovyev
dcbb1fb22b [FIR][LightTree] Extract syntax errors from subtrees 2021-04-20 18:12:45 +03:00
Andrey Zinovyev
7dedd04ed9 [FIR] Add SYNTAX diagnostics for light tree 2021-04-20 18:12:43 +03:00
Dmitriy Novozhilov
3e0eb06e3e [FIR] Add FirOldFrontendDiagnosticsWithLightTreeTestGenerated 2021-04-20 18:12:42 +03:00
Igor Yakovlev
e4870740e1 [LC] Fixed light classes nullability for Kotlin 1.5
Fixed #KT-44472
2021-04-20 15:21:12 +02:00
Igor Yakovlev
63160293fb [LC] Fix invalid nullability for properties
Fixed #KT-46097 and #KT-41671
2021-04-20 15:21:12 +02:00
Andrey Zinovyev
8071a1e246 [KAPT] Keep constant references in annotations with array values
#KT-29929 Fixed
2021-04-20 15:47:03 +03:00
Yahor Berdnikau
9e9450caa2 Fix adding associated compilation for Kotlin Native.
Kotlin native does not support 'compileOnly' or 'runtimeOnly'
configurations. In this case associated compilations are added as
'implementation'.

^KT-45911 Fixed
2021-04-20 10:15:15 +02:00
Abduqodiri Qurbonzoda
57c4f79c1c Update Char.digitToInt documentation 2021-04-20 04:36:05 +03:00
Ilya Kirillov
26e39b3d2a FIR IDE: do not resolve all members for getting inner classes for light classes 2021-04-20 01:32:26 +03:00
Ilya Kirillov
051310124b FIR IDE: do not fail duplicating classes with members 2021-04-20 01:32:25 +03:00
Mark Punzalan
73b796f184 FIR IDE: Enable RemoveExclExclCallFix for UNNECESSARY_NON_NULL_ASSERTION. 2021-04-19 22:29:07 +02:00
Mark Punzalan
34609b264d FIR IDE: Move RemoveExclExclCallFix to idea-frontend-independent. 2021-04-19 22:29:07 +02:00
Alexander Udalov
4fffed4165 Improve test on equals/hashCode for KProperty accessors
Remove duplication & unnecessary checks, check equality in both
directions, check hashCode, add more cases, rename variables for
clarity.

 #KT-13490
2021-04-19 20:39:54 +02:00
Xin Wang
c959b271a4 Override "hashCode" and "equals" for Getter and Setter to fix KT-13490 2021-04-19 20:39:54 +02:00
Dmitry Petrov
46d5e974df JVM_IR KT-46160 don't use LambdaMetafactory for mutifile class members 2021-04-19 19:32:34 +03:00
yantimirov-timur
1dfc3c0520 FIR: add getter visibility and setter return type checks 2021-04-19 19:21:09 +03:00
Abduqodiri Qurbonzoda
eedc4d8c3f [K/N] Fix measureTimeMillis and measureNanoTime doc 2021-04-19 19:14:34 +03:00
Abduqodiri Qurbonzoda
aa04f60df4 [K/N] Fix Floating.toInt/toLong doc 2021-04-19 19:14:33 +03:00
Abduqodiri Qurbonzoda
4c66c1c137 [K/N] Fix Primitive.shl/shr/ushr doc 2021-04-19 19:14:32 +03:00
Abduqodiri Qurbonzoda
19ecb78531 [K/N] Fix Primitive.rem doc 2021-04-19 19:14:30 +03:00
Abduqodiri Qurbonzoda
2cfbad9477 [K/N] Fix Primitive.div doc 2021-04-19 19:14:29 +03:00
Abduqodiri Qurbonzoda
b5e3dc414f Fix Array.iterator doc 2021-04-19 19:14:28 +03:00
Abduqodiri Qurbonzoda
8a1855e4da [K/N] Fix Range.isEmpty doc 2021-04-19 19:14:27 +03:00
Abduqodiri Qurbonzoda
71c5c8b20a Fix Range.isEmpty doc 2021-04-19 19:14:25 +03:00
Abduqodiri Qurbonzoda
fb4ddd2f6e [K/N] Fix StringBuilder.deleteRange doc 2021-04-19 19:14:23 +03:00
Abduqodiri Qurbonzoda
76b297fd73 [K/N] Fix StringBuilder.clear doc 2021-04-19 19:14:21 +03:00
Abduqodiri Qurbonzoda
597b18582a [K/N] Fix Char.isISOControl doc 2021-04-19 19:14:19 +03:00
Abduqodiri Qurbonzoda
bb2a50a4eb Fix Char.isISOControl doc 2021-04-19 19:14:17 +03:00
Abduqodiri Qurbonzoda
d1f18c4651 Add @see doc references to java isUpperCase and isLowerCase 2021-04-19 19:14:14 +03:00
Abduqodiri Qurbonzoda
22dcc92951 Fix Char.isTitleCase doc 2021-04-19 19:14:13 +03:00
Abduqodiri Qurbonzoda
e83ceb9d40 [K/N] Fix String.replace doc 2021-04-19 19:14:11 +03:00
Abduqodiri Qurbonzoda
36aee8f2b4 Fix String.replace doc 2021-04-19 19:14:10 +03:00
Abduqodiri Qurbonzoda
dab09e7052 Fix CharSequence.repeat doc 2021-04-19 19:14:08 +03:00
Ilya Goncharov
c73dadbcdf [Gradle, JS] Install dukat only if there is dependency with generateExternals
^KT-46178 fixed
2021-04-19 17:29:51 +03:00
pyos
dab693b075 Revert "JVM IR: Implement CHECK_NOT_NULL as a lowering"
This reverts commit dcd72b06d8.

Using a temporary variable has an effect on casts and GC.
2021-04-19 16:05:12 +02:00
Ilmir Usmanov
f5379c5a04 Add @JvmInline annotation in common code if JVM target is present
#KTIJ-8863 Fixed
 #KT-46088 Fixed
2021-04-19 16:56:31 +03:00
Ivan Kochurkin
00bc04b3df [FIR] Implement ELSE_MISPLACED_IN_WHEN diagnostics, fix tests 2021-04-19 15:46:38 +03:00
Dmitry Petrov
7f4da93cc3 JVM_IR KT-45998 protected companion object member accessors with indy 2021-04-19 15:41:21 +03:00
Dmitry Petrov
9a4a39e680 JVM_IR KT-45998 fix protected companion object member accessors
Also, make sure it works with indy-based SAM conversions.
2021-04-19 15:41:19 +03:00
Mikhail Glukhikh
b1fb0ba9e1 Fix FirDiagnosticsList (remove earlier dropped FirSourceElements) 2021-04-19 15:29:07 +03:00
Mikhail Glukhikh
8a2cab346a Fix FIR IDE tests (EXPRESSION_EXPECTED, ITERATOR_MISSING, etc.) 2021-04-19 15:11:17 +03:00
Tianyu Geng
b5caa658d6 FIR: introduce delegate diagnostics
This commit adds diagnostics for the following

* DELEGATE_SPECIAL_FUNCTION_MISSING
* DELEGATE_SPECIAL_FUNCTION_AMBIGUITY
* DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE
2021-04-19 15:11:16 +03:00
Tianyu Geng
454ae3b17a FIR checker: report UNSAFE_CALL for overloaded function calls
Previously if an unsafe call is to an overloaded function, FIR checkers
report NONE_APPLICABLE. This change instead report them as UNSAFE_CALL
or its variants.
2021-04-19 15:11:13 +03:00
Mikhail Glukhikh
92df1f575a Fir2IrVisitor: simplify creating for-loop blocks due to changed FIR side 2021-04-19 15:11:13 +03:00
Tianyu Geng
6a03f31e50 FIR: add UnsafeCall resolution diagnostics
Previously unsafe call is reported as part of InapplicableWrongReceiver.
This makes it difficult for the downstream checkers to report different
diagnostics.
2021-04-19 15:11:13 +03:00
Mikhail Glukhikh
43a2ad0467 FIR: don't flatten for loop blocks in raw FIR builder 2021-04-19 15:11:12 +03:00
Mikhail Glukhikh
a736d62edd FirForLoopChecker: report also OPERATOR_MODIFIER if appropriate + minor
This commits checks iterator/hasNext/next functions whether they are
declared as operator or not. Also, it changes logic of hasNext/next
error reporting, now we're able to report errors about both these
functions.
2021-04-19 15:11:10 +03:00
Mikhail Glukhikh
2e14b65644 Introduce FirForLoopChecker 2021-04-19 15:10:58 +03:00
Mikhail Glukhikh
4ddc0ed3fe FIR: introduce block checkers 2021-04-19 15:10:39 +03:00
Mikhail Glukhikh
eb831b9afc FIR: support separate ANONYMOUS_FUNCTION_WITH_NAME 2021-04-19 15:10:38 +03:00
Mikhail Glukhikh
6b95bcdbdb FIR: support separate ASSIGNMENT_IN_EXPRESSION_CONTEXT 2021-04-19 15:10:18 +03:00
Mikhail Glukhikh
9894b97058 FIR: rename EXPRESSION_REQUIRED to EXPRESSION_EXPECTED 2021-04-19 15:09:50 +03:00
Ilya Kirillov
26ea0be635 FIR IDE: temporary update testdata until diagnostic collection for delegated objects is fixed 2021-04-19 13:52:47 +02:00
Ilya Kirillov
f40f506852 FIR: move components from AbstractDiagnosticCollectorVisitor to CheckerRunningDiagnosticCollectorVisitor 2021-04-19 13:52:46 +02:00
Ilya Kirillov
ea233cddf8 FIR: rename goToNestedDeclarations -> visitNestedElements 2021-04-19 13:52:46 +02:00
Ilya Kirillov
eed143d17b FIR: remove beforeRunningAllComponentsOnElement/beforeRunningSingleComponentOnElement from AbstractDiagnosticCollectorVisitor 2021-04-19 13:52:45 +02:00
Ilya Kirillov
41e822e8cb FIR IDE: fix duplicated diagnostic collection 2021-04-19 13:52:44 +02:00
Ilya Kirillov
5829f1a6e7 FIR IDE: add more test cases to TraversalCounterTestGenerated 2021-04-19 13:52:43 +02:00
Ilya Kirillov
e78e8f8c79 FIR IDE: fix behaviour of DiagnosticTraversalCounterTest 2021-04-19 13:52:43 +02:00
Ilya Kirillov
32c1101959 FIR IDE: introduce tests for checking diagnostic visitor context collection 2021-04-19 13:52:42 +02:00
Ilya Kirillov
ac993754e1 FIR IDE: collect diagnostics context under read lock 2021-04-19 13:52:41 +02:00
Ilya Kirillov
ce62348709 FIR IDE: do not report suppressed diagnostics 2021-04-19 13:52:41 +02:00
Ilya Kirillov
fd082b1574 FIR IDE: get rid of DiagnosticCollectorDeclarationAction 2021-04-19 13:52:40 +02:00
Ilya Kirillov
e79c133331 FIR IDE: separate diagnostics collection and checker context collection 2021-04-19 13:52:39 +02:00
Ilya Kirillov
29a0c448a6 FIR IDE: remove FirIdeFileDiagnosticsCollector as unused 2021-04-19 13:52:38 +02:00
Ilya Kirillov
023f4e9f46 FIR: extract DiagnosticCollectingVisitor to separate file 2021-04-19 13:52:38 +02:00
Ilya Kirillov
f9d415eda6 FIR: make AbstractDiagnosticCollector.Visitor non-inner 2021-04-19 13:52:37 +02:00
Ilya Kirillov
284e828cd6 FIR: extract context related functions from AbstractDiagnosticCollector.Visitor to super class 2021-04-19 13:52:36 +02:00
Dmitriy Novozhilov
e3b5cc491d [Test] Throw exception from compiler at a first place 2021-04-19 14:32:37 +03:00
Dmitriy Novozhilov
7fb2bf00c5 Force resolve annotations in annotation checker
#KT-46173 Fixed
2021-04-19 14:32:36 +03:00
Dmitriy Novozhilov
83bae89ed8 [Test] Show diff between fir file and testdata text if FE 1.0 and FIR test files don't match 2021-04-19 14:32:35 +03:00
Ivan Kochurkin
4353365968 [FIR] Implement NULL_FOR_NONNULL_TYPE diagnostics, fix tests 2021-04-19 12:46:08 +03:00
sebastian.sellmair
9336e4b09b HierarchicalKotlinNativePlatformDependencies: Provide platform dependencies to source sets not participating in any commonization
^KT-46142 Verification Pending
2021-04-17 14:58:15 +00:00
Aleksei.Cherepanov
b5ef6c9316 Add tests for SAM conversions
Add tests for KT-45191 [JPS] Marking method as "default" in Java SAM interface doesn't affect dependencies, which was fixed in intlellij(212): cbad0d91 support kotlin-generated lambda usage

#KT-45191 Fixed
2021-04-17 03:36:17 +03:00
Andrei Klunnyi
81a5ae7780 KT-44431 Quickfix to move to sealed: suggests tests source root
From now on we display the source root matching the target directory.

^KT-44431 Fixed
2021-04-16 19:38:52 +02:00
Andrei Klunnyi
eed4cb4f00 KT-44431 Quickfix to move to sealed: refactoring
Sealed super class directory is now calculated in a more
straightforward way.
2021-04-16 19:38:52 +02:00
Abduqodiri Qurbonzoda
3a8d1c4b5e Remove redundant @OptIn 2021-04-16 19:01:28 +03:00
Abduqodiri Qurbonzoda
f253b1fb15 Incorrect description for JVM toUpperCase method #KT-45884 2021-04-16 19:01:09 +03:00
Ilmir Usmanov
7b14975740 Add 'value' modifier to modifier order
Otherwise, there will be unfixable 'non-canonical modifier order'
warning
 #KT-46088
 #KTIJ-5636 Fixed
2021-04-16 18:51:44 +03:00
sebastian.sellmair
7525d9a1ce KotlinNativeTest: Append stdOut and stdErr to failure message 2021-04-16 14:56:33 +00:00
sebastian.sellmair
05a6d89151 [Minor] Re-format :kotlin-klib-commonizer and :kotlin-klib-commonizer-api 2021-04-16 14:56:32 +00:00
sebastian.sellmair
f893709e5b [Commonizer] CommonizeLibcurlTest: Add commonizeSuccessfully with unsupported targets
This test will assert behaviour on 'unsupported' targets requested from the commonizer

^KT-46077
2021-04-16 14:56:31 +00:00
sebastian.sellmair
bbcfde7231 [Commonizer] Add 'commonizer_target' and 'commonizer_native_targets' to commonized klib's manifest
^KT-46077 Fixed
2021-04-16 14:56:31 +00:00
Alexander Likhachev
6f96c225d7 [Gradle, K/N] Prefer injection over lateinit vars for task configuration
#KT-45801 Fixed
2021-04-16 17:39:53 +03:00
Dmitriy Novozhilov
b530427bb2 Fix substitution of generic types in contracts
#KT-41078 Fixed
2021-04-16 17:23:24 +03:00
Dmitriy Novozhilov
91fedd6a12 [FIR] Substitute types from arguments in evaluating of contract
#KT-41078
2021-04-16 17:23:22 +03:00
Anton Lakotka
80f95528c2 [MPP] Always use native plugin artifact for native compilations
#KT-46122 Fixed
2021-04-16 16:25:06 +03:00
Anton Lakotka
d75d42da9d [MPP] Test that native common compilation uses native plugin artifacts
#KT-46122 In Progress
2021-04-16 16:25:04 +03:00
Dmitriy Novozhilov
c65553bb8a [FIR] Get rid of source element type parameter from diagnostic factories 2021-04-16 14:08:11 +03:00
Dmitriy Novozhilov
4133f38c8c [FIR] Transform annotations of property receiver type 2021-04-16 11:12:56 +03:00
Dmitriy Novozhilov
564de2790f [FIR] Resolve array literals in independent context 2021-04-16 11:12:56 +03:00
Dmitriy Novozhilov
cc0f28b698 [FIR] Store type of function call and qualified access from error reference 2021-04-16 11:12:56 +03:00
Dmitriy Novozhilov
e869f8091a [FIR] Properly handle callable references which were resolved with error 2021-04-16 11:12:55 +03:00
Dmitriy Novozhilov
450fb5e915 [Test] Add handler to detect implicit types which were left in resolved FIR 2021-04-16 10:52:58 +03:00
Ilya Gorbunov
ce7092a638 More efficient Char(Int) in common, JS, and JS-IR 2021-04-16 03:58:34 +03:00
Ilya Gorbunov
8041c3aa1d Support Char.code in constant evaluator, KT-46036
But do not consider Char.code a pure integer constant.
2021-04-16 03:58:34 +03:00
Alexander Udalov
0a446230f7 Reorder LanguageFeature entries according to sinceVersion 2021-04-15 21:41:17 +02:00
Alexander Udalov
168d8b07a8 Minor, fix warnings on new stdlib API
In modules where allWarningsAsErrors is not yet enabled.
2021-04-15 18:39:06 +02:00
Dmitry Petrov
e89ab71bf8 JVM_IR KT-45934 don't generate declaration stubs for delegates 2021-04-15 17:59:19 +03:00
Dmitry Petrov
cc415f62b5 JVM_IR KT-46092 fix array spread operator in Kotlin->Java call 2021-04-15 17:11:21 +03:00
Pavel Punegov
b5fae96934 [native][tests] Fix incorrect enum in ExecutorService 2021-04-15 16:54:25 +03:00
Pavel Punegov
5903d015b8 [native][tests] Change architecture requirements in simulator executor
This requirement doesn't work for watchos_x86 on macos_x64 so create
a list of compatible requirements.
2021-04-15 13:34:00 +00:00
Mikhail Glukhikh
9b3f1b9b8a Inference: handle Exact constraints with captured types properly
#KT-41818 Fixed
2021-04-15 15:55:41 +03:00
Mikhail Glukhikh
51d348d5fa FIR: report FUN_INTERFACE_CONSTRUCTOR_REFERENCE on deserialized properly
This fixes KT-46100 for FIR
2021-04-15 15:54:18 +03:00
Ilya Kirillov
676e29e96e fix up: do not read declaration phase without read lock hold 2021-04-15 15:24:04 +03:00
Ilya Kirillov
d7e3c65c45 FIR: add renderDeclarationOrigin to FirRender 2021-04-15 15:24:02 +03:00
Ilya Kirillov
0e98480be3 FIR: update resolve phase for declaration when visiting with FirContractResolveTransformer 2021-04-15 15:24:01 +03:00
Ilya Kirillov
5de4c5fc28 FIR: allow declaring specific set of parameters for FirRenderer 2021-04-15 15:24:00 +03:00
Ilya Kirillov
fee83051e9 FIR: encapsulate creating of cli-only session components into single function 2021-04-15 15:23:59 +03:00
Ilya Kirillov
0a80fbb078 FIR IDE: do not read declaration phase without read lock hold 2021-04-15 15:23:57 +03:00
Ilya Kirillov
0cf00d0f72 FIR: fix FirDefaultPropertyAccessor phase to BODY_RESOLVE 2021-04-15 15:23:56 +03:00
Ilya Kirillov
39b2cd1027 FIR: do not provide symbols with different ClassId in JavaSymbolProvider
JavaSymbolProvider uses KotlinPsiElementFinderWrapper for finding classes.
CliFinder looks for Java classing assuming that class with ClassId=a/b/C
lives in directory a/b and do not look into real package name of Java class.
This causes that we may find some classes which we should not see from current scope.

Also, the IDE implementation works correctly here (it also checks file package)
which cause different behaviour of FIR IDE and FIR

This change also requires to fix testdata and make Java classes live
in directory consistent with file package
2021-04-15 15:23:53 +03:00
pyos
82cadba80b FIR: report errors on FirResolvedTypeRef with ConeClassErrorType
Not sure what the difference from FirErrorTypeRef is.
2021-04-15 14:59:30 +03:00
pyos
474d1d48f7 FIR: allow fun T.() = ... as an instance of (T) -> ...
It was already done by the previous commit by mistake, but it broke if
there are other value parameters because the type of the first parameter
would be inferred to be same as the type of the receiver.
2021-04-15 14:59:29 +03:00
pyos
0a25550fc2 FIR: allow fun (x: T) ... as an instance of T.() -> ...
and disallow > 1 implicit parameters in lambdas.
2021-04-15 14:59:28 +03:00
pyos
354acc1fd5 FIR: permit * as FunctionN type argument
`() -> *` is not valid, but `F<*>` where `typealias F<T> = () -> T` is.
2021-04-15 14:59:27 +03:00
Denis.Zharkov
32dacc37c0 FIR: Fix OverloadResolutionByLambdaReturnType case 2021-04-15 14:48:20 +03:00
Ilmir Usmanov
1c48fb28db Generate return when generating continuation class for expression body
Otherwise, the function will return Unit instead of correct value.
 #KT-46007 Fixed
2021-04-15 13:54:45 +03:00
Simon Ogorodnik
539d3e5df2 Add full-pipeline modularized tests for old frontend 2021-04-15 13:36:00 +03:00
Ivan Gavrilovic
11b92bc597 [Gradle] Fix init script for coroutines
Use doFirst instead of beforeTask to add javaagent args for coroutines debugging.
2021-04-15 12:39:25 +03:00
Andrei Klunnyi
2bb7f6a168 KT-45347 Quickfix to move to sealed parent: do not suggest for binaries
^KT-45347 Fixed
2021-04-15 11:17:36 +02:00
Svyatoslav Scherbina
d531df1643 Native: add KotlinThrowable.asError() to the generated Obj-C framework
This method can be useful when overriding a throwing Kotlin method in
Swift or Obj-C. In this case, a user can call asError to wrap Kotlin exception
to (NS)Error and then throw it to Kotlin, which will unwrap it back.

^KT-45127 Fixed
2021-04-15 08:21:30 +00:00
Pavel Punegov
c988ecf59b Ignore test in native backend due to the KT-44037 (KT-38181) 2021-04-15 07:59:26 +00:00
Pavel Punegov
d07c990fc2 Add test to native ignore list due to the KT-44571 2021-04-15 07:59:25 +00:00
Pavel Punegov
0f5edaa02f Ignore test in the native backend. It redefines JvmInline class 2021-04-15 07:59:24 +00:00
Pavel Punegov
ca4cebf3e3 Exclude test in native backend due to KT-42020.
Also return back two tests for fixed KT-42684 and KT-45139
2021-04-15 07:59:23 +00:00
Pavel Punegov
6aa7628808 Fixes to Kotlin/Native test directives infrastructure.
* parse files and modules separately
* fix default and support modules usage
* add another way to ignore backend (new directive)
* add new test to exclude list
2021-04-15 07:59:22 +00:00
Alexander Gorshenev
7d13aaad24 Native klib testing: a binary compatibility tweak.
Link versioned libraries against dependencies of the same version.
2021-04-15 07:59:21 +00:00
Tianyu Geng
4d2e3a2379 FIR: Fix resolving += to ignore + if it doesn't return correct type
This is the FIR fix of the FE change tracked by
https://youtrack.jetbrains.com/issue/KT-45503

Consider the following code:

```
fun foo() {
  var l = mutableListOf("")
  l += ""
}
```

The above code used to be considered invalid due to ambiguous `+=`. But
after KT-45503, it's now considered valid code because `plus` is not
really a valid option for this code. This is because the return type
of `plus` for `List` is `List`, which does not match the type of
variable `l`.

As for now, FIR rejects the above code due to ambiguous `+=`. This
change fixes that by also consider the return type when resolving `+=`.
2021-04-15 10:34:05 +03:00
Tianyu Geng
c43faa2ada FIR: refactor FirExpressionsResolveTransformer#transformAssignmentOperatorStatement
No logic change. This commit only rearrange stuff to make it cleaner
2021-04-15 10:34:04 +03:00
Dmitriy Novozhilov
861f69822b [FIR] Fix infinite recursion of ConeDefinitelyNotNullType 2021-04-15 10:30:29 +03:00
Dmitriy Novozhilov
7c6a9aa963 [FIR] Store cachedExpandedType in WeakPair instead of usual Pair
WeakPair is a renamed OneElementWeakMap
2021-04-15 10:30:29 +03:00
Dmitriy Novozhilov
dd96c3b56e [FIR] Turn some checkers into classes to prevent memory leaks
This is temporary solution until those checkers will be fixed
#KT-46058
2021-04-15 10:30:29 +03:00
Dmitriy Novozhilov
085bddbfc0 [FIR] Force checker components to create checkers sets on each access
This is needed to add ability to recreate checkers which are not objects
  for each session
2021-04-15 10:30:26 +03:00
Dmitriy Novozhilov
1f62a2d8cc [FIR] Add disposing of FirJavaElementFinder in FIR compiler entrypoint 2021-04-15 10:30:09 +03:00
Mark Punzalan
957f6ddafd FIR checker: Enable ReplaceWithDotCallFix for UNNECESSARY_SAFE_CALL. 2021-04-14 22:30:42 +02:00
Dmitry Petrov
f1eeb72c01 PSI2IR KT-46069 resolve IR-based type parameter descriptors to symbols 2021-04-14 21:27:01 +03:00
Anton Bannykh
ba80086ae3 JS PIR generator: eliminate deprecated String.capitalize 2021-04-14 21:04:39 +03:00
Mikhail Glukhikh
4c13fe5631 FIR: handle SAM constructor properly in visibility checker
#KT-46074 Fixed
2021-04-14 20:50:54 +03:00
ebukreev
d8a2f82cbd FIR: inroduce FirFunInterfaceConstructorReferenceChecker 2021-04-14 19:53:43 +03:00
Dmitry Petrov
531a0de399 JVM_IR KT-46060 'contains' operator without receiver is non-optimizable 2021-04-14 19:18:42 +03:00
Mark Punzalan
21a3a14289 FIR: Use intersection of all upper bounds for parameterized types in
ConeKotlinType.canBeNull.

^KT-45903 In progress
2021-04-14 19:17:10 +03:00
Andrei Klunnyi
ac85f9d983 KT-45348 Sealed Inheritors Inspection: binary Kotlin parent is ignored
^KT-45348 Fixed
2021-04-14 18:12:28 +02:00
Ilya Kirillov
0051451ed7 FIR: add error message when FirBasedSymbol.fir is not initialized 2021-04-14 18:37:35 +03:00
Dmitriy Novozhilov
69ff45971f Suppress HIDDEN diagnostics from FIR to fix FIR bootstrap compilation 2021-04-14 18:30:56 +03:00
Dmitriy Novozhilov
1f0ecade34 [FIR] Transform annotations of type refs in body resolve stage
Also fix building CFG for annotation calls
2021-04-14 18:30:56 +03:00
Dmitriy Novozhilov
aec13defc4 [Test] Add proper annotation target in SupertypesAndBounds test 2021-04-14 18:30:55 +03:00
Dmitriy Novozhilov
0b2943d34c Prohibit using annotations without TYPE target in several type positions
#KT-8325 Fixed
#KT-19455 Fixed
#KT-25876 Fixed
#KT-28449 Fixed
2021-04-14 18:30:54 +03:00
Dmitriy Novozhilov
1cff17bb58 Cleanup ConstantExpressionEvaluator 2021-04-14 18:30:53 +03:00
Dmitriy Novozhilov
bee2a69e21 Implement new logic of approximation of integer literals in position of receiver
#KT-38895 In Progress
2021-04-14 18:30:52 +03:00
Dmitriy Novozhilov
6afb905ad6 Add deprecation warning about new integer operators on literals resolution
#KT-38895
2021-04-14 18:30:51 +03:00
Dmitriy Novozhilov
53b6d6f767 Prohibit references to members of containing class in super constructor of nested object
#KT-25289 In Progress
2021-04-14 18:30:49 +03:00
Andrey Zinovyev
3c093f57ba [FIR] Add DYNAMIC_UPPER_BOUND check
+Fix some failing diagnostic tests
+Use PositioningStrategy to locate reified modifier
2021-04-14 18:11:18 +03:00
Andrey Zinovyev
0d525bbe85 [FIR] Add MISPLACED_TYPE_PARAMETER_CONSTRAINTS check 2021-04-14 18:11:17 +03:00
Andrey Zinovyev
412b941486 [FIR] Add DEPRECATED_TYPE_PARAMETER_SYNTAX check 2021-04-14 18:11:16 +03:00
Andrey Zinovyev
2b8c22c08a [FIR] Add CYCLIC_GENERIC_UPPER_BOUND check 2021-04-14 18:11:14 +03:00
Andrey Zinovyev
03215f4e0a [FIR] Add TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER check 2021-04-14 18:11:13 +03:00
Andrey Zinovyev
470993ac07 [FIR] Add TYPE_PARAMETERS_NOT_ALLOWED check 2021-04-14 18:11:12 +03:00
Andrey Zinovyev
5ff82addc9 [FIR] Add REIFIED_TYPE_PARAMETER_NO_INLINE check 2021-04-14 18:11:10 +03:00
Andrey Zinovyev
14fe570a00 [FIR] Add more type params checks
VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED
BOUND_ON_TYPE_ALIAS_PARAMETER_NOT_ALLOWED
2021-04-14 18:11:09 +03:00
Andrei Klunnyi
fb1b253d1e KT-46063 Quick fix: remaining when branches for 'expect' sealed
'List<WhenMissingCase>.hasUnknown' property was changed in 4222bb9a.
As a result quickfix's AddWhenRemainingBranchesFix.Companion.isAvailable
started responding 'no'.
This commit restores original property and provides a separate one for
compiler needs.

^KT-46063 Fixed
2021-04-14 15:57:15 +02:00
Alexander Udalov
005aa57f6d Remove obsolete module cli-js-klib
It's no longer used anywhere in the build.
2021-04-14 13:47:02 +02:00
Alexander Udalov
988d1365a8 Remove dependency of backend.wasm on ir.tree.impl and ir.tree.persistent 2021-04-14 13:47:02 +02:00
Alexander Udalov
643c3f26c1 Remove dependency of backend.js on ir.tree.impl
By taking the instance of IrFactory either from SymbolTable, or passing
it from cli-js which depends on both ir.tree.impl and
ir.tree.persistent, and can choose the appropriate implementation.
2021-04-14 13:47:02 +02:00
Alexander Udalov
9aed55a1f4 IR: minor, improve toString for IrBasedTypeParameterDescriptor
The motivation is that in the "Unbound symbols are not allowed" error
message like the one in KT-46069, the type parameter is rendered via
`render()`, and that contains only its name/variance, and doesn't help
in finding where the member with that type parameter is declared.
2021-04-14 13:16:05 +02:00
Ting-Yuan Huang
6c989bfd4b Support array of annotation in KotlinJvmBinaryClass
KotlinJvmBinaryClass.AnnotationArrayArgumentVisitor didn't cover the
case when the element type is an Annotation. Therefore, when the
compiler read an array of annotations from JVM binary classes built from
Kotlin sources, it got an empty array regardless of what was written in
the bytecode.

For example, Foo.value below is read as an empty array when SomeClass
resides in another Kotlin module.

  @Foo(
    value = [Bar(1), Bar(2)]
  )
  class SomeClass
2021-04-14 13:14:26 +02:00
Dmitriy Dolovov
5e392a511f [K/N][IR] Generate missing return when using Nothing-returning safe call as lambda result or function expression body
^KT-42832
2021-04-14 13:20:41 +03:00
Ilya Kirillov
b4813d31e6 Mute FirKotlinHighlightingPassTestGenerated.Checker.testResolveTypeInAnnotationArgumentRuntime as flaky 2021-04-14 11:48:41 +02:00
Ilmir Usmanov
74b1fdcc60 Minor. Add regression test
#KT-45991
2021-04-14 10:48:59 +02:00
Ilmir Usmanov
29c975fc43 Minor. Add regression test
#KT-45539 Obsolete
2021-04-14 10:48:57 +02:00
Ilmir Usmanov
19b1b48e87 Minor. Add tests to check returning inline class from default method
#KT-45539 Obsolete
2021-04-14 10:48:54 +02:00
Andrey Zinovyev
8c464b4de5 [KAPT] Bring back properties resolution in light analysis
Because kapt fails on evaluation constant expressions of SomeType::class
2021-04-14 07:50:22 +00:00
Nikolay Krasko
9bbfe5a7a2 Add dependencies verification for prepareSonatypeStaging.gradle
File is applied conditionally when sonatype publication is enabled.
2021-04-14 00:53:02 +03:00
Steven Schäfer
7a9ff15d73 JVM IR: Handle suspend interface default methods with generic types (KT-45166) 2021-04-13 23:04:32 +02:00
Dmitry Petrov
7d62f0b5aa JVM_IR KT-45187 use Arrays.copyOf to copy an array in spread operator
Creating a new array (and copying data into it with System.arraycopy)
doesn't work in generic case, because the actual array class depends on
call site.
2021-04-13 22:27:37 +03:00
zadorotskas
334d0a8b5a FIR: introduce three diagnostics for const val 2021-04-13 21:36:46 +03:00
Mikhail Glukhikh
cc106085e2 FIR: add minor TODO / comments to mismatch checkers 2021-04-13 21:36:44 +03:00
Mikhail Glukhikh
b8af3d79d4 FIR: minimize explicit use of <destruct> name 2021-04-13 21:36:43 +03:00
Mikhail Glukhikh
78fc87ffb1 FIR: apply minor test data fixes around type mismatch problems 2021-04-13 21:36:41 +03:00
Mikhail Glukhikh
9accd8c9ad FIR: use unsafe .coneType in type mismatch checkers when possible 2021-04-13 21:36:40 +03:00
Mikhail Glukhikh
b58e5b182c FIR: add test fixing builder inference case 2021-04-13 21:36:38 +03:00
Mikhail Glukhikh
f7147dc6f3 CoroutineTransformerMethodVisitor: fix potential type mismatch
The fixed code compiles properly only due to null smart cast.
Without it, e.g. in FIR, we'd have type mismatch error for this return.
2021-04-13 21:36:37 +03:00
Mikhail Glukhikh
69d1ef423a FIR initializer: don't report type mismatch on incompatible extensions
This commit suppresses type mismatch error from KT-45989
2021-04-13 21:36:36 +03:00
Mikhail Glukhikh
fa4d664a18 FIR initializer: don't report type mismatch in SomeInt = Int case 2021-04-13 21:36:34 +03:00
vldf
57d2eb5da2 Introduce FirFunctionReturnTypeMismatchChecker 2021-04-13 21:36:33 +03:00
vldf
24f1f1221e Introduce FirInitializerTypeMismatchChecker 2021-04-13 21:36:31 +03:00
Ilya Chernikov
7ed35e5c2b FIR: Introduce smart containers in supertypes search
assuming that we may have quite many searches resulting
in a single supertypes, smart containers here reduce
allocations.
2021-04-13 16:18:41 +02:00
Ilya Chernikov
038a8af80e FIR: convert some hot void visitors to any
reduces call indirection (Nothing -> Void bridges) and therefore
callstack depth
2021-04-13 16:18:41 +02:00
Ilya Chernikov
34694cbec5 FIR: get rid of transformSingle in the generated code
further reduce of the callstack depth
2021-04-13 16:18:40 +02:00
Ilya Chernikov
9d557c8b79 FIR: reduce visitor/transformer indirection
performance: do not route transform calls via
visitors, reduce call stack depth on transformations
2021-04-13 16:18:40 +02:00
Ilya Chernikov
dfd5e80ce9 FIR: Get rid of CompositeTransformResult 2021-04-13 16:18:39 +02:00
Yahor Berdnikau
00df2c4a9e Fix failing non-JUnit5 tests.
They have failed due to migration to new plugin api in test projects.

^KT-45744 Fixed
2021-04-13 16:48:20 +03:00
Yahor Berdnikau
9ef5817f8b Update SimpleKotlinGradleIT.kt tests to use new DSL.
^KT-45744 In Progress
2021-04-13 16:48:19 +03:00
Yahor Berdnikau
aabb05104e Extract common versions to the separate file.
^KT-45744 In Progress
2021-04-13 16:48:18 +03:00
Yahor Berdnikau
8db67ec24b Add file system watching option to build options.
Default build option value - disabled.

In Gradle 7 it is enabled by default, and I suspect it causes flaky
build failure when 'TempDir' tries to delete test project.

^KT-45744 In Progress
2021-04-13 16:48:17 +03:00
Yahor Berdnikau
81621a79a6 Add flag to enable Gradle process debugging.
^KT-45744 In Progress
2021-04-13 16:48:16 +03:00
Yahor Berdnikau
9ae47004d0 Append by default heap dump options.
^KT-45744 In Progress
2021-04-13 16:48:15 +03:00
Yahor Berdnikau
ffa11eacca Add task to run only JUnit 5 KGP tests.
^KT-45744 In Progress
2021-04-13 16:48:14 +03:00
Yahor Berdnikau
34f1c58f1e Add Gradle task to clean test kit cache dir.
Always run it on CI when tests will finish.
^KT-45744 In Progress
2021-04-13 16:48:13 +03:00
Yahor Berdnikau
644882df61 Set default max Gradle version to '7.0'.
^KT-45744 In Progress
2021-04-13 16:48:11 +03:00
Yahor Berdnikau
93230d72f5 Add build option to control Gradle parallelism.
Limit workers count, so when running tests parallel, they will not
compete over CPU usage.

^KT-45744 In Progress
2021-04-13 16:48:10 +03:00
Yahor Berdnikau
3c78c94fb1 Add configuration cache support to the default build options.
^KT-45744 In Progress
2021-04-13 16:48:08 +03:00
Yahor Berdnikau
8b393910d3 Add support for tests mute-in database in JUnit 5.
^KT-45744 In Progress
2021-04-13 16:48:07 +03:00
Yahor Berdnikau
7ffdafe791 Enable forwarding successful Gradle test output on demand.
^KT-45744 In Progress
2021-04-13 16:48:05 +03:00
Yahor Berdnikau
5b218bdad2 Set tests lifecycle to be 'PER_CLASS'.
Usually Gradle tests should be pretty isolated between each other to use
'PER_METHOD' lifecycle.

^KT-45744 In Progress
2021-04-13 16:48:03 +03:00
Yahor Berdnikau
40c525c4a6 Add '.testKitDir/' to '.gitignore' file.
^KT-45744 In Progress
2021-04-13 16:48:02 +03:00
Yahor Berdnikau
35a020340c Don't share temp directory between tests.
Apparently this causes problems on Windows CI runners.

^KT-45744 In Progress
2021-04-13 16:48:00 +03:00
Yahor Berdnikau
0ca4254cba Setup running tests against different Gradle versions.
^KT-45744 In Progress
2021-04-13 16:47:59 +03:00
Yahor Berdnikau
4583cd3634 Allow to add jupiter-params dependency.
^KT-45744 In Progress
2021-04-13 16:47:58 +03:00
Yahor Berdnikau
3dcac00aec Add basic file content transformations.
^KT-45744 In Progress
2021-04-13 16:47:57 +03:00
Yahor Berdnikau
f5dfe7ce95 Automatically add 'pluginManagement' block to settings.gradle file.
Only in the case when it does not exist.
^KT-45744 In Progress
2021-04-13 16:47:56 +03:00
Yahor Berdnikau
9e2cdc7337 Add file or directory exists/does not exist assertions.
^KT-45744 In Progress
2021-04-13 16:47:55 +03:00
Yahor Berdnikau
710287920b Add initial setup to build common options.
^KT-45744 In Progress
2021-04-13 16:47:54 +03:00
Yahor Berdnikau
7549d14a36 Add Gradle output assertions.
^KT-45744 In Progress
2021-04-13 16:47:53 +03:00
Yahor Berdnikau
b7864c1e43 Add tasks assertions.
^KT-45744 In Progress
2021-04-13 16:47:51 +03:00
Yahor Berdnikau
e13f21e461 Add basic DSL based on Gradle TestKit for KGP integration tests.
^KT-45744 In Progress
2021-04-13 16:47:50 +03:00
Ivan Kochurkin
847ab40707 [FIR] Implement DIVISION_BY_ZERO diagnostics, fix tests 2021-04-13 16:22:08 +03:00
Ivan Kochurkin
964bba3530 [FIR] Implement FLOAT_LITERAL_OUT_OF_RANGE diagnostics, fix tests 2021-04-13 16:22:06 +03:00
Ivan Kochurkin
4cf30cd1fa [FIR] Implement INT_LITERAL_OUT_OF_RANGE diagnostics, fix tests 2021-04-13 16:22:05 +03:00
Ivan Kochurkin
fb06da2d75 [FIR] Implement WRONG_LONG_SUFFIX diagnostics, fix tests 2021-04-13 16:22:03 +03:00
Vasily Levchenko
62ffc0033d [kotlin-native][test][dynamic test] tests provoking generating empty structs kt-42796 2021-04-13 12:10:58 +00:00
Vasily Levchenko
2adea2122e [kotlin-native][build][test infrostructure] don't ignore compiler exit code 2021-04-13 12:10:57 +00:00
Vasily Levchenko
c68ac4f6b6 [interop][c][reverse] avoid generating empty structures for leaf packages without exportable declations
- fixes KT-42796
2021-04-13 12:10:57 +00:00
Roman Golyshev
0d7eb971ca Fix test data 2021-04-13 11:40:24 +00:00
Roman Golyshev
e0fca9d2f6 FIR IDE: Add visibility checks to the completion
Visibility checks currently do not work in some cases, for example:

- public nested class of private class is seen globally
- private_for_this does not work
- some other cases I am not yet aware of

If `FirVisibilityChecker.isVisible` fix those issues, they will be fixed
automatically in the completion
2021-04-13 11:40:23 +00:00
Roman Golyshev
78b2324a51 Refactor KotlinFirCompletionContributor
Replace extensions checking lambdas with `ExtensionApplicabilityChecker`
type
2021-04-13 11:40:22 +00:00
Roman Golyshev
86348ed981 Refactor KotlinFirCompletionContributor
Remove some code duplication
2021-04-13 11:40:22 +00:00
Roman Golyshev
ff71dda065 FIR IDE: Add KtVisibilityChecker component 2021-04-13 11:40:21 +00:00
Roman Golyshev
28d8d2d903 FIR IDE: Search for the first non-local declaration in EnclosingDeclarationContext::detect
Local declarations do not have a stable `ClassId`, which is used in
`declarationUtils.collectDesignation`. Local classes will always have
`outerClassId.isLocal = true`, even when it is not true (see
`org.jetbrains.kotlin.fir.builder.Context.currentClassId` for why this
happens)
2021-04-13 11:40:20 +00:00
Roman Golyshev
0d2158325a Remove redundant ticks from test data 2021-04-13 11:40:19 +00:00
Roman Golyshev
fcd0168381 Refactor AbstractHighLevelMultiFileJvmBasicCompletionTest
Use `KotlinFixtureCompletionBaseTestCase` base because it can override
`getProjectDescriptor`, so the tests will see full JDK

Without it, there were problems when classes from JDK appeared in the
completion (`Serialization`, for example)
2021-04-13 11:40:18 +00:00
pyos
cc7187e49b JVM_IR: cast argument of enumValueOf to String in bytecode
Generic functions and implicit casts may return a supertype instead.

 #KT-45865 Fixed
2021-04-13 13:24:24 +02:00
Anton Bannykh
afaf3b5e28 JS PIR: replace deprecated toLowerCase with lowercase 2021-04-13 14:20:00 +03:00
Andrei Klunnyi
73d2e1a42d KT-46049 Java-Kotlin sealed inheritors inspection: refactoring 2021-04-13 12:34:07 +02:00
Andrei Klunnyi
2fce968de0 KT-46049 Java-Kotlin sealed inheritors inspection: false positive for type parameter
^KT-46049 Fixed
2021-04-13 12:34:07 +02:00
pyos
85b4668b7c JVM_IR: optimize more if-null chains
1. consider reads of fields from the same file "stable" just like
    functions, i.e. assume their nullability information is correct
 2. apply if-null fusion repeatedly until the subject is no longer a
    nested if-null expression
2021-04-13 11:48:36 +03:00
Denis.Zharkov
0b0a6d6ede Fix false positive ENCLOSING_SUSPEND_FUNCTION_FOR_SUSPEND_FUNCTION_CALL
Previously added additional processing at findEnclosingSuspendFunction
seems unnecessary anymore

^KT-43258 Fixed
2021-04-13 11:47:05 +03:00
Dmitriy Novozhilov
803d47daaa Distinguish classes from different sourcesets in SealedInheritorInSameModuleChecker
#KT-45848 Fixed
#KT-46031
2021-04-13 11:21:58 +03:00
Dmitriy Novozhilov
66e4d5664a [Test] Properly setup KtFile.isCommonSource in tests 2021-04-13 11:21:57 +03:00
Jinseong Jeon
619360fe4d FIR checker: report UNINITIALIZED_ENUM_(ENTRY|COMPANION) 2021-04-13 08:25:16 +03:00
Ivan Kochurkin
ad9b962536 [FIR] Fix tests (ARGUMENT_TYPE_MISMATCH instead of INCOMPATIBLE_CANDIDATE) 2021-04-12 23:49:55 +03:00
Ivan Kochurkin
4ffab5fe5a [FIR] Add new test argParamTypeMismatch.kt for ARGUMENT_TYPE_MISMATCH diagnostics 2021-04-12 23:49:54 +03:00
Ivan Kochurkin
a09b836334 [FIR] Add new ARGUMENT_TYPE_MISMATCH diagnostics and related classes, throw it in corresponding cases 2021-04-12 23:49:52 +03:00
Dmitry Petrov
7e03f8ea80 JVM_IR KT-45853 include return type into Java method IdSignature
This is a hack required to accept [potentially] incorrect input
provided by the front-end; see KT-46042.
2021-04-12 22:52:08 +03:00
Matthew Gharrity
5ce746f1ec ULC field has null nameIdentifier
KtUltraLightFieldForSourceDeclaration implements PsiField, for which
getNameIdentifier() is marked @NonNull, so some clients expect a
non-null return value.

#KT-45629 Fixed
2021-04-12 21:41:54 +03:00
Nikolay Krasko
6cbdcbe53b Trust zip with gradle sources 2021-04-12 20:10:42 +03:00
Jinseong Jeon
9af108df77 FIR LT: set source for destructured value parameter of lambda 2021-04-12 19:20:03 +03:00
Yahor Berdnikau
c6aa5d1495 Fix plugin is using deprecated method that is removed in AGP 7.0.
^KT-45950 Fixed
2021-04-12 18:20:42 +03:00
Yahor Berdnikau
9100be4566 Set Android Gradle Plugin dependency version to 3.4.0.
This is required to get method deprecations and new proposed methods.
2021-04-12 18:20:41 +03:00
Dmitry Petrov
f59b49db68 JVM_IR KT-45967 generate accessor for argument of indy intrinsic
TODO handle inaccessible constructors gracefully
2021-04-12 17:36:24 +03:00
Sergey Shanshin
5f9fe8e5de Fix IR compilation of kotlix.serialization runtime in native 2021-04-12 17:08:08 +03:00
Abduqodiri Qurbonzoda
39731fd493 Merge Stdlib generators 2021-04-12 16:51:24 +03:00
Alexander Udalov
e9a969875c Minor, fix typo in the issue reference in comment 2021-04-12 15:43:35 +02:00
Dmitry Petrov
162363a324 JVM: CHECK_BYTECODE_TEST directive + use it in INVOKEDYNAMIC tests 2021-04-12 16:43:15 +03:00
Ilya Chernikov
ca352c9556 Fix jvm method reading when descriptor and signature do not match
#KT-38325 fixed
2021-04-12 16:23:53 +03:00
Mikhail Glukhikh
c75331bf2a Implicit nothing type argument: handle nullable case properly
#KT-41620 Fixed
2021-04-12 15:51:46 +03:00
Alexander Udalov
115e2673ae Minor, fix javac deprecation warning in DynamicBundle 2021-04-12 14:38:09 +02:00
Yahor Berdnikau
2d9a3f364c Update advance Gradle version to 7.0 for KGP tests.
^KT-44949 Fixed
2021-04-12 15:02:02 +03:00
Victor Petukhov
73a2838555 Do substitution captured type's super types as well
^KT-45982 Fixed
2021-04-12 14:00:40 +03:00
Victor Petukhov
e8275d2527 Complete old inference's callable references properly, by updating descriptor, resolved call and recorded expression's type
^KT-45721 Fixed
^KT-44994 Fixed
2021-04-12 14:00:38 +03:00
Victor Petukhov
d804e73c22 Avoid subtype checking between type variable of self type and captured star projection only for invariant positions
Subtyping with non-invariant positions may produce useful constraints

^KT-46001 Fixed
2021-04-12 13:44:09 +03:00
Ilya Chernikov
0274c41919 [minor] FIR: fix deprecation in test 2021-04-12 10:08:54 +02:00
Alexander Likhachev
9e78e43c49 [Gradle] Always declare system property reads for compile tasks
When Kotlin plugin is applied in buildSrc or included build that defines Gradle plugins it can cause Gradle to report undeclared system property reads at configuration time. Declaring all system properties reads through Gradle providers to cover all these cases.
#KT-45910 Fixed
2021-04-12 03:15:10 +03:00
Andrey Zinovyev
47407c4445 [FIR] Add NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER check 2021-04-11 16:18:07 +00:00
Alexander Udalov
ea22f4b681 IR: check absence of extension receiver in isMethodOfAny
Otherwise extension methods named toString/equals/hashCode were
generated incorrectly on JVM IR, which could result in
AbstractMethodError at runtime.

 #KT-45963 Fixed
2021-04-11 13:54:13 +02:00
Abduqodiri Qurbonzoda
98d31a1813 Expand KDoc of inc() and dec() operators #KT-43701 2021-04-10 03:23:04 +03:00
sebastian.sellmair
b311820159 [Minor] Fix CommonizerDependencyTest.sample identityString on Windows 2021-04-09 23:36:02 +02:00
Dmitriy Dolovov
14838a6b7b Update Kotlin/Native: 1.5.20-dev-4865 2021-04-09 23:36:02 +02:00
sebastian.sellmair
6d31750673 [Commonizer] assembelCirTree: Supoprt TypeAlias -> Class commonization 2021-04-09 23:36:02 +02:00
sebastian.sellmair
28adf6345d [Minor] Optimize imports of CirProperty.kt 2021-04-09 23:36:02 +02:00
sebastian.sellmair
9c1c506b21 [Minor] Move ClassesToProcess into .tree.deserializer package 2021-04-09 23:36:02 +02:00
sebastian.sellmair
d0f8395556 [Commonizer] Remove old mergers 2021-04-09 23:36:01 +02:00
sebastian.sellmair
14161c8250 [Commonizer] Prevent copying missing modules that are already present in destination 2021-04-09 23:36:01 +02:00
sebastian.sellmair
02c1d7fad3 [Gradle] HierarchicalNativeDistributionCommonizerTask: Ensure that native distribution commonization tasks can't run in parallel 2021-04-09 23:36:01 +02:00
sebastian.sellmair
c4562fd1db [Gradle] GetCommonizerTargetOfSourceSet: Gracefully handle common non-hmpp workaround 2021-04-09 23:36:01 +02:00
sebastian.sellmair
2aeb08e245 [Gradle] Implement internal intransitiveMetadataConfiguration
- Implemented additional intransitiveMetadataConfiguration to support
dependencies that shall not be added transitively to dependsOn edges
2021-04-09 23:36:00 +02:00
sebastian.sellmair
4e40bd6371 [Minor] Make CInteropProcess cacheable 2021-04-09 23:36:00 +02:00
sebastian.sellmair
ce0fdbd2df [Minor] Make CInteropCommonizerTask cacheable 2021-04-09 23:36:00 +02:00
sebastian.sellmair
9ac7b61094 [Gradle] HierarchicalNativeDistributionCommonizerTask: Implement project global caching
- Implement NativeDistributionCommonizationCache which will act similar
to the 'SuccessMarker' used in the non hierarchical commonization task.

- Implement 'kotlin.mpp.enableNativeDistributionCommonizationCache'
Gradle property to disable project global caching. The cache is
turned on by default.
2021-04-09 23:36:00 +02:00
sebastian.sellmair
50d0439af3 [Minor] Share 'Test: Commonizer' run configuration 2021-04-09 23:36:00 +02:00
sebastian.sellmair
2bb0dbaf38 [Gradle] Implement CommonizerHierarchicalIT integration test 2021-04-09 23:36:00 +02:00
sebastian.sellmair
d9eb130f82 [Gradle] Enable hierarchical commonization by default 2021-04-09 23:35:59 +02:00
sebastian.sellmair
933c52d470 [Commonizer] Gracefully handle absent targets for hierarchical commonization 2021-04-09 23:35:59 +02:00
sebastian.sellmair
bbe499c1b6 [Commonizer] Re-introduce node builders 'parentCommonDeclaration' context 2021-04-09 23:35:59 +02:00
sebastian.sellmair
947dc71bda [Gradle] Leave native source sets: Add expect parts explictely 2021-04-09 23:35:59 +02:00
sebastian.sellmair
9cb67e06e3 [Commonizer] Only serialize common or LeafCommonizerTargets 2021-04-09 23:35:59 +02:00
sebastian.sellmair
10692b5b7c [Minor] Add commonizer classpath to HierarchicalNativeDistributionCommonizerTask 2021-04-09 23:35:58 +02:00
sebastian.sellmair
88a913c7dc [Commonizer] NativeLibraryLoader: Improve error message when loading a library fails 2021-04-09 23:35:58 +02:00
sebastian.sellmair
250915f377 [Commonizer] Implement AbstractInlineSourcesCommonizationTest and hierarchical commonization tests 2021-04-09 23:35:58 +02:00
sebastian.sellmair
a2436699ea [Commonizer] Implement basic tests for CirTree merging 2021-04-09 23:35:58 +02:00
sebastian.sellmair
f252c3e2c1 [Commonizer] Implement CirTreeDependenciesDeserializerTest 2021-04-09 23:35:57 +02:00
sebastian.sellmair
c03d995e07 [Commonizer] Implement basic tests for CirTree deserializers 2021-04-09 23:35:57 +02:00
sebastian.sellmair
8c941fc203 [Gradle] Implement support for hierarchical commonization 2021-04-09 23:35:57 +02:00
sebastian.sellmair
68c3e39058 [Commonizer] Implement support for hierarchical commonization 2021-04-09 23:35:57 +02:00
sebastian.sellmair
46a20c81cc Implement CommonizerTarget.allLeaves 2021-04-09 23:35:56 +02:00
sebastian.sellmair
a78645e858 Implement CommonizerTarget.withAllAncestors 2021-04-09 23:35:56 +02:00
sebastian.sellmair
47f36c04fc Move transitiveClosure into :commonizer-api 2021-04-09 23:35:56 +02:00
sebastian.sellmair
35e1f8a520 Implement CommonizerTarget isAncestorOf and isDescendentOf 2021-04-09 23:35:56 +02:00
sebastian.sellmair
108debdcc9 [Commonizer] Implement CirTree and CirTree deserializers and CirTree merging 2021-04-09 23:35:56 +02:00
sebastian.sellmair
cb1f3c3e32 [Commonizer] Make nodeBuilders contextless 2021-04-09 23:35:55 +02:00
sebastian.sellmair
66bc751407 [Commonizer] Inline 'hasAnythingToCommonize' 2021-04-09 23:35:55 +02:00
sebastian.sellmair
0a35d75039 [Commonizer] CommonizerParameters: Require TargetProviders as constructor argument 2021-04-09 23:35:55 +02:00
sebastian.sellmair
79c6b406ba [Commonizer] Allow empty SharedCommonizerTarget 2021-04-09 23:35:55 +02:00
sebastian.sellmair
cdbede09df Move 'TargetDependent' into commonizer module make it an interface 2021-04-09 23:35:55 +02:00
Ilmir Usmanov
bce92d824a Minor. Add tests to check returning Result from functions
Mainly, that virtual functions, returning Result, are mangled.
 #KT-45855
2021-04-09 22:09:03 +03:00
Vladimir Dolzhenko
613eda5016 Fix PackageFragmentProvider#isEmpty(FqName) for REPL 2021-04-09 21:06:32 +03:00
Anton Bannykh
bcaad7487f JS PIR: regenerate .proto 2021-04-09 19:54:24 +03:00
Anton Bannykh
923303c2c1 JS PIR: move PIR proto messages to a separate file 2021-04-09 19:54:23 +03:00
Anton Bannykh
8fe8419ad4 JS IR: serialize declarations without mutable state 2021-04-09 19:54:21 +03:00
Anton Bannykh
1e822aa28a JS PIR: carrier serializer implementation 2021-04-09 19:54:20 +03:00
Anton Bannykh
c97066527c JS PIR: carrier serializer / deserializer 2021-04-09 19:54:19 +03:00
Anton Bannykh
030498c5e1 JS IR: updated .proto 2021-04-09 19:54:18 +03:00
Anton Bannykh
5de04f49ca JS PIR: updated declarations 2021-04-09 19:54:17 +03:00
Anton Bannykh
1f0d83b420 JS PIR: update the generator
- Use symbols in carriers
- .proto messages for carriers
- carrier serializer/derserializer
2021-04-09 19:54:16 +03:00
Anton Bannykh
c224dd4cb1 JS IR: JsMapping serialization 2021-04-09 19:54:15 +03:00
Anton Bannykh
ba5582de99 IntArray and LongArray serialization 2021-04-09 19:54:14 +03:00
Anton Bannykh
387b84b37c JS IR: simplify DCE root calculation 2021-04-09 19:54:13 +03:00
Mads Ager
b27a109a1e [JVM] Fix shrinking of local range for dead variables.
Coroutine transform would occasionally *extend* the range of a
local instead of shrinking it (if the next suspension point
is after the end point for the local). That leads to the local
variable table having a local that covers code where it is not
defined. That is invalid and leads to D8 removing the locals
table from the code.
2021-04-09 19:06:13 +03:00
Ilya Kirillov
ebdbcbb7b6 FIR IDE: encapsulate designation into class 2021-04-09 17:49:43 +02:00
Ilya Kirillov
aff1788a4c FIR IDE: initialize FirSession with correct language settings 2021-04-09 17:48:48 +02:00
Ilya Kirillov
9c6445d863 FIR IDE: add more test cases to file FileStructureTest 2021-04-09 17:48:48 +02:00
Ilya Kirillov
fc2bb2e3e6 FIR IDE: fix resolve in case of duplicating classes 2021-04-09 17:48:47 +02:00
Ilya Kirillov
73c175213c FIR IDE: fix lazy resolve of type aliases 2021-04-09 17:48:47 +02:00
Ilya Kirillov
0ad64b2113 FIR IDE: fix recursive supertypes resolve in light classes 2021-04-09 17:48:47 +02:00
Ilya Kirillov
60ea64143c FIR IDE: reuse scope session between different resolve calls for the same file 2021-04-09 17:47:05 +02:00
Ilya Kirillov
a9fc3dd1ea FIR IDE: fix unresolved file annotations arguments 2021-04-09 17:46:24 +02:00
Ilya Kirillov
790cafa671 FIR IDE: fix deadlock in symbol providers 2021-04-09 17:46:23 +02:00
Ilya Goncharov
266daed2cb [Gradle, JS] Mark visited dependencies inside dependency graph traversing 2021-04-09 17:32:44 +03:00
Vasily Levchenko
fd17e5e700 [build][kotlin-native][clean] adds kotlin-native/build to clean 2021-04-09 14:14:32 +00:00
Vasily Levchenko
3192b05586 [build][kotlin-native][g/c] drop unused hacks 2021-04-09 14:14:31 +00:00
Vladimir Dolzhenko
3034d9d791 Temporary (partial) rollback optimize in PackageFragmentProvider#isEmpty(FqName) 2021-04-09 15:10:47 +02:00
Vladimir Dolzhenko
0761c4bf94 Optimize KtFile.getScript 2021-04-09 14:45:20 +02:00
Mikhail Glukhikh
254e41b70d FIR: apply bad test data changes related to ABSTRACT_*_NOT_IMPLEMENTED 2021-04-09 14:52:41 +03:00
Mikhail Glukhikh
818c54e3a6 FIR: report ABSTRACT_*_NOT_IMPLEMENTED on appropriate intersections 2021-04-09 14:52:34 +03:00
Sergey Bogolepov
0fa2821ac1 Add missing targetToolchain.macos_arm64-linux_arm32_hfp property 2021-04-09 18:26:23 +07:00
Vladimir Dolzhenko
04268a720f Optimize KtFile.isScript 2021-04-09 12:17:51 +02:00
Denis.Zharkov
37813d9d82 Add version requirements for declarations with !! types
^KT-26245 Related
2021-04-09 13:06:40 +03:00
Denis.Zharkov
403406f92d Ignore not-null assertion test related to T!! on JVM_IR
^KT-45935 Related
2021-04-09 13:06:39 +03:00
Denis.Zharkov
16ca8ddbbd Do not parse !! as part of annotation type
^KT-26245 Related
2021-04-09 13:06:38 +03:00
Denis.Zharkov
37f923a98f Do not approximate DefinitelyNotNullType in public declarations
Because since 1.6 they become normal denotable types

^KT-26245 Fixed
2021-04-09 13:06:37 +03:00
Denis.Zharkov
e74a0c7ef7 Pass languageVersionSettings to AbstractTypeApproximator 2021-04-09 13:06:35 +03:00
Denis.Zharkov
59372fd15f Enable ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated since 1.6
^KT-36770 Fixed
2021-04-09 13:06:34 +03:00
Denis.Zharkov
bd05ef19de Add blackbox test for definitely-not-null types
^KT-26245 Fixed
2021-04-09 13:06:32 +03:00
Denis.Zharkov
30eb9ad32f Add serialization/deserialization of definitely-not-null types
^KT-26245 In Progress
2021-04-09 13:06:31 +03:00
Denis.Zharkov
6ca6bb2d45 Load configuration for FirLoadCompiledKotlin 2021-04-09 13:06:29 +03:00
Denis.Zharkov
b9d2a1842a Support definitely-not-null generic T!! types in Parsing and FE1.0
^KT-26245 In Progress
2021-04-09 13:06:28 +03:00
Jinseong Jeon
5a0b75bd89 FIR checker: warn unnecessary safe calls 2021-04-09 12:32:45 +03:00
Jinseong Jeon
2ecb6733ed FIR checker: warn unnecessary non-null assertions 2021-04-09 12:32:45 +03:00
Mikhail Glukhikh
5229d4e4f4 Apply bad LT test changes related to COMPONENT_FUNCTION_..._MISMATCH 2021-04-09 12:32:44 +03:00
Jinseong Jeon
87c50235ed FIR checker: report COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH 2021-04-09 12:32:44 +03:00
Vladimir Dolzhenko
e511eec90e Added optimized PackageFragmentProvider#isEmpty(FqName) 2021-04-09 09:27:39 +00:00
Andrey Zinovyev
37055c5a09 [FIR] Add REPEATED_BOUND, CONFLICTING_UPPER_BOUNDS diagnostics 2021-04-09 07:38:39 +00:00
Sergey Bogolepov
81d4c19d8b Fix Android NDK targets
Android NDK dirs omit vendor part of triple,
so we have to respect its decision.
2021-04-09 13:11:14 +07:00
Mikhail Glukhikh
3e9ef56c31 Forbid using ext.property type parameter also for delegate ext.receiver 2021-04-09 07:56:35 +03:00
Mikhail Glukhikh
e2cc0510de Rewrite FirDeclarationDataRegistry.data to avoid type parameter problems 2021-04-09 07:56:35 +03:00
Mikhail Glukhikh
0c17ce2f44 Suppress DELEGATE_USES_EXTENSION_PROPERTY_TYPE_PARAMETER in code 2021-04-09 07:56:35 +03:00
Mikhail Glukhikh
fcbab45a88 FE 1.0: introduce DELEGATE_USES_EXTENSION_PROPERTY_TYPE_PARAMETER error
#KT-24643 Fixed
2021-04-09 07:56:35 +03:00
Ilya Gorbunov
d062f54360 Remove test exclusions after KT-45136 is fixed 2021-04-09 06:45:11 +03:00
Dmitry Petrov
ed88aa43a4 JVM_IR KT-45868 look for parent for delegating lambda in scope stack 2021-04-08 23:49:59 +03:00
Dmitry Petrov
c2a5b0b6e2 JVM_IR KT-45920 don't add special bridge if it clashes with known method 2021-04-08 23:48:39 +03:00
Yahor Berdnikau
92d200e093 Update advance Gradle version to 7.0-rc-2.
^KT-44949 In Progress
2021-04-08 21:24:43 +03:00
Ilya Goncharov
583dba51c1 [Gradle, JS] Initialize File hasher service during IDEA import 2021-04-08 20:24:43 +03:00
Nikolay Krasko
7d78e610b1 Allow ProtoBufCompareConsistencyTest to work on teamcity 2021-04-08 18:51:12 +03:00
Nikolay Krasko
14ead33db6 Add teamcity problems when generating files instead of exception 2021-04-08 18:51:10 +03:00
Nikolay Krasko
3757bd0c1f Use environment variable for getting TEAMCITY_VERSION 2021-04-08 18:51:09 +03:00
Nikolay Krasko
02e37dceeb Regenerate LightAnalysisModeTestGenerated.java 2021-04-08 18:51:08 +03:00
Abduqodiri Qurbonzoda
46338224e1 Remove deprecated JQuery 2021-04-08 18:43:16 +03:00
Sergey Bogolepov
6ab38c1ff8 Add support for Apple Silicon simulators 2021-04-08 16:51:51 +03:00
Sergey Bogolepov
3718907c6a Use -target instead of -arch in ClangArgs
Explicit target selection helps Clang to
 correctly set things up in case of Apple Silicon
 simulator target.
2021-04-08 16:51:49 +03:00
Sergey Bogolepov
79bf2a1f14 Drop useless bitness property from Architecture 2021-04-08 16:51:48 +03:00
Sergey Bogolepov
9b1498abad Use runtime bitcode to get size of primitive types
As an alternative to explicitly setting type size in konan.properties or
backend code we can "ask" LLVM about it.
Unfortunately, there is no Clang/LLVM API for it,
so we use a trivial workaround:
Create dumb function in runtime code, and then extract info about
return type size using LLVM.
2021-04-08 16:51:47 +03:00
Sergey Bogolepov
790fea635d Avoid explicit native targets enumerations 2021-04-08 16:51:45 +03:00
Sergey Bogolepov
15dcb36f47 Use TargetTriple in backend to simplify code. 2021-04-08 16:51:44 +03:00
Leonid Startsev
f94e8f95d1 Support new inline(value) class syntax in serialization plugin
Use .isInlineClass() instead of .isInline + .isValue

#KT-45783 Fixed
2021-04-08 11:52:18 +00:00
Alexander Likhachev
16dc0a7d29 [Gradle] Read more system properties through Gradle providers
Related to #KT-43605
2021-04-08 14:28:05 +03:00
Alexander Likhachev
ccfc16c84a [Gradle] Add IT for configuration cache on project with buildSrc
Related to #KT-43605
2021-04-08 14:28:05 +03:00
Alexander Likhachev
c44d83c6ba [Gradle] Move Kotlin daemon system properties read to build service
Instead of having a copy of those properties in each task move them into single build service
Related to #KT-43605
2021-04-08 14:28:00 +03:00
Elena Lepilkina
5f2095217d [Native] Removed slack reports for benchmarks 2021-04-08 10:39:16 +00:00
Jinseong Jeon
20c095a4f4 FIR IDE: Remove the redundant dependency in :idea:idea-frontend-api 2021-04-08 11:30:50 +02:00
Dmitriy Dolovov
caee17fddb [IR] Bump ABI version due to string serialization format change 2021-04-08 12:22:48 +03:00
Pavel Punegov
afdecef112 Use minOrNull instead of deprecated min in the interop_objc_test 2021-04-08 11:57:34 +03:00
Elena Lepilkina
512010046f [K/N] Replaced sumBy with sumOf 2021-04-08 11:57:33 +03:00
Elena Lepilkina
53c80cf03b [K/N] Replaced usage of minBy/maxBy in samples and benchmarks 2021-04-08 11:57:33 +03:00
Vasily Levchenko
d2d324797b [build][xcode][warning][todo] suppress deprecation warning with todo till bootstrap bump 2021-04-08 10:42:44 +02:00
Dmitriy Dolovov
1fa0ba987b Revert "[IR] Bump ABI version due to string serialization format change"
This reverts commit 4df5dcdf
2021-04-08 09:46:12 +03:00
Mikhail Glukhikh
9af1de272e FIR: support private-in-file effective visibility 2021-04-08 09:41:26 +03:00
Mikhail Glukhikh
6ee169c01e Rename EffectiveVisibility.Private to PrivateInClass 2021-04-08 09:41:26 +03:00
Mikhail Glukhikh
3c9f0e4775 Add PrivateInFileEffectiveVisibility language feature (1.6) 2021-04-08 09:41:26 +03:00
Mikhail Glukhikh
7f092264f7 FE 1.0: introduce deprecation EXPOSED_FROM_PRIVATE_IN_FILE
#KT-20094 Fixed
2021-04-08 09:41:25 +03:00
Mikhail Glukhikh
4bd44fa61b FE 1.0: introduce PrivateInFile effective visibility #KT-20094 Fixed 2021-04-08 09:41:25 +03:00
Mikhail Glukhikh
addfa27980 Fix various EXPOSED_FROM_PRIVATE_IN_FILE deprecations 2021-04-08 09:41:25 +03:00
pyos
1b1949d242 FIR: generate destructurings for more than one parameter 2021-04-08 09:41:23 +03:00
Dmitriy Dolovov
4df5dcdf75 [IR] Bump ABI version due to string serialization format change
^KT-33175
2021-04-08 09:40:22 +03:00
Dmitriy Dolovov
8d4d9a1f0b [K/N][IR] Re-enable string_builder0 and utf8 tests in 2-stage mode
^KT-33175
2021-04-08 09:40:16 +03:00
Dmitriy Dolovov
2e96a6c63c [K/N][IR] Re-enable Harmony regex tests
^KT-33175
2021-04-08 09:40:12 +03:00
Dmitriy Dolovov
eb0f47b04e Include tests from :kotlin-util-io and :kotlin-util-klib into :miscCompilerTest
^KT-33175
2021-04-08 09:40:07 +03:00
Dmitriy Dolovov
50326f019b [IR] Use the proper encoding for string serialization
^KT-33175
2021-04-08 09:40:02 +03:00
Sergey Bogolepov
7272e5dcad Unify checks for iOS device in backend.native tests 2021-04-08 09:18:30 +03:00
Sergey Bogolepov
316d62a72f Perform codesign in tests for all simulators 2021-04-08 09:18:29 +03:00
Sergey Bogolepov
7b06249e7f Fix clang usage in backend.native:tests
For Apple Silicon targets we need to call Clang
1. From toolchain because the one from our distro is too old.
2. With appropriate flags for setting the sysroot.
2021-04-08 09:18:28 +03:00
Sergey Bogolepov
437a0aa450 Prepare test infrastructure for Apple Silicon simulators.
* Get rid of explicit target enumerations by using TargetTriple.
* Remove some code duplication with `project.testTargetConfigurables`
2021-04-08 09:18:27 +03:00
Sergey Bogolepov
cebf815fed Introduce a proper TargetTriple class.
Target triple (like `arm64-apple-ios-simulator`) is a common
way to represent any target platform.
One of many useful properties: it allows to explicitly
distinguish iOS arm64 simulator target and a real device.
2021-04-08 09:18:25 +03:00
Abduqodiri Qurbonzoda
19116e5623 Migrate compiler and others from sumBy to sumOf 2021-04-08 03:48:02 +03:00
Abduqodiri Qurbonzoda
33b44585c4 Deprecate sumBy and sumByDouble with WARNING 2021-04-08 03:48:01 +03:00
Abduqodiri Qurbonzoda
983985bc68 [K/N] Migrate compiler, interop and others to new case conversion api 2021-04-08 03:22:05 +03:00
Abduqodiri Qurbonzoda
a4839b8548 [K/N] Migrate runtime to new case conversion api 2021-04-08 03:22:04 +03:00
Abduqodiri Qurbonzoda
40d1849f33 Migrate compiler, idea and others to new case conversion api 2021-04-08 03:22:02 +03:00
Abduqodiri Qurbonzoda
aa543c6631 Migrate stdlib, tests and samples to new case conversion api 2021-04-08 03:22:01 +03:00
Abduqodiri Qurbonzoda
a697bc43b9 [K/N] Remove redundant @OptIn targeting new case conversion api 2021-04-08 03:22:00 +03:00
Abduqodiri Qurbonzoda
f99c72cc98 Remove redundant @OptIn targeting new case conversion api 2021-04-08 03:21:59 +03:00
Abduqodiri Qurbonzoda
7f0e1ac08d [K/N] Deprecate old Char and String case conversion api #KT-43023 2021-04-08 03:21:58 +03:00
Abduqodiri Qurbonzoda
cbef9dad36 Deprecate old Char and String case conversion api #KT-43023 2021-04-08 03:21:57 +03:00
Igor Yakovlev
7a3781ec14 [FIR IDE] Use raw fir for modality and visibility in KtFirNamedClassOrObjectSymbol 2021-04-07 23:23:03 +02:00
Ilya Gorbunov
7cd306950a Deprecate Char-to-Number conversions in stdlib (Native)
- Synchronize code of Ranges, Progressions, ProgressionIterators
- Suppress deprecations in regex implementation code

KT-23451
2021-04-07 18:30:21 +03:00
Ilya Gorbunov
833955e56d Migrate deprecations in Native compiler
Replacing deprecated Char.toInt() with Char.code and
Number.toChar() with Number.toInt().toChar(), where Number is not Int.

KT-23451
2021-04-07 18:30:21 +03:00
Ilya Gorbunov
e450a6494a Migrate deprecations in core, compiler, idea, tests
Replacing deprecated Char.toInt() with Char.code and
Number.toChar() with Number.toInt().toChar(), where Number is not Int.

KT-23451
2021-04-07 18:30:20 +03:00
Ilya Gorbunov
b64b96eee6 Deprecate Char-to-Number conversions in stdlib (JVM and JS)
- Int.toChar was left non-deprecated because the replacement is not intrinsic yet.
- Number.toChar was left non-deprecated because otherwise the deprecation propagates to the override, Int.toChar.

KT-23451
2021-04-07 18:30:20 +03:00
Ilya Goncharov
b976cd812a [IR] Use extractTypeParameter instead of collectTypeParameters
^KT-45866 fixed
2021-04-07 18:13:08 +03:00
Ilya Goncharov
5955faecec [IR] Ignore WASM and FIR for tests
^KT-45866 fixed
2021-04-07 18:13:07 +03:00
Ilya Goncharov
b82c9225c8 [IR] Fix copying of default argument from expect to actual with type parameter
^KT-45866 fixed
2021-04-07 18:13:06 +03:00
Vasily Levchenko
d870876822 [kotlin/native][test] test for KT-33055 2021-04-07 15:04:57 +00:00
Vasily Levchenko
ef712f8f97 [kotlin/native][test] enabled stack_trace_inline back 2021-04-07 15:04:56 +00:00
Vasily Levchenko
a11b07f6c3 [codegeneration][debug info] generates marker of inlined function body on call site
- makes debuger breakpoint resolution more accurate
- restore expected behavior stack_trace_inline test
- fixes kt-33055
2021-04-07 15:04:56 +00:00
Victor Turansky
585e4254a0 Gradle 7.0 support update. com.gradle.plugin-publish 0.13.0 -> 0.14.0. 2021-04-07 18:01:23 +03:00
Vladimir Ivanov
61883ee878 Exclude kdoc related stuff from proto comparison in IC (#4283) 2021-04-07 17:16:06 +03:00
Sergey Bogolepov
9e6cf11026 Drop LLVM profiling frags from Clang invocation
It is not needed in most cases, but may affect profile
when running compiler with -Xprofile-phases.
2021-04-07 12:48:20 +00:00
Abduqodiri Qurbonzoda
b18cd24b81 [K/N] Advance deprecation level of FP to lesser than Int types to ERROR #KT-30360 2021-04-07 15:43:06 +03:00
Ilya Gorbunov
22ca412dd2 Fix case-insensitive character-wise comparison KT-45496
- Step 1: add failing tests
- Step 2: fix common case insensitive Char.equals
- Step 3: fix case insensitive String.equals in K/JS
- Step 4: enable unicode case folding in K/JS Regexes and
  string replacement (KT-45928)
- Step 5: fix case insensitive char comparison in K/N in String functions
  String.replace, equals, compareTo with ignoreCase
2021-04-07 14:43:41 +03:00
Andrey Zinovyev
fc8b75be80 [FIR] Add ONLY_ONE_CLASS_BOUND_ALLOWED diagnostic 2021-04-07 11:31:08 +00:00
Alexander Likhachev
68f39768ae [Gradle, JS] Fix KotlinPackageJsonTask's dependent tasks finder
Throw IllegalStateException instead of adding faulty dependency
2021-04-07 14:18:38 +03:00
Alexander Likhachev
bad33ac820 [Gradle, JS] Make Dukat tasks really compatible with conf cache
Related to #KT-42911
2021-04-07 13:23:59 +03:00
Alexander Likhachev
4416f2eb3f [Gradle, JS] Use file hasher for ProcessedFilesCache
Gradle's FileHasher can cache calculated hashes saving execution time
#KT-45774 In Progress
2021-04-07 13:23:59 +03:00
Alexander Likhachev
6e333c4f3f [Gradle, JS] Store RootNpmResolver's heavy state in build service params
That heavy state was duplicated in serialized state of each task that has access to it transitively.
#KT-45294 Fixed
2021-04-07 13:23:58 +03:00
Alexander Likhachev
14f6e5db6d [Gradle, JS] Optimize JS tasks serialized size
Tasks are serialized by Gradle's configurations cache. Each referenced object by task is also serialized. Reduce task's size by narrowing referenced objects.
#KT-45294 In Progress
2021-04-07 13:23:57 +03:00
Alexander Likhachev
072492386d [Gradle, JS] Return back package.json handlers 2021-04-07 13:15:10 +03:00
Igor Yakovlev
39edcb0f29 [FIR IDE] Fix invalid caches reset for Fir Renderer tests 2021-04-07 11:25:22 +02:00
Igor Yakovlev
7d3be9eafa [FIR IDE] Implement fir renderer for IDE 2021-04-07 11:25:22 +02:00
Igor Yakovlev
f2e02c2d50 [FIR IDE] Fixed invalid type parameters for inner classes 2021-04-07 11:25:22 +02:00
Igor Yakovlev
ea8858e694 [FIR] Add contaning class lookup element for local FirRegular classes 2021-04-07 11:25:22 +02:00
Igor Yakovlev
a428cc6eb4 [FIR IDE] Add symbol kind to Kt accessor symbols 2021-04-07 11:25:22 +02:00
Igor Yakovlev
ff9edb8776 [FIR IDE] Fixed getting symbols for lambda literal 2021-04-07 11:25:22 +02:00
Igor Yakovlev
d05ef3a635 [FIR] Move standard class id's into common module 2021-04-07 11:25:21 +02:00
Alexander Likhachev
df8682650a [Build] Enable Gradle file system watching by default 2021-04-07 12:23:39 +03:00
Alexander Likhachev
cc722d0a2c [Build] Bump Gradle to v6.8.3
#KTI-542 Fixed
2021-04-07 12:23:32 +03:00
Andrey Zinovyev
0f04fac5b2 [FIR] Add BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER diagnostic 2021-04-07 08:19:31 +00:00
Abduqodiri Qurbonzoda
b0f1ddc91e Advance max/min(By/With) deprecation level to ERROR 2021-04-07 07:49:23 +03:00
Ilya Gorbunov
d70edeb38b Hide deprecated JS Math object from public API and rename to JsMath
KT-41318

- Rename Math to JsMath and remove unused functions
- Fix return types, remove duplicating JsMath from longjs.kt

Co-authored-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2021-04-07 00:39:47 +03:00
Abduqodiri Qurbonzoda
d9ab96126d Advance deprecation level of mixed Int/FP overloads of ClosedRange.contains to HIDDEN KT-22423 2021-04-07 00:23:34 +03:00
Abduqodiri Qurbonzoda
7a6cddf6fe [K/N] Advance String(CharArray) deprecation level to ERROR 2021-04-07 00:23:32 +03:00
Abduqodiri Qurbonzoda
d28d0a6321 Advance String(CharArray) deprecation level to ERROR in Common and JS 2021-04-07 00:23:29 +03:00
Abduqodiri Qurbonzoda
29040d6f53 Remove deprecated Clock and ClockMark 2021-04-07 00:23:28 +03:00
Abduqodiri Qurbonzoda
abcc572b97 Remove deprecated scanReduce and scanReduceIndexed 2021-04-07 00:23:26 +03:00
Abduqodiri Qurbonzoda
8300180261 [K/N] Remove AfterEach and BeforeEach typealiases in kotlin-test 2021-04-07 00:23:24 +03:00
Abduqodiri Qurbonzoda
c46d71d4ac Remove DefaultAsserter() constructor-like function in kotlin-test 2021-04-07 00:23:22 +03:00
Abduqodiri Qurbonzoda
968099fbec Advance deprecation level of FP to lesser than Int types to ERROR #KT-30360 2021-04-07 00:23:20 +03:00
Ivan Kochurkin
404c69ded7 [FIR] Implement INCORRECT_CHARACTER_LITERAL, EMPTY_CHARACTER_LITERAL, TOO_MANY_CHARACTERS_IN_CHARACTER_LITERAL, ILLEGAL_ESCAPE, ILLEGAL_ESCAPE_SEQUENCE diagnostics, fix tests 2021-04-06 20:44:32 +03:00
Abduqodiri Qurbonzoda
91d42fe345 [K/N] Advance deprecation level of subarrayContentToString to ERROR 2021-04-06 18:44:22 +03:00
Abduqodiri Qurbonzoda
7fdf7c6175 [K/N] Move declarations from Text.kt to Strings.kt and StringBuilder.kt 2021-04-06 18:44:20 +03:00
Abduqodiri Qurbonzoda
71afd112c6 [K/N] Remove old String and utf8 conversion api #KT-31343 2021-04-06 18:43:41 +03:00
Abduqodiri Qurbonzoda
e8992c5d19 Advance deprecation level of InputStream.readBytes(estimatedSize) to ERROR 2021-04-06 18:42:53 +03:00
Renee Vandervelde
d520c37454 Add assertEquals and assertNotEquals for floating point numbers to kotlin-test #KT-8364 2021-04-06 18:37:09 +03:00
Abduqodiri Qurbonzoda
ff59b1c2ef Introduce assertContains in kotlin-test #KT-45582 2021-04-06 18:36:56 +03:00
Alexander Likhachev
8440c5722f [Gradle] Read property idea.active in tests registry via Gradle provider 2021-04-06 18:17:34 +03:00
Ivan Gavrilovic
4e5f6492d9 [Gradle, MPP] Make init script for tests compatible w/ conf cache
Avoid using `beforeTask` API and switch to ones that are
compatible with Gradle configuration cache.
2021-04-06 18:17:34 +03:00
Svyatoslav Scherbina
df77cd303f Don't use exitProcess to indicate a failure in Native library resolver
If Native compiler performs exitProcess, it crashes Gradle daemon that
runs the compiler.
2021-04-06 13:18:07 +00:00
Ilya Gorbunov
f1cdd0e2ed Add description for kotlin.io.path package 2021-04-06 14:24:43 +03:00
Ilya Gorbunov
81f2aea316 Stabilize existing Path API and annotate with @Throws where appropriate
KT-45913
2021-04-06 14:24:42 +03:00
Tianyu Geng
1496c82108 FIR IDE: add TypeInfoProvider and mixin to host type utils 2021-04-06 13:19:00 +02:00
Tianyu Geng
4d505f4393 FIR IDE: add intention to add custom accessor to uninitliazed property 2021-04-06 13:19:00 +02:00
Tianyu Geng
78f450a6ef FIR IDE: move common logic in add accessor intention to idea-frontend-independent 2021-04-06 13:19:00 +02:00
Tianyu Geng
7713d05272 FIR IDE: move some common action classes to idea-frontend-independent 2021-04-06 13:19:00 +02:00
Tianyu Geng
6d69959bfd FIR IDE: register quickfix to add lateinit modifier 2021-04-06 13:19:00 +02:00
Tianyu Geng
d5ea68c585 FIR IDE: add quick fix to add initializer for MUST_BE_INITIALIZED_OR_BE_ABSTRACT 2021-04-06 13:19:00 +02:00
Tianyu Geng
72f7405e4a FIR IDE: add quickfix to add abstract modifier for MUST_BE_INITIALIZED_OR_BE_ABSTRACT 2021-04-06 13:19:00 +02:00
Ilya Kirillov
638e192f8c FIR IDE: add // FIR_IDENTICAL to Jet53.kt 2021-04-06 13:13:21 +02:00
Ilya Kirillov
ed0f2751d1 FIR IDE: fix invalid isTeamCityBuild in tests 2021-04-06 13:13:21 +02:00
Pavel Punegov
e23d09beb6 [Native] Return kotlinCompilerRepo parameter back
This parameter is used to specify maven path in case of kotlin_version
rewriting that happens during Nightly test runs.
2021-04-06 09:59:08 +00:00
Dmitriy Novozhilov
3ef87d0265 [FIR] Add effective visibility to resolved status
This commit includes:
- introduce FirResolvedDeclarationStatus.effectiveVisibility
- replace FirEffectiveVisibility with EffectiveVisibility
- move calculation of effective visibility from FirEffectiveVisibilityResolver
  (which is deleted) to FirStatusResolver and FirDeserializer
2021-04-06 12:30:46 +03:00
Dmitriy Novozhilov
a600d18396 [FIR] Resolve statuses of all classes on path in FirDesignatedStatusResolveTransformer
This is required for calculating of effective visibility, because it
  depends on effective visibility of outer class (those changes are
  added in next commit)
Also fix incorrect designation building for local classes
2021-04-06 12:30:45 +03:00
Dmitriy Novozhilov
220f8a9169 Make EffectiveVisibility methods take typeContext instead initializing it in constructor
This is needed to reuse EffectiveVisibility in FIR, because typeContext
  in it is used to call `isSubtypeOf`, and in FIR it's required to use
  context from use site session (to see all declaration which are
   available in module)
2021-04-06 12:30:44 +03:00
Dmitriy Novozhilov
d7cd9e4c44 [FIR] Cleanup FirStatusTransformerExtension 2021-04-06 12:30:43 +03:00
Dmitriy Novozhilov
66668b2294 [FIR] Support resolve of local typealiases 2021-04-06 12:30:42 +03:00
Dmitriy Novozhilov
3cb17ac2f0 [FIR] Implement FirReturnAllowedChecker
Supported diagnostics:
- RETURN_NOT_ALLOWED
- RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY
2021-04-06 12:30:41 +03:00
Dmitriy Novozhilov
254ff77977 [FIR] Fix creating source for return expressions in light tree fir builder 2021-04-06 12:30:39 +03:00
Dmitriy Novozhilov
22cbb8720a [FIR] Fix computing labels of anonymous functions (not lambdas) 2021-04-06 12:30:38 +03:00
Dmitriy Novozhilov
8a549cafec [FIR] Cleanup CheckerContext.kt 2021-04-06 12:30:37 +03:00
Dmitriy Novozhilov
2271bb5d61 [FIR] Add positioning strategy for return keyword 2021-04-06 12:30:36 +03:00
Dmitriy Novozhilov
76f2e349cc [FIR] Introduce FirReturnExpressionChecker 2021-04-06 12:30:35 +03:00
Dmitriy Novozhilov
5ebd24eac5 [FIR] Save inline status of lambda after resolution 2021-04-06 12:30:34 +03:00
Svyatoslav Scherbina
a4b9e2502c Native: don't use frame pointer in leaf functions on ARM64 targets
Clang 8 and Clang 11 both have this optimization, but it was moved
from LLVM to Clang:

c5b890e922...a0aa58dad5

So Kotlin/Native compiler now has to enable this optimization explicitly.
2021-04-06 08:44:12 +00:00
Svyatoslav Scherbina
2b6d8ab975 Native: replace no-frame-pointer-elim* LLVM attributes by frame-pointer
LLVM 8 and LLVM 11 understand both, but *frame-pointer-elim*
are obscure and obsolete.
2021-04-06 08:44:12 +00:00
Him188
f90cbb0ce7 Support properties from primary constructor in JvmFieldApplicabilityChecker
#KT-32753 In progress
2021-04-06 11:40:44 +03:00
Dmitriy Novozhilov
e4ebeec275 Build: explicitly disable -Xuse-fir arg for some modules 2021-04-06 11:40:43 +03:00
Dmitriy Novozhilov
99e681ec1d [NI] Assume that ILT is number type in inference
#KT-41679 Fixed
2021-04-06 11:40:42 +03:00
Dmitriy Novozhilov
a107e3d160 Support actualization of expect sealed class with typealias in CliSealedClassInheritorsProvider 2021-04-06 11:40:40 +03:00
Dmitriy Novozhilov
fe81078366 Allow sealed inheritors for expect sealed classes in MPP submodules
KT-45842 Fixed
KTIJ-7068
2021-04-06 11:40:39 +03:00
Dmitriy Novozhilov
1633190478 Refine expect classes in CliSealedClassInheritorsProvider
KT-45796 Fixed
2021-04-06 11:40:36 +03:00
Mikhail Glukhikh
2ee8ac2e15 FirPropertyAccessorChecker: extract checkSetter, suppress properly 2021-04-06 11:13:17 +03:00
Jinseong Jeon
68fb15f9a4 FIR checker: consolidate property accessor checks 2021-04-06 11:13:16 +03:00
Elena Lepilkina
85cb8eb959 [Native][perf] Increase heap space for K/N compiler in performance project 2021-04-06 09:27:28 +03:00
nataliya.valtman
bce677f7f7 Generate tests for companion constant changes 2021-04-06 07:13:13 +03:00
Leonid Startsev
70fa6d50d3 Prohibit serializable inner classes
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1101
2021-04-05 18:26:25 +03:00
Leonid Startsev
c66cddc442 Prohibit serializable annotation on local classes and anonymous objects
#KT-45541 Fixed
2021-04-05 18:26:24 +03:00
Leonid Startsev
3b789448a3 Support static final write$Self method inside serializable classes on IR
to properly serialize class hierarchies with/or private fields.
JVM only for now, because Native/JS do not have private fields.
Update tests and test data and rebase fix.
Unify formEncodeDecodePropertyCall functions.
Fix incorrect reference to object in writeSelf,
so properties dependent on other properties would be correctly compared
with defaults.
2021-04-05 18:25:46 +03:00
Leonid Startsev
9be5421e7c Use .nullable extension instead of NullableSerializer() constructor
Use correct projection in createClassReference()
so primitive-boxes arrays behave correctly on JVM
2021-04-05 18:25:45 +03:00
Dmitry Petrov
120eba8d3d Minor: add tests for KT-45893 2021-04-05 17:50:43 +03:00
Andrey Zinovyev
e10df86037 [FIR] Add UPPER_BOUND_IS_EXTENSION_FUNCTION_TYPE diagnostic 2021-04-05 17:15:32 +03:00
Alexander Shabalin
451fc8e9df Fix enum isFrozen for wasm 2021-04-05 14:07:29 +00:00
yantimirov-timur
9e7f6332d1 [FIR] Complete WRONG_SETTER_TYPE_PARAMETER checker 2021-04-05 16:17:34 +03:00
Julia
5472199bb1 [FIR] Introduce supertypes-for-annotation-class checker 2021-04-05 15:54:57 +03:00
Mikhail Glukhikh
caeb0b43be FIR: introduce JvmPlatformOverloadsConflictResolver
The added here JvmPlatformOverloadsConflictResolver prefers Java field
to property in case of conflicts.
2021-04-05 15:54:49 +03:00
Ilya Goncharov
9b3c154bef [Gradle, JS] Remove source maps flags in IR 2021-04-05 15:12:53 +03:00
Andrey Zinovyev
67505a0071 [FIR] Add FINAL_UPPER_BOUND checker 2021-04-05 14:51:44 +03:00
Elena Lepilkina
d0513c9ece [Native][perf] Removed unneeded workaround 2021-04-05 10:52:55 +00:00
Elena Lepilkina
1fea08aac1 [Native][Performance server] Fix request for new composite build numbers 2021-04-05 10:52:54 +00:00
Denis.Zharkov
0637748f10 FIR: Introduce NAMED_PARAMETER_NOT_FOUND diagnostic 2021-04-05 12:58:07 +03:00
Jinseong Jeon
2d42e64c17 FIR: prefer flexible type over other equal types when computing intersection 2021-04-05 10:39:51 +03:00
Jinseong Jeon
0d3969597c FIR: more accurate nullability of intersection of flexible types 2021-04-05 10:39:51 +03:00
Jinseong Jeon
871b5a2174 FIR: fix nullability computation of intersection of flexible types
Without this, currently,

  it(ft(J..J?), ft(J..J?) => J

which should be ft(J..J?) instead.
2021-04-05 10:39:51 +03:00
Dmitriy Novozhilov
0cb039eea7 Fix compilation of :kotlin-gradle-plugin:functionalTest 2021-04-03 17:04:27 +03:00
Dmitriy Novozhilov
f1cef0fc95 Update testdata 2021-04-03 16:52:05 +03:00
Dmitriy Novozhilov
13d9520a4a Revert "[TMP] Add -Xskip-prerelease check to maven projects"
This reverts commit 57929ab5
2021-04-03 14:31:46 +03:00
Dmitriy Novozhilov
9c4d35747a Revert "[TMP] Disable maven itnegration tests"
This reverts commit 4a10de0c
2021-04-03 14:31:40 +03:00
Dmitriy Novozhilov
e10792e1c6 Advance bootstrap to 1.5.20-dev-4401 2021-04-03 14:31:34 +03:00
Dmitriy Novozhilov
e97140a4a7 Advance bootstrap to 1.5.20-dev-4399 2021-04-03 13:52:47 +03:00
Dmitriy Novozhilov
4a10de0ce3 [TMP] Disable maven itnegration tests
This commit will be reverted after bootstrap to stable stdlib
2021-04-03 13:31:34 +03:00
Dmitriy Novozhilov
57929ab587 [TMP] Add -Xskip-prerelease check to maven projects
This commit will be reverted after bootstrap to stable stdlib
2021-04-03 13:31:33 +03:00
Dmitriy Novozhilov
69aef01b25 Switch IS_PRE_RELEASE flag to false 2021-04-03 13:13:32 +03:00
Ilya Gorbunov
35ae913a5e Stabilize new string and char case conversion API KT-45873 2021-04-03 10:39:17 +03:00
Ilya Gorbunov
256f634e61 Support all digit chars in digitToInt on JVM KT-23451 2021-04-03 10:30:50 +03:00
Ilya Gorbunov
8b85bae020 Stabilize Char-to-Int conversions KT-45874 2021-04-03 10:30:50 +03:00
Vladimir Ivanov
c5f06d6e3f Patch expectedLazyNoGenerics.h to corresond with new test (#4271) 2021-04-02 19:38:22 +03:00
Ilya Kirillov
5f9d18d8bc FIR IDE: resolve argument type super types & type args when checking for overridden
When we check overrides from IDE, we need to check argument types for subtyping.
When checking for subtyping, we need type parameters declared
in defining classes to be resolved to TYPES phase
and super types to be resolved to SUPER_TYPES phase.
Otherwise, they will be resolved to RAW_FIR and subtyping will throw
"ISE Expected FirResolvedTypeRef with ConeKotlinType but was FirUserTypeRefImpl"
2021-04-02 17:24:27 +02:00
Ilya Kirillov
5ceec858aa FIR IDE: do not search for sealed class inheritors on every class resolve 2021-04-02 17:15:30 +02:00
Ilya Gorbunov
0e93924ff3 Duration: inWholeUnits properties instead of inUnits
Introduce conversion properties returning Long values,
deprecate the old ones returning Doubles.
2021-04-02 17:44:10 +03:00
Ilya Gorbunov
11d15f3343 Make Duration storage ranges symmetric and non-overlapping
Increase accuracy of multiplication and division.
2021-04-02 17:44:10 +03:00
Ilya Gorbunov
4fd2254f3f Advance TestTimeSource more precisely
Change durations in its test so that they hold precise number
of nanoseconds
2021-04-02 17:44:08 +03:00
Ilya Gorbunov
fa7460ba48 Store Duration value as a multi-range Long
Now precision loss happens at bigger durations.

This changes the binary API due different underlying type of Duration.
2021-04-02 17:43:20 +03:00
Tianyu Geng
3f4fa7eb98 FIR checker: make FirFunctionNameChecker a subclass of FirSimpleFunctionChecker 2021-04-02 17:32:22 +03:00
Tianyu Geng
d7cae63cb0 FIR checker: fix UPPER_BOUND_VIOLATED
The diagnostics accepts one parameter for the expected upper bound for
the type parameter.
2021-04-02 17:32:22 +03:00
Tianyu Geng
bd64237519 FIR checker: fix checker registration
Previously, composed checker passes the `allXXX` flavor of checkers to
each category of checkrs. This makes the composed checkers
non-transparent: behavior changes after composing. In addition, nested
composing would create redundant checkers.

As a result, some checkers registered in the IDE mode
(org.jetbrains.kotlin.idea.fir.low.level.api.diagnostics.AbstractFirIdeDiagnosticsCollector)
are not invoked with the FIR plugin.

This change does two things:
1. pass on checkers to composed checkers without combining
2. use combined checkers in DeclarationCheckersDiagnosticComponent and
   ExpressionCheckersDiagnosticComponent
2021-04-02 17:32:22 +03:00
Svyatoslav Scherbina
65fa2f62bd Fix :kotlin-native:**:nativelibs Gradle tasks
These tasks did copy all files from build to build/nativelibs, thus
causing up-to-date checks to fail, and native libs and temporary build
files to be accumulated in recursive directories like
nativelibs/nativelibs/... in both build dirs and dist.

Fix this by copying only relevant files.
2021-04-02 14:13:48 +00:00
Mikhail Glukhikh
f0ff9ad5a7 FIR: rename AMBIGUITY to OVERLOAD_RESOLUTION_AMBIGUITY to match FE 1.0 2021-04-02 16:22:01 +03:00
Alexander Shabalin
71397a06fb Add Stop-the-World Mark & Sweep GC for single-threaded programs.
GC implementation for testing purposes

* Only works for a single mutator
* Runs on the same thread as the mutator
* Runs every nth checkpoint and after every m bytes are allocated
* Runs finalizers after sweeping on the mutator thread.
2021-04-02 12:13:44 +00:00
Mikhail Glukhikh
e7102cd63f FIR: fix FQ_NAMES_IN_TYPES renderer 2021-04-02 15:11:02 +03:00
Tianyu Geng
761a0a7d0d FIR checkers: report specific errors instead of INAPPLICABLE_CANDIDATE
Specifically, the report the following 4 errors.

* NON_VARARG_SPREAD
* ARGUMENT_PASSED_TWICE
* TOO_MANY_ARGUMENTS
* NO_VALUE_FOR_PARAMETER

Also added/updated the following position strategies.
* NAME_OF_NAMED_ARGUMENT
* VALUE_ARGUMENTS
2021-04-02 14:36:14 +03:00
Tianyu Geng
fc8d0e3ee0 FIR checkers: report VAL_REASSIGNMENT for assignment operators
Currently VAL_REASSIGNMENT are only reported on direct assignments.
Reassignments in the form of, for example, `+=` are reported as
`VARIABLE_EXPECTED`, which differs from FE1.0.
2021-04-02 13:33:52 +03:00
Vladimir Ivanov
b87a943efd [Native] Add test for -Xexport-kdoc (#4249)
(*) Fix exported kdoc indentation and extra blank lines
2021-04-02 12:10:09 +03:00
Dmitry Petrov
eefb6e94a9 Minor: update tests to pass on Android 2021-04-02 10:53:30 +03:00
Mikhail Glukhikh
42d53dd954 FIR: introduce delegated & overridden conflict checks 2021-04-02 10:24:20 +03:00
Mikhail Glukhikh
566dc434cc FIR: introduce MANY_*_MEMBER_NOT_IMPLEMENTED diagnostic 2021-04-02 10:24:20 +03:00
Mikhail Glukhikh
9f27362ee1 Match triangle & diamond intersections in FirTypeIntersectionScope 2021-04-02 10:24:20 +03:00
Anton Yalyshev
a7a1b678bd Enable for AS possibility to collect FUS data 2021-04-02 10:03:38 +03:00
Dmitriy Dolovov
003d07b51e [K/N][IR] Ref to expect property in actual declaration is not remapped
^KT-36880
2021-04-02 09:35:46 +03:00
Elena Lepilkina
393aaac2b9 [Native] Removed old gradle properties for kotlin repo and versions 2021-04-02 05:42:13 +00:00
Dmitry Petrov
19fb7ebfd5 JVM_IR fix local class names for files with @JvmPackageName 2021-04-02 00:08:55 +03:00
Alexander Udalov
c4b2b7e0da Add underlying property name & type for inline class to kotlinx-metadata
#KT-45635 Fixed
2021-04-01 22:34:53 +02:00
Alexander Udalov
9b5bbb95e7 Refactor CirConstantValue similarly to KmAnnotationArgument
Introduce LiteralValue with generic value, and remove `value` from
enum/array/null subclasses.
2021-04-01 22:34:53 +02:00
Alexander Udalov
5f7f4a4ac8 Improve API of annotation arguments in kotlinx-metadata
See changes in ChangeLog.md for more information
2021-04-01 22:34:53 +02:00
Alexander Udalov
1a82158472 Fix array of KClass annotation arguments in kotlinx-metadata-jvm
#KT-45594 Fixed
2021-04-01 22:34:53 +02:00
Ilya Kirillov
e2084a180b FIR IDE: fix invalid FirSessionWithModificationTracker.isValid 2021-04-01 21:16:18 +02:00
Ilya Kirillov
ea451fa7ae Revert: "FIR IDE: do not run STATUS phase under lock" 2021-04-01 21:16:17 +02:00
Ilya Kirillov
5f4b42a309 FIR IDE: temporary do not fail on non-resolved reference while resolving calls 2021-04-01 21:16:17 +02:00
Alexander Udalov
ce0c0ad2e3 JVM IR: get rid of toIrBasedKotlinType in MethodSignatureMapper
Commonize (in terms of TypeSystemCommonBackendContext implementations
for KotlinType/IrType) code that computes optimal TypeMappingMode to
apply to different positions where inline class types can be present.
2021-04-01 20:17:45 +02:00
Alexander Udalov
b59ac5d8f6 JVM IR: do not use old KotlinTypeMapper when coercing inline classes
KotlinTypeMapper.mapInlineClassTypeAsDeclaration and
mapUnderlyingTypeOfInlineClassType invoked mapType which is defined in
descriptorBasedTypeSignatureMapping.kt and works on KotlinType.

It didn't lead to any problems, other than the fact that we were
constructing IrBasedClassDescriptor in JVM IR, and then KotlinType to
pass it to mapType, on each call to StackValue.boxInlineClass or
unboxInlineClass, which seems wasteful.

Instead of this, refactor these utilities to use type markers instead,
pass IrType and IrTypeMapper directly from JVM IR, and move the "static
type mapper" logic (which is used only in the old backend) out of
KotlinTypeMapper.
2021-04-01 20:17:45 +02:00
Ilmir Usmanov
b5ecccb610 Enable suspend in fun interfaces by default
#KT-45836 Fixed
2021-04-01 20:26:42 +03:00
Jinseong Jeon
572c0b2ade Raw FIR: make sure loop target preparation and loop configuration match
by using the generated loop target during preparation in a message
passing fashion
2021-04-01 20:07:53 +03:00
Jinseong Jeon
bb242f022f FIR renderer: avoid StackOverflow when rendering loop jump condition
For example,
```
do {
  ...
} while(
    when (...) {
      ... -> break
    }
)
```
That `break` condition is `when` expression, and while visiting its
branch result, we will see the same `break` again.
2021-04-01 20:07:52 +03:00
Jinseong Jeon
b4a5eec5f4 Raw FIR: correct loop target for break/continue in do-while loop condition
As shown in KT-44412 (or KT-45319 or KT-17728):
```
fun test5() {
    var i = 0
    Outer@while (true) {
        ++i
        var j = 0
        Inner@do {
            ++j
        } while (if (j >= 3) false else break) // break@Inner
        if (i == 3) break
    }
}
```

To properly set the loop target for `break` in do-while loop condition,
the loop target for that do-while loop should be ready before parsing
the loop condition.

Previously, Raw FIR loop building configures loop target after visiting
loop conditions. This commit splits the configuration and lets the
builders prepare the loop target for do-while loop only.
2021-04-01 20:07:50 +03:00
Jinseong Jeon
81999117dc FIR2IR: force return type of loop body block as Unit 2021-04-01 20:07:49 +03:00
Jinseong Jeon
7898d167f3 FIR2IR: wrap do-while loop in IrBlock
"so that variables declared in loop body are not visible outside of the
loop" (from commit d096f1d)
2021-04-01 20:07:47 +03:00
Ilya Kirillov
08670114c8 Remove old j2k tests 2021-04-01 18:27:20 +02:00
Ilya Kirillov
9eb6b785c6 FIR IDE: encapsulate isInsideAnalysisContext check into ReadActionConfinementValidityTokenFactory 2021-04-01 18:26:40 +02:00
Ilya Kirillov
0d12110112 FIR IDE: introduce ValidityToken for light classes
To make all light classes stuff available from EDT
2021-04-01 18:26:39 +02:00
Stanislav Erokhin
8ffb822c3c Add way to create the FirAnalysisSession with custom token
This way should be used only for old FE wrappers.
It is important that Fir session with custom token should be cached,
because otherwise session with incorrect validity token could be
returned from cache inside analyze call
2021-04-01 18:26:38 +02:00
Ilya Kirillov
29bebae37d FIR IDE: add validity check of analysis component that it is valid only in analysis context 2021-04-01 18:26:38 +02:00
Ilya Kirillov
bd38363077 FIR IDE: use IGNORE_FIR instead of FIR_COMPARISON in hl quick fix tests
To explicitly specify which test are failing
2021-04-01 18:24:17 +02:00
Ilya Kirillov
18ab9c7b25 Move HLApplicator from fir ide module to frontend-independent 2021-04-01 18:24:17 +02:00
Denis.Zharkov
5cbfb172a4 Ignore new FIR box test on android 2021-04-01 14:52:05 +03:00
sebastian.sellmair
3f3e51f36e CInteropCommonization: Filter out illegal dependencies
^KT-45832 Fixed
2021-04-01 10:30:23 +00:00
Ilya Kirillov
c775508f64 FIR IDE: cache function symbols in FirIdeBuiltinSymbolProvider 2021-04-01 11:31:43 +02:00
Ilya Kirillov
d5951bc97d FIR IDE: use EntityWasGarbageCollectedException instead of ISE in ReadOnlyWeakRef 2021-04-01 11:31:43 +02:00
Denis.Zharkov
d685e2aac7 FIR2IR: Fix inheritance case from built-in interface with default methods 2021-04-01 12:11:37 +03:00
Alexander Shabalin
e5ea7f5b4e Do not freeze enum in new MM 2021-04-01 08:41:08 +00:00
Ilmir Usmanov
786999bcfe Minor. Add regression tests
#KT-44143
2021-04-01 00:51:08 +03:00
Ilya Goncharov
03fed85447 [IR] Change copy method into shallowCopy in Native 2021-03-31 20:14:56 +03:00
Ilya Goncharov
368ac36204 [IR] Remove IrExpressionWithCopy and replace with shallowCopy method 2021-03-31 20:14:55 +03:00
Ilya Goncharov
084d824984 [IR] Use deepCopyWithSymbols in IrTypeOperatorCall 2021-03-31 20:14:54 +03:00
Ilya Goncharov
7046f9badd [IR] canHaveSideEffects more robust
By default copyable (IrExpressionWithCopy) declarations is considered as side-effects.

^KT-45655 fixed

[IR] isTrivial more robust

By default copyable (IrExpressionWithCopy) declarations is considered as trivials.

[IR] Use one source of truth for triviality of IrExpression
2021-03-31 20:14:53 +03:00
Ilya Goncharov
47f1a8a0bb [IR] Make IrTypeOperatorCall copyable
^KT-45655 fixed
2021-03-31 20:14:52 +03:00
Ivan Kylchik
2a5153f0fd Move visualizer black box tests generator to separate class 2021-03-31 19:46:23 +03:00
Ilya Gorbunov
94240f7b21 Stabilize unsigned types KT-45653
Deprecate specialized unsigned iterators for removal.

Fix compiler tests:
- drop unsignedLiteralsOn1_2 because apiVersion 1.2 is no longer supported
- drop experimental unsigned literals diagnostic test
2021-03-31 19:05:04 +03:00
Yahor Berdnikau
768c165a72 Fix Gradle 7 deprecation on adding associated compilation dependencies.
^KT-45787 Fixed
2021-03-31 18:23:53 +03:00
Nikolay Krasko
7f60cd81fe CodeConformanceTest for no Bintray except jcenter (KTI-528) 2021-03-31 17:38:59 +03:00
Nikolay Krasko
b48ede4a62 Drop scripts for uploading to plugin repository (KTI-528) 2021-03-31 17:38:58 +03:00
Nikolay Krasko
35ad28c372 Bintray dukat -> Space kotlin/kotlin-dependencies (KTI-528) 2021-03-31 17:38:56 +03:00
Nikolay Krasko
d10f4ad718 Drop Bintray from maven inspections tests (KTI-528) 2021-03-31 17:38:55 +03:00
Nikolay Krasko
03c0a81a33 Stop using Bintray in ignored test in MavenResolverTest (KTI-528) 2021-03-31 17:38:54 +03:00
Dmitry Petrov
9bf7f3af04 JVM_IR KT-45697 reference classes from sources before IR generation 2021-03-31 16:40:49 +03:00
Denis.Zharkov
7d211d0d9a Regenerate VisualizerBlackBoxTestGenerated 2021-03-31 15:57:03 +03:00
Denis.Zharkov
fa65081878 Revert "FIR2IR: minimize scope processing in fake override generation"
This reverts commit 9934cfbb00.

See the tests added: Subclass may have private same-name method that
should not be a reason to avoid generating fake overrides
2021-03-31 15:57:03 +03:00
Denis.Zharkov
55e5af1111 FIR: Add workaround for flatMap issue 2021-03-31 15:57:03 +03:00
Denis.Zharkov
4d3825a824 FIR: Serialize members originated from delegation 2021-03-31 15:57:03 +03:00
Denis.Zharkov
a130b110f1 FIR2IR: Fix incorrect conversion of adapted callable references with receiver 2021-03-31 15:57:02 +03:00
Denis.Zharkov
1f074326bf FIR: Fix Java scope in case of accessor with getter signature from supertype
^KT-45584 Fixed
2021-03-31 15:57:02 +03:00
Denis.Zharkov
24f35ef281 FIR: Minor. Extract FirDeclarationStatus.copy 2021-03-31 15:57:02 +03:00
Victor Petukhov
f80b98cd0e Assert that the separation of two annotations on function type during rendering it, is any whitespace-like symbol, not only whitespace itself
E.g. in quick doc mode (HTML), it may be line break

^KT-38747 Fixed
2021-03-31 11:37:16 +03:00
Ilmir Usmanov
cf73f182c7 Minor. Change warning message 2021-03-31 09:04:35 +03:00
Alexander Udalov
1f7cef6f13 Minor, add a bit more tests for KT-12063 2021-03-31 00:08:52 +02:00
pyos
66429cfb43 JVM_IR: do not inline @JvmStatic into their static proxies 2021-03-31 00:08:40 +02:00
pyos
a518a9407d JVM_IR: remap calls to protected @JvmStatic in companions
Protected functions on unrelated classes cannot be called from outside
the current package, so in general, we can only call the static proxy,
not the original companion method.

This has an ABI compatibility implication in that removing `@JvmStatic`
from a protected companion method will require recompiling Kotlin use
sites (of course, this is already source- and binary-incompatible from
Java perspective).

 #KT-12063 Fixed
2021-03-31 00:08:40 +02:00
pyos
85aa6383ad JVM_IR: cast bound property receivers to original type
Because the receiver type is used for determining where to put
accessors, and the type of fake overrides' receivers is the same as for
the original declaration, casting to the type of the parameter leads to
assertion errors.

 #KT-44658 Fixed
2021-03-30 23:09:28 +02:00
Svyatoslav Scherbina
1d96f810da Native: fix target for ReturnsRetained and ConsumesReceiver annotations
These annotations can be used on Objective-C property accessors imported
to Kotlin.
Note: the annotations aren't used in source code, only generated
directly to metadata by cinterop. So this commit doesn't in fact fix
anything but rather makes the implementation less fragile.

See https://github.com/JetBrains/kotlin-native/issues/3336.
2021-03-30 20:23:59 +00:00
Svyatoslav Scherbina
107129679e Native: fix interop_objc_tests after recent frontend change
b60056f11e raises a warning to an error,
fixing this error here.
2021-03-30 15:32:46 +00:00
Mikhail Glukhikh
bf2e83f64c Make same tests FIR_IDENTICAL 2021-03-30 18:06:06 +03:00
Shagen Ogandzhanian
e0e2715864 [js] Fix constant folding for unsigned aithmetic in IR
this resolves KT-44138
2021-03-30 16:53:12 +02:00
Pavel Kirpichenkov
36bc71121a [IDE] Optimize stdlib cache for non-JVM modules
Consider only dependencies of JVM modules.
Cache found/missing stdlib dependencies for modules.

As of now, non-JVM platforms use default builtins in IDE.
For any non-JVM module indexed stdlib dependency is guaranteed
to be missing, searching for it is useless and costly.

^KTIJ-5666 Fixed
See also KT-44552
2021-03-30 17:28:08 +03:00
pyos
6c11751c55 FIR: infer non-error types for unnamed annotation arguments 2021-03-30 16:20:01 +03:00
Vyacheslav Gerasimov
f2a892a972 Cleanup 201 and as41 bunch files 2021-03-30 14:23:43 +03:00
Mikhail Zarechenskiy
943f03e55f Fix add import quick fix for delegated property and missing extension
^KT-39199 Fixed
2021-03-30 13:58:41 +03:00
Mikhail Glukhikh
f453649d0b FIR: report NO_TYPE_ARGUMENTS_ON_RHS properly 2021-03-30 12:52:13 +03:00
Ilmir Usmanov
5617d83c6b Remove coroutinesPackage from tests, since it is kotlin.coroutines
anyway.
Simplify createTextForHelpers: remove experimental coroutines version.
2021-03-30 12:41:40 +03:00
Nikolay Krasko
c868116535 Drop Bintray from wizards (KTI-528) 2021-03-30 12:34:08 +03:00
Nikolay Krasko
c74a3bd2b1 Move testResolveDependencyOnMppInCustomConfiguration to library from maven central (KTI-528) 2021-03-30 12:34:07 +03:00
Nikolay Krasko
1547d4f516 Drop bintray from Gradle inspections and fixes tests (KTI-528) 2021-03-30 12:34:06 +03:00
Nikolay Krasko
7a9c2c1d17 Drop bootstrap mentioning from CodeConformanceTest 2021-03-30 12:34:05 +03:00
Nikolay Krasko
529fc352b3 Drop custom private Bintray Android Studio repository (KTI-528) 2021-03-30 12:34:04 +03:00
Nikolay Krasko
5631481747 Drop bintray kotlin-dev (KTI-528) 2021-03-30 12:34:03 +03:00
Nikolay Krasko
1cedc7e93e Drop bintray jetbrains markdown (KTI-528) 2021-03-30 12:34:02 +03:00
Nikolay Krasko
832523e23f Replace intellij-third-party-dependencies repository (KTI-528) 2021-03-30 12:34:01 +03:00
Nikolay Krasko
87d509a7aa Rearrange list of repositories - move jcenter to the end 2021-03-30 12:34:00 +03:00
Nikolay Krasko
818855d6f0 Update cache redirector for more complex aliases
For example:
"https://packages.jetbrains.team/maven/p/ij/intellij-dependencies" to "https://cache-redirector.jetbrains.com/intellij-dependencies",
2021-03-30 12:33:59 +03:00
Alexander Udalov
6e86df2f6d Workaround illegal access to JDK internals in DynamicBundle
This is basically a manual cherry-pick of
https://github.com/JetBrains/intellij-community/commit/547caebd980d.

 #KT-44624 Fixed
2021-03-30 11:33:07 +02:00
Alexander Udalov
8e1a70cff6 Copy com.intellij.DynamicBundle to compiler/cli
This is needed to fix KT-44264 without updating the whole project to
intellij 203, which might take significant time.

In this commit, the file is copied as is from
27837dd8e6/platform/core-api/src/com/intellij/DynamicBundle.java.
2021-03-30 11:33:07 +02:00
Dmitriy Novozhilov
d0a148074f [FIR2IR] Fix generating body for for-loop 2021-03-30 12:28:15 +03:00
Victor Petukhov
5d78b0a962 Report resolution ambiguity on '+=' by taking into account full resolution result including post type checking for '+'
^KT-45503 Fixed
2021-03-30 12:12:56 +03:00
Mark Punzalan
1da35029a6 Restore UNUSED_* diagnostics to relevant tests. 2021-03-30 09:57:56 +03:00
Pavel Punegov
303d5ece96 Use iPhone 11 as a default target for ios simulator tests.
iPhone 12 isn't available on the xcode 12 without updates.
2021-03-30 06:47:01 +00:00
Ting-Yuan Huang
17ba350868 AnalysisHandlerExtensionTest: set output dir for JVM 2021-03-29 20:41:09 +03:00
Ting-Yuan Huang
0dee48781c Tests for AnalysisHandlerExtension
Add two common use cases of AnalysisHandlerExtension:
1. repeated analysis with new source roots.
2. frontend only mode
2021-03-29 20:41:08 +03:00
Ting-Yuan Huang
dba127a4d8 Add AnalysisHandlerExtension extension point for K2Native
frontendPhase is moved out of back phases to allow frontend only mode.

AnalysisHandlerExtension allows compiler plugins to:
1. Intercept and override the default analysis.
2. Utilize the compiler infrastructure to do custom analysis.

A well know plugin on the JVM platform is KAPT.
2021-03-29 20:41:06 +03:00
Ting-Yuan Huang
8e7b561b10 Add AnalysisHandlerExtension extension point for K2JsCompiler
AnalysisHandlerExtension allows compiler plugins to:
1. Intercept and override the default analysis.
2. Utilize the compiler infrastructure to do custom analysis.

A well know plugin on the JVM platform is KAPT.
2021-03-29 20:41:05 +03:00
Ting-Yuan Huang
4db79285c1 Add AnalysisHandlerExtension extension point for K2MetadataCompiler
AnalysisHandlerExtension allows compiler plugins to:
1. Intercept and override the default analysis.
2. Utilize the compiler infrastructure to do custom analysis.

A well know plugin on the JVM platform is KAPT.
2021-03-29 20:41:03 +03:00
Ting-Yuan Huang
e0c28e27d2 Move AnalysisHandlerExtension out of frontend.java
A dummy AnalysisHandlerExtension that extends the new extension is kept
in frontend.java for backward compatbility.
2021-03-29 20:41:01 +03:00
Elena Lepilkina
510e38b791 [K/N][performance] Adopted performance service to work with new configurations and build numbers 2021-03-29 17:10:18 +00:00
Elena Lepilkina
d709df9d8d [K/N][performance] Removed analyzer dependencies and fixed running benchmarks 2021-03-29 17:10:18 +00:00
Ilya Goncharov
30a024d05d [JS IR] Add test with member with JsName and default argument
^KT-44796 fixed
2021-03-29 19:58:15 +03:00
Steven Schäfer
a7f8f0d903 JVM IR: Avoid IndexOutOfBounds exceptions in TypeOperatorLowering
The code didn't account for SYNTHETIC_OFFSETs (KT-45688) and could
throw on IR containing broken line numbers (KT-44910).
2021-03-29 19:44:11 +03:00
Ilya Goncharov
6567b0e8ad [Gradle, JS] Remove supporting source maps for IR until it exists
^KT-45754 fixed
2021-03-29 19:36:17 +03:00
Dmitry Petrov
466e7b60b0 JVM_IR fix receiver type for fake overrides 2021-03-29 19:04:42 +03:00
Ilya Muradyan
92b99b140e [Scripting] Fix Bintray-dependent test 2021-03-29 18:36:50 +03:00
Ilya Muradyan
d40ada5d07 [REPL] Fix syntax errors analysis and incompleteness detection 2021-03-29 18:36:49 +03:00
Ivan Kylchik
736efe0403 [VISUALIZER] Edit black box test to run visualizer on all modules 2021-03-29 18:11:24 +03:00
Ivan Kylchik
097b5a74fb [VISUALIZER] Rewrite black box runner using callback to TestRunner 2021-03-29 18:11:23 +03:00
Ivan Kylchik
dbf1f54c3f Add possibility to run callback lambda before dispose test project 2021-03-29 18:11:22 +03:00
Ivan Kylchik
0f70ec032d [VISUALIZER] Add new visualizer tests processing codegen box test data 2021-03-29 18:11:21 +03:00
Ivan Kylchik
427a1295c8 Allow to create sub folders for expected data file that did not exist 2021-03-29 18:11:21 +03:00
Ivan Kylchik
29920d729f [VISUALIZER] Remove unnecessary abstract property frontendFacade
Right frontend facade will be chosen by frontendKind
2021-03-29 18:11:20 +03:00
Ivan Kylchik
e19514f1dc [VISUALIZER] Render original symbols/descriptors in fir/psi 2021-03-29 18:11:19 +03:00
Ivan Kylchik
869585870d [VISUALIZER] Rewrite getSymbolId method
For now it is more clear that id means. It is a combination
of package name and class name with additional local path
2021-03-29 18:11:18 +03:00
Ivan Kylchik
6d08ef2f41 [VISUALIZER] Allow to render arrayOf call for fir 2021-03-29 18:11:17 +03:00
Ivan Kylchik
74c19807b8 [VISUALIZER] Replace get with getOrNull to avoid NullPointerException 2021-03-29 18:11:16 +03:00
Ivan Kylchik
f32f61a950 [VISUALIZER] Remove all usages of fir native renderer 2021-03-29 18:11:15 +03:00
Ivan Kylchik
30bd39aabf [FIR] Allow to render function type with custom cone type renderer 2021-03-29 18:11:14 +03:00
Ivan Kylchik
13d8b10be0 Extract some cone type utils properties to reuse them in visualizer 2021-03-29 18:11:13 +03:00
Victor Petukhov
bbf5c4412e Do subtyping between self types with captured type in special way 2021-03-29 16:30:58 +03:00
Victor Petukhov
7f2c5cde55 Propagate input type position across incorporation properly
^KT-45719 Fixed
2021-03-29 16:17:31 +03:00
Victor Petukhov
d06031ece3 Approximate types when only input types check is done. Otherwise given types are inconsistent with types obtained by ResultTypeResolver
^KT-45714 Fixed
2021-03-29 16:17:30 +03:00
Victor Petukhov
cc1cb463b2 Remove NonStrictOnlyInputTypesChecks LF and introduce opposite – StrictOnlyInputTypesChecks, set default as strict 2021-03-29 16:17:30 +03:00
Victor Petukhov
b60056f11e Turn only input type warning to error
^KT-45482 Fixed
2021-03-29 16:17:22 +03:00
Dmitriy Novozhilov
c73c73e85e [Test] Simplify DiagnosticsService 2021-03-29 16:12:29 +03:00
Dmitriy Novozhilov
cd890d5833 [Test] Disable UNUSED_* diagnostics in tests which are not belong to contolFlowAnalysis suite 2021-03-29 16:12:29 +03:00
Dmitriy Novozhilov
85949b387e [Test] Explicitly enable UNUSED_* diagnostics in tests which are not belong to contolFlowAnalysis suite 2021-03-29 16:12:28 +03:00
Dmitriy Novozhilov
a9ff030c73 [Test] Add ability to configure tests by negative test location regex 2021-03-29 16:12:27 +03:00
Matthew Gharrity
2cb9d1f287 KT-45676: fix backing field annotation resolve 2021-03-29 15:36:05 +03:00
Yahor Berdnikau
6a586fb731 Ensure Android SDK license files always have all license.
Sometime on CI it may happen that file already exists, but does not
contain all required licenses.
2021-03-29 13:59:05 +03:00
Ilya Kirillov
75bf5fdbfe FIR IDE: replace custom KtSymbolModality with compiler Modality 2021-03-29 12:22:20 +02:00
Tianyu Geng
253c389f4a FIR checker: fix failed test files after sync 2021-03-29 12:45:27 +03:00
Tianyu Geng
ae902e6fe5 FIR: fix source of callee reference in delegated constructor call
Previously the callee reference of a delegated constructor call is
always the same as the call itself. This violates the contract that no
two FIR elements can have identical sources.  In addition, this sets the
entire call expression as the source of the callee expression.

This change instead sets the proper constructor ref as the callee.

Also fixed EXPLICIT_DELEGATION_CALL_REQUIRED type. It should be an error
instead of a warning.
2021-03-29 12:45:27 +03:00
Tianyu Geng
fb14b03824 FIR checker: skip error named reference if receiver is unresolved
Currently, FIR reports errors caused by previous resolution failure. For
example with unresolved `a` and `b` in code `a.b`, both `a` and `b` are
highlighted. FE1.0 only highlights `a` since it's the root cause. This
change applies this heuristics when reporting FirDiagnostics.
2021-03-29 12:45:27 +03:00
Tianyu Geng
d6907222cd FIR: pass the qualified access source when reporting ErrorNamedReference
Currently if there is an error in a function call, FIR would report the
entire expression if this call is qualified, but *only* the name if it's
not qualified. For example, assume the following two calls are all
contains some errors.

```
a.foo(1,2,3)
^^^^^^^^^^^^
bar(1,2,3)
^^^
```

The entire call of `foo` is reported since it's qualified. But only the
reference `bar` is reported since it's not qualified. This limits the
usage of position strategies because the IDE does not allow position
strategies to go outside of the initially reported PSI element
(org.jetbrains.kotlin.idea.fir.highlighter.KotlinHighLevelDiagnosticHighlightingPass#addDiagnostic).

This change passes both the original error named reference and the
surrounding qualified access expression and defer the decision of which
to use to the reporting logic.

For unresolved reference and checks on `super` keyword, the position
strategy should not highlight the surrounding parentheses. Hence a new
position strategy `REFERENCED_NAME_BY_QUALIFIED` is added.

In addition, this change also has the following side effect

* some diagnostics are no longer reported when there is a syntax error
  since the higher level structure does not exist when there is a syntax
  error
2021-03-29 12:45:27 +03:00
Tianyu Geng
8805675539 FIR IDE: Enforce an order on subclasses of sealed class
Currently the order is non-determinstic, causing non-determinstic
behavior in the IDE diagnostics. This change enforces an alphabetic
order.
2021-03-29 12:45:27 +03:00
Tianyu Geng
c198c57e62 FIR checker: fix diagnostic parameter renderer
Some of the current renderer is fallbacking to `toString` and output the
fully qualified class name with hash code.
2021-03-29 12:45:27 +03:00
Tianyu Geng
f38c0cf348 FIR IDE: run FIR highlighting test on all test data
Similarly to FIR diagnostic tests. This commit enable all available test
data and check the reported error messages by FIR. This helps identify
some issues in formatting of FIR diagnostics.

The changes on the test file are mechanically generated. Failed tests
are disabled with `// IGNORE_FIR` and are re-enabled in the second
commit.
2021-03-29 12:45:27 +03:00
Dmitriy Novozhilov
6592407492 [Test] Fix jdk target for BB test 2021-03-29 12:42:54 +03:00
Dmitriy Novozhilov
051e2b0869 [FIR] Update diagnostic test forgotten in dd20dd98 2021-03-29 11:14:53 +03:00
Dmitriy Novozhilov
a9399535fb [FIR2IR] Change receiver of field of base class in derived class in property reference 2021-03-29 11:14:52 +03:00
Dmitriy Novozhilov
38ab37d7eb [FIR2IR] Properly handle callable references to static functions 2021-03-29 11:14:52 +03:00
Dmitriy Novozhilov
37db27da58 Add dependency on :compiler:visualizer to generate-all-tests module 2021-03-29 10:25:51 +03:00
Sergey Bogolepov
f1280a63d3 Remove -target-cpu flag from Mac targets
Because this option is unsupported in
bitcode embedding.
2021-03-29 12:17:12 +07:00
Mark Punzalan
dd20dd9806 Report WRONG_MODIFIER_TARGET on the modifier instead of the declaration
in ExternalFunChecker.

This allows RemoveModifierFix to provide a quickfix to remove it.
2021-03-27 22:27:36 +01:00
Nikolay Krasko
c680ee8525 Fix build of benchmarks module
Fix after 998a65d1cb
2021-03-27 17:33:25 +03:00
Tianyu Geng
0d9991ebcd FIR IDE: allow HLDiagnosticFixFactory creating any intention
It seems unnecessary to force all quickfixes to fit the `HLQuickfix`
API, especially for those existing trivial fixes that simply modifies
PSI tree. This change further loosen the API of `HLDiagnosticFixFactory`
to allow it to create arbitrary `IntentionAction` objects. This also
avoids code duplication (for example, specify the family name again in
`ReplaceCallFixFactories`).

`HLQuickfix` and the input/target paradighm can still be used where
applicable.
2021-03-27 13:44:41 +01:00
Tianyu Geng
5609645156 FIR IDE: tweak nullability of applyTo
It looks like `project` can never be null
2021-03-27 13:44:41 +01:00
Tianyu Geng
f795a9c4ff FIR IDE: remove type parameter DIAGNOSTIC_PSI
This information is already determined by `DIAGNOSTIC` so there is no
need to repeat it.
2021-03-27 13:44:41 +01:00
Tianyu Geng
6c52d95342 FIR IDE: remove type parameter TARGET_PSI and INPUT
The factory does not need to care about what target PSI and input a
quick fix should need. We only need to ensure these two types match when
an `HLQuickfix` is created. With this constraint loosened, now one
factory can register multiple quickfixes applied on different targets
and different input. This makes it much more flexible when implementing
quickfixes.
2021-03-27 13:44:41 +01:00
Nikolay Krasko
a5e445492f Move Bintray js-externals to Space (KTI-528) 2021-03-26 21:08:46 +03:00
Nikolay Krasko
b903f87704 Drop kotin/kotlinx and kotlin/kotlinx.html bintray usages (KTI-528) 2021-03-26 21:08:45 +03:00
Nikolay Krasko
998a65d1cb Bump version of kotlinx.benchmark plugin 0.2.0-dev-7 -> 0.3.0 (KTI-528) 2021-03-26 21:08:43 +03:00
Nikolay Krasko
455773299b Minor: investigate j2objc-annotations:1.1 verification trace 2021-03-26 21:08:41 +03:00
Alexander Udalov
c17b6c59f8 JVM IR: add isInlineClassType, use it instead of isInlined 2021-03-26 18:57:01 +01:00
Alexander Shabalin
770401801b Implement freezing in the new MM
Currently, it uses suboptimal storage for the freeze bit. This'll be revised later when we finalize stack objects handling in the new MM.
2021-03-26 15:00:14 +00:00
Mikhail Glukhikh
295858cf5c Rename FIR diagnostic to METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE 2021-03-26 17:06:00 +03:00
Mikhail Glukhikh
7d4b8587a3 Unite checks around supertypes in FirPrimaryConstructorSuperTypeChecker 2021-03-26 17:05:58 +03:00
Mikhail Glukhikh
221b6bd184 Drop usages of FirErrors.TYPE_PARAMETER_AS_SUPERTYPE 2021-03-26 17:05:57 +03:00
Aleksei.Cherepanov
c74f471a82 Fix performance problem in KotlinTargetsIndex creation
Creation of KotlinTargetsIndex takes too long,
even if Java project doesn't have any Kotlin files.
Remove function hasJsStdLib, as it takes too much time
because of recursively checking all dependencies (migrate to facets)
Also fix tests: Add Kotlin JS facet, where its needed

#KT-34351 Fixed
2021-03-26 15:46:56 +03:00
Jinseong Jeon
bfc7eb7bab FIR checker: fix REFERENCE_BY_QUALIFIED positioning strategy to consider callable reference 2021-03-26 15:19:10 +03:00
Jinseong Jeon
8d8ed4cc18 FIR checker: check if callable reference targets are allowed members 2021-03-26 15:19:10 +03:00
Tianyu Geng
6769ce0e2b FIR checker: check TOPLEVEL_TYPEALIASES_ONLY 2021-03-26 15:19:10 +03:00
Tianyu Geng
6ca005cd70 FIR IDE: fix IDE exception in presence of non-top-level type alias
Finding type alias doesn't work if it's not top level because the class
ID doesn't match. There doesn't seem to be a easy way to make it work
so this commit simply makes the IDE tolerate it.
2021-03-26 15:19:09 +03:00
Ivan Gavrilovic
19708cfa87 KAPT: Avoid evaluating apOptions from AGP too early
This is causing issues such as https://issuetracker.google.com/183423660.
Annotation processor options that are provided by the Android Gradle plugin
may contain references to files and file collections that are safe to
evaluate only at execution time. This change avoids eagerly creating
compiler plugin options for these options, as they are already a task input.

Test: AbstractKotlinAndroidGradleTests.testAgpNestedArgsNotEvaluatedDuringConfiguration

^KT-39715 In Progress
2021-03-26 15:14:35 +03:00
Ilya Kirillov
1123f97a15 FIR: ensure declaration is resolved to types in FirStandardOverrideChecker 2021-03-26 12:54:28 +01:00
Anton Yalyshev
f7829d0bea Add change-notes for 1.5-M2 release 2021-03-26 14:08:58 +03:00
sebastian.sellmair
e232a2be6c CommonizeLibcurlTest: Provide necessary native distribution dependencies 2021-03-26 10:55:25 +00:00
sebastian.sellmair
2b7866402d [Commonizer] Move KonanDistribution to :native:kotlin-klib-commonizer-api 2021-03-26 10:55:24 +00:00
sebastian.sellmair
6e3b1fd919 [Commonizer] RootMerger: Change priorities for typeResolver
This will prioritize classifiers from the following sources
in the provided order

1) Classifiers from the target's modulesProvider
2) Classifiers from the traget's direct dependencies
3) Classifiers from the more common dependencies
2021-03-26 10:55:24 +00:00
sebastian.sellmair
914ce22f6b [Minor] CommonizerIT: Optimize imports 2021-03-26 10:55:23 +00:00
sebastian.sellmair
a0557ad937 CommonizerIT: Implement test commonizeInterop using posix APIs
^KT-45497
2021-03-26 10:55:22 +00:00
sebastian.sellmair
7f9fe6b332 [Commonizer] CInteropCommonizerTask: Provide custom/commonized native distribution dependencies
^KT-45497 Fixed
2021-03-26 10:55:22 +00:00
sebastian.sellmair
e44877f562 [Commonizer] LibraryCommonizer: Allow passing dependencies for a shared target 2021-03-26 10:55:21 +00:00
sebastian.sellmair
096e715652 [Commonizer] Split CirTreeMerger into composable 'Mergers' 2021-03-26 10:55:21 +00:00
Ilya Chernikov
2f49e8e0af Fix parameter index on IR script generation in REPL scenario
Before it, the wrong index lead to the validation error when repl
script definition had c-tor parameters (see test)
2021-03-26 11:41:24 +01:00
Mikhail Glukhikh
648bf99842 FIR: temporarily drop parent manipulation code around super type entries 2021-03-26 13:05:42 +03:00
Jinseong Jeon
ff4d193891 FIR checker: utilize unsubstitutedScope creation 2021-03-26 13:05:41 +03:00
Jinseong Jeon
9934cfbb00 FIR2IR: minimize scope processing in fake override generation 2021-03-26 13:05:41 +03:00
Jinseong Jeon
c830aed946 FIR2IR: minimize scope processing in data class synthetic member generation 2021-03-26 13:05:41 +03:00
Ilya Matveev
22d6433cf6 [K/N][Gradle plugin] Do not propagate user.dir property to tools
In a Gradle process, the user.dir property is set to the directory
where the build was started. By default, if we start a child process
via project.javaexec, Gradle sets its working directory to the
directory of the current project. But passing Gradle's value of user.dir
to that process overrides this setting.

This makes tools started in a such way sensitive to directory the build
is started from.

This patch fixes this issue for K/N-related tools started
out-of-process by the MPP Gradle plugin. But this issue is still
relevant to in-process tool execution.
2021-03-26 12:38:28 +03:00
Ilya Matveev
e56ac775ca [K/N][tests] Do not propagate user.dir property to compiler/cinterop
In a Gradle process, the user.dir property is set to the directory
where the build was started. By default, if we start a child process
via project.javaexec, Gradle sets its working directory to the
directory of the current project. But passing Gradle's value of user.dir
to that process overrides this setting.

This makes tools started in a such way sensitive to directory the build
is started from. Thus a test using relative paths may fail if it is
started from a wrong directory.

This patch fixes this issue for Kotlin/Native tests.
2021-03-26 12:38:27 +03:00
Victor Petukhov
9c38db754e Add compiler flag to enable strict mode for improvements in the type enhancement
^KT-45674 Fixed
2021-03-26 11:04:01 +03:00
Victor Petukhov
731e3ebae1 Rename LV ImprovementsAroundTypeEnhancement into TypeEnhancementImprovementsInStrictMode 2021-03-26 11:03:49 +03:00
nataliya.valtman
df08ed2ac0 Recompile files which import companion constant
#KT-44741 Fixed
2021-03-26 10:27:52 +03:00
Ilya Kirillov
5485c372e8 FIR IDE: stop on fist exception in project perf tests 2021-03-25 20:53:53 +01:00
Ilya Kirillov
211ddd307c FIR IDE: highlight file before completion in perf test 2021-03-25 20:53:52 +01:00
Ilya Kirillov
49a4ec7f92 FIR IDE: add perf tests for completion 2021-03-25 20:53:51 +01:00
Ilya Kirillov
a4cf21adef Add perf the same project perf tests used for FIR for fe10 plugin 2021-03-25 20:53:50 +01:00
Roman Golyshev
a22a6b4338 FIR IDE: add basic project performance test 2021-03-25 20:53:49 +01:00
Ilya Kirillov
baad0d698f FIR IDE: do not create KtFunctionalType by type-aliased functional type 2021-03-25 20:53:29 +01:00
Nikolay Krasko
ddc12834cb Add dependency verification description to ReadMe.md 2021-03-25 21:53:27 +03:00
Vladimir Dolzhenko
51393d2d0f Fix compilation 2021-03-25 16:23:01 +01:00
Ilmir Usmanov
5e6f52009f JVM IR: IC coroutines: return boxed type from suspend function if
the function overrides function, returning type argument
 #KT-45451 Fixed
2021-03-25 16:21:55 +01:00
Simon Ogorodnik
0aca68e7c7 FIR: Add init time measurement to full pipeline 2021-03-25 18:05:51 +03:00
Pavel Punegov
991e5210ba Simplify further support for simulators by using target family 2021-03-25 13:06:13 +00:00
Pavel Punegov
5acd72d5a5 Update simulators: use fresh targets 2021-03-25 13:06:13 +00:00
Pavel Punegov
39b11f6ef0 Create simulator device in case it is missing on the host 2021-03-25 13:06:12 +00:00
sebastian.sellmair
ad7c8b7a07 KotlinToolingMetadata: Disable 'kotlin.mpp.enableKotlinToolingMetadataArtifact' by default 2021-03-25 15:16:08 +03:00
sebastian.sellmair
37aedba7ef KotlinToolingMetadata: Handle incompatible schemaVersions during json parsing 2021-03-25 15:16:07 +03:00
sebastian.sellmair
0406659ac8 BuildKotlinToolingMetadataTask: Strip _Decorated classes from target name 2021-03-25 15:16:06 +03:00
sebastian.sellmair
24ce6957a9 testProject/new-mpp-published: Replace jcenter with mavenCentral 2021-03-25 15:16:05 +03:00
sebastian.sellmair
0a732869e9 KotlinToolingMetadata: Add schemaVersion property 2021-03-25 15:16:04 +03:00
sebastian.sellmair
0119541462 KotlinToolingMetadata: Use Project property accessor for task 2021-03-25 15:16:03 +03:00
sebastian.sellmair
0a59301f8a KotlinToolingMetadata: Add stronger typing for target extras 2021-03-25 15:16:01 +03:00
sebastian.sellmair
896e77cd32 KotlinToolingMetadata.json: Add konanVersion and abiVersion as extras to KotlinNativeTarget 2021-03-25 15:16:00 +03:00
sebastian.sellmair
ac8b4c1b79 Implement kotlin-tooling-metadata.json artifact
- Introduce new :kotlin-tooling-metadata project
- Create new buildKotlinToolingMetadata task by default
- Add `kotlin-tooling-metadata.json` to root mpp publications
- Add kotlin.mpp.enableKotlinToolingMetadataArtifact flag to disable kotlin-tooling-metadata.json artifact

^KT-44584 Verification Pending
2021-03-25 15:15:58 +03:00
Vladimir Dolzhenko
88058ca2c8 Fix non-default constructors for service and extension class violation 2021-03-25 12:57:07 +01:00
Svyatoslav Scherbina
7b639235a2 Update Kotlin/Native: 1.5.20-dev-3553 2021-03-25 12:43:02 +03:00
Vladimir Dolzhenko
ae4dd80254 Regenerate missed test
Relates to #KT-45339
2021-03-25 10:19:24 +01:00
Ilya Chernikov
9ac6d30953 Fix arguments processing with scripting with old backend by default 2021-03-24 22:38:59 +01:00
Ilya Chernikov
bcd7bc5fd7 Fix arguments processing with scriting with old backend by default 2021-03-24 21:26:57 +01:00
Ilya Chernikov
c3ec94ff82 FIR: copied 2 more gradle incremental IT for FIR
temporary, we need a proper test infrastructure to run all gradle IT
with FIR
2021-03-24 21:24:20 +01:00
Ilya Chernikov
2d9c0e137f Add gradle ITs witn IC and FIR 2021-03-24 21:24:20 +01:00
Ilya Chernikov
a11f6d2e50 Add support for gradle option useFir and appropriate property...
`kotlin.useFir`
2021-03-24 21:24:20 +01:00
Ilya Chernikov
3400911d97 [minor] unmute fixed FIR tests 2021-03-24 21:24:20 +01:00
Ilya Chernikov
4a79f544f7 FIR: Mute IC test due to java tracking peculiarities
should be fixed after implementing proper java tracking for FIR
2021-03-24 21:24:20 +01:00
Ilya Chernikov
7e08820009 FIR: Mute IC tests with missing FIR diagnostics 2021-03-24 21:24:20 +01:00
Ilya Chernikov
14121a1d9a FIR: Disable java tracking in FIR IC
until it is properly implemented,
fixes some IC tests for now, making it less pecise
2021-03-24 21:24:19 +01:00
Ilya Chernikov
20fdad87ec FIR: support direct use of typealias with friend-paths
also fixes one IC test
2021-03-24 21:24:19 +01:00
Ilya Chernikov
ef2bb48706 FIR: fix fir-specific incremental compilation testdata 2021-03-24 21:24:19 +01:00
Ilya Chernikov
51a1cec08b FIR: Reimplement conflicts checker to detect conflicts in different files
also pass correct ScopeSession to checkers
fixes some IC tests
2021-03-24 21:24:19 +01:00
Ilya Chernikov
3e458a1efb FIR: Add IncrementalPackagePartsProvider usage in cli...
also refactor IncrementalPackagePartsProvider and parents to simplify
usage
2021-03-24 21:24:18 +01:00
Ilya Chernikov
f8d50d585d FIR: Implement lookup tracking 2021-03-24 21:24:18 +01:00
Ilya Chernikov
7d29ae7cce FIR: add incremental compilation tests 2021-03-24 21:24:18 +01:00
Ilya Chernikov
6cc39788fd FIR: Fix main fn mangling (without proper detection)
proper main function detector has to be implemented in addition
to that
2021-03-24 21:24:18 +01:00
Ilya Chernikov
88e7ba2a3b FIR: Report syntax errors in cli compilation 2021-03-24 21:24:18 +01:00
Ilya Chernikov
ed78183dbd FIR: use more specific cone error for unresolved user type ref
replaces diagnostic with <No name> with specific qualifier
2021-03-24 21:24:18 +01:00
Ivan Kylchik
77539fe2db Add visitExpressionBody method to IrCompileTimeChecker
This method is needed to explicitly indicate that IrExpressionBody can
be interpreted in any evaluation mode.
2021-03-24 21:24:17 +01:00
Ilya Chernikov
e0297cf207 [minor] implement automatic stdlib-jdkX jars handling in KotlinPaths
fixes some local testing scenarios
2021-03-24 21:24:17 +01:00
Ilya Chernikov
76b2ca2e96 [minor] FIR: add missing error message 2021-03-24 21:24:17 +01:00
Alexander Udalov
81a8566763 Fix verification-metadata.xml after updating r8 to 2.1.96 2021-03-24 20:16:16 +01:00
Mads Ager
41f5ac393a Update D8 used for dexing tests to version 2.1.96. 2021-03-24 20:16:15 +01:00
Yahor Berdnikau
48599e3768 Bump advance Gradle version in tests to '7.0-rc-1'.
- Add missing dependency on ':kotlin-serialization' required
 by some tests.
- Add additional location for libcurl on Linux machines.
2021-03-24 21:14:48 +03:00
Ilya Kirillov
6e31ff4fb1 Introduce CallableId.asSingleFqName and use it instead CallableId.asFqNameForDebugInfo 2021-03-24 18:13:21 +01:00
Ilya Kirillov
6f887896ff FIR IDE: use CallableId for KtCallableSymbol instead of FqName 2021-03-24 18:13:04 +01:00
Ilya Kirillov
f66a155683 FIR IDE: use common spelling for analyse functions family 2021-03-24 18:12:25 +01:00
Igor Chevdar
a618791ff0 [K/N][IR] Removed unnecessary hack
The hack has been rendered redundant due to the recent fixes in psi2ir
2021-03-24 20:42:40 +05:00
Igor Chevdar
246a907753 [FE][PSI2IR] Generalized SamType
Operations regarding <fun interface> are common for all backends
2021-03-24 20:42:40 +05:00
Tianyu Geng
56bec6997c FIR checker: report SUPERTYPE_NOT_INITIALIZED
Combined this and the checker of
SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR together.

Also fixed SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR incorrectly
repoted as warning instead of error.
2021-03-24 17:48:39 +03:00
Tianyu Geng
6134c00698 FIR: track KtSuperTypeCallEntry in FirDelegatedConstructorCall
In PSI world, a call to super type constructor is represented by a
KtSuperTypeCallEntry. Currently FIR tracks the callee reference to this
constructor call.

This is undesirable because

1. We may want to report issues on the call arguments, so FIR must track
   the entire call rather than just the callee reference

2. Light tree actually reports the KtSuperTypeCallEntry.

3. Both the FirDelegatedConstructorCall and its `calleeReference` are
   currently referencing the same KtConstructorCalleeExpression PSI
   element as the source.

This change makes FirDelegatedConstructorCall track the entire
KtSuperTypeCallEntry as the source, if possible.
2021-03-24 17:48:39 +03:00
Sergey Bogolepov
5243720043 Add support for android and wasm on macos_arm64 2021-03-24 17:37:51 +03:00
Sergey Bogolepov
3a008f6236 Cleanup ClangArgs.kt a little bit 2021-03-24 17:37:50 +03:00
Sergey Bogolepov
273b43d227 Simplify setting apple os version in ClangArgs
Use `osVersionMinFlagClang` from konan.properties
instead of manual setup in ClangArgs.
This simplification will make it easier to add support
for future targets.
2021-03-24 17:37:49 +03:00
Sergey Bogolepov
51d3d1f1a8 ClangArgs: Set stdlib for apple targets in a single place 2021-03-24 17:37:48 +03:00
Sergey Bogolepov
f339e9cc66 ClangArgs: Set arch for apple targets in a single place 2021-03-24 17:37:47 +03:00
Sergey Bogolepov
30863cd184 Support the rest of Linux targets on macos_arm64 2021-03-24 17:37:45 +03:00
Sergey Bogolepov
0e1276fc6c Support the rest of Apple targets on macos_arm64 2021-03-24 17:37:44 +03:00
Sergey Bogolepov
58e0cc1c7c Specify linker for macos_arm64-linux_x64 2021-03-24 17:37:42 +03:00
Sergey Bogolepov
579c1eb7db Remove libffi from target dependencies
Technically, it is a dependency of a compiler itself.
Thus, we can simplify konan.properties a little bit
by applying the same approach as we did for LLVM.
2021-03-24 17:37:40 +03:00
Tianyu Geng
e1c80ac75c FIR checker: introduce NO_(GET|SET)_METHOD
Besides introducing new diagnostics, this commit unifies source usages
for array accesses in PSI & LT.
2021-03-24 16:25:01 +03:00
pyos
651fd4ad9f FIR: load Java annotation defaults after binding the class symbol
as they can refer to the class itself.
2021-03-24 16:09:25 +03:00
Mikhail Glukhikh
449a79151a FirNotImplementedOverrideChecker: check also anonymous objects / enums 2021-03-24 16:07:30 +03:00
Mikhail Glukhikh
82b8cc333e FIR: introduce INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER 2021-03-24 16:07:28 +03:00
Mikhail Glukhikh
47d2a914bc FIR: add bad test data changes related to not implemented checker 2021-03-24 16:07:26 +03:00
Mikhail Glukhikh
9ce8420491 FIR: introduce not implemented checker 2021-03-24 16:07:25 +03:00
Mikhail Glukhikh
9ae41f5c07 FIR: store substitution for properties with implicit return type 2021-03-24 16:07:21 +03:00
Mikhail Glukhikh
4768700600 FIR error repro: property type mismatch in override from light classes 2021-03-24 16:07:20 +03:00
Mikhail Glukhikh
b6f1a442fb FIR checkers: use ScopeSession from resolve when possible 2021-03-24 16:07:19 +03:00
Mikhail Glukhikh
a26a195c35 Add FIR_IDENTICAL to some tests 2021-03-24 16:02:09 +03:00
Jinseong Jeon
c6298398ef FIR checker: rework VAL_REASSIGNMENT_VIA_BACKING_FIELD(_ERROR) 2021-03-24 16:02:08 +03:00
Victor Petukhov
4f1ed2f112 Don't generate tests on top-down completion of the builder inference for WASM 2021-03-24 15:57:48 +03:00
Victor Petukhov
178910a2e5 Proper taking top level trace to pass it into completion 2021-03-24 15:57:47 +03:00
Victor Petukhov
e0a8e9a664 Do updating calls for all nested builder inference sessions including at the same level 2021-03-24 15:57:47 +03:00
Victor Petukhov
999d1f982e Introduce hierarchy of inference sessions 2021-03-24 15:57:47 +03:00
Victor Petukhov
80ac62864d Don't lose inference session in all the possible locations 2021-03-24 15:57:47 +03:00
Victor Petukhov
b5d3f9ee31 Rename CoroutineInferenceSession to BuilderInferenceSession 2021-03-24 15:57:46 +03:00
Victor Petukhov
7a66e22bb2 Implement top-down completion for nested builder inference calls
^KT-42742 Fixed
2021-03-24 15:57:36 +03:00
Vladimir Dolzhenko
8068a5439f Fix handling non ctor elements in SECONDARY_CONSTRUCTOR_DELEGATION_CALL
#KT-45339 Fixed
2021-03-24 12:27:53 +00:00
Vladimir Dolzhenko
3d236b7171 Simplify reportOnElement
Relates to #KT-38959
2021-03-24 12:27:52 +00:00
Ilya Goncharov
b385650bf0 [Gradle, JS] Use patch only for webpack 5
^KT-45621 fixed
2021-03-24 15:17:12 +03:00
Ilya Goncharov
4107378d2c [Gradle, JS] Add workaround for debugging with webpack 5
^KT-45621 fixed
2021-03-24 15:17:11 +03:00
Ilya Goncharov
fef1892219 [Gradle, JS] Changed API for warnings filter in Webpack 5
^KT-45621 fixed
2021-03-24 15:17:10 +03:00
Ilya Goncharov
a113df8c43 [Gradle, JS] Use karma 6.0 API to set ping timeout
^KT-45621 fixed
2021-03-24 15:17:09 +03:00
Ilya Goncharov
f318951b64 [Gradle, JS] Fix packages with hardcoded display name
^KT-45621 fixed
2021-03-24 15:17:07 +03:00
Dmitriy Novozhilov
fae0aa42c4 [FIR] Update testdata broken in de03124f 2021-03-24 14:11:11 +03:00
Svyatoslav Scherbina
940774caaf Native: remove README.md from binary distributions
It is outdated, and the presumed contents are covered by other docs.
2021-03-24 10:56:35 +00:00
Ilya Muradyan
14d386223b [REPL] Fix unresolved imports caching
Before this fix, if some imports were not resolved during compilation,
this result had been saved in caches, and this import couldn't been
resolved during following compilations even if it was added to the
module dependencies. This commit adds special handling of resolution
caches for the REPL compiler.
2021-03-24 13:35:33 +03:00
Ilya Muradyan
ae5fefce51 [REPL] Fix performance problem
Configuration updating was done incorrectly,
and it led to performance degradation.
2021-03-24 13:35:33 +03:00
Dmitriy Novozhilov
e00e726bcb [FIR] Add test for KT-45584 2021-03-24 12:56:17 +03:00
Dmitriy Novozhilov
f4afc2ef44 [FIR] Map dispatch receiver type of function in JvmMappedScope 2021-03-24 12:56:16 +03:00
Dmitriy Novozhilov
b0969f626e [FIR] Rename SyntheticPropertySymbol to FirSyntheticPropertySymbol 2021-03-24 12:56:15 +03:00
Dmitriy Novozhilov
714871e4a5 [FIR2IR] Add proper toString to Fir2IrBindableSymbol 2021-03-24 12:56:15 +03:00
Dmitriy Novozhilov
7dc3be3b9b [FIR2IR] Replace star projections with upper bounds for SAM conversion types 2021-03-24 12:56:15 +03:00
Dmitriy Novozhilov
50f2666eba [IR] Properly render type arguments in error messages 2021-03-24 12:56:14 +03:00
Dmitriy Novozhilov
ee7c90791e Add workaround for KT-45553
This is needed to compile this code with FIR
2021-03-24 12:56:14 +03:00
Dmitriy Novozhilov
de03124f50 [FIR] Fix reporting EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR warning 2021-03-24 12:56:14 +03:00
Dmitriy Novozhilov
21b1d97b30 Add predefined run configuration for FIR tree generation 2021-03-24 12:56:13 +03:00
Dmitriy Novozhilov
3b6d3e5a08 [FIR] Don't record isFromVararg attribute to all properties from constructor 2021-03-24 12:56:13 +03:00
Dmitriy Novozhilov
094287741c [FIR] Add FirSourceElement.text extension for debug purposes 2021-03-24 12:56:13 +03:00
Dmitriy Dolovov
9aa16faa27 Test integer overflow on div/rem of Int.MIN_VALUE by -1
^KT-45136
2021-03-24 09:55:52 +03:00
Dmitriy Dolovov
dfd3b54ee4 Native: Handle integer overflow on div/rem of Int.MIN_VALUE by -1
^KT-45136
2021-03-24 09:55:46 +03:00
Vyacheslav Gerasimov
7fe0df2816 Build: Drop include/* project previously used in composite build 2021-03-23 22:52:40 +03:00
Dmitry Petrov
4f250ed498 JVM_IR KT-45377 rewrite constants again after AddContinuationLowering 2021-03-23 16:05:24 +03:00
Ilya Kirillov
0f2aca3280 FIR: use session symbolProvider from symbol for getting it's file 2021-03-23 13:41:03 +01:00
Yahor Berdnikau
d46ad6c0ad Fix kapt creates output directories on configuration phase.
Gradle will create such directories itself. Also it should fix build
cache issue with kapt tasks - build cache was disabled
 due to the 'overlapping outputs'.

 ^KT-45532 Fixed
2021-03-23 15:20:35 +03:00
Ilmir Usmanov
5abc45e6ff IC IDE: Add description of intention to add @JvmInline to value class
#KTIJ-5663
2021-03-23 12:13:05 +01:00
Ilmir Usmanov
823d2d0748 IC IDE: Add intention to add @JvmInline annotation to value class on JVM
#KTIJ-5663 Fixed
2021-03-23 12:13:03 +01:00
Alexander Udalov
ea01c97a8e Write underlying property name & type for inline class to metadata
This will be used in the compiler starting from 1.5.20 instead of the
currently used approach of looking for the single value parameter of the
primary constructor. The problem with the current approach is that
primary constructor can be private (since 1.4.30) and the property could
always be private. Relying on private declarations from metadata is
dangerous; for example lazy IR doesn't usually create stubs for private
declarations, and it didn't create stubs for private inline class
constructors before b5f9b1df, which led to the problem reported in
KT-44723.
2021-03-23 11:45:22 +01:00
Mark Punzalan
5baa2e0e7c FIR IDE: Simplify the diagnosticFixFactory() API by removing
HLApplicatorWithTargetAndInput and making HLQuickFix public.
2021-03-23 11:04:33 +01:00
Mark Punzalan
062adf21de FIR IDE: Use KtFirExpressionTypeProvider.getExpectedType() in
ReplaceCallFix.
2021-03-23 11:04:33 +01:00
Mark Punzalan
e9298d1d71 FIR IDE: Allow FIR-specific "after" files for
AbstractHighLevelQuickFixTest.
2021-03-23 11:04:33 +01:00
Mark Punzalan
14ca2d207d FIR IDE: Additional support for
KtFirExpressionTypeProvider.getExpectedType():

- Infix function parameter
- Variable assignment
- Property declaration
- Function expression body
2021-03-23 11:04:33 +01:00
Mark Punzalan
164d7d80b6 FIR IDE: Enable ReplaceCallFix for UNSAFE_CALL. 2021-03-23 11:04:33 +01:00
Mark Punzalan
3ebdfa3850 FIR IDE: Implement applicatorByQuickFix() to re-use quick fix actions
from idea-frontend-independent.
2021-03-23 11:04:33 +01:00
Mark Punzalan
1b649fa4cb FIR IDE: Generate quickfix tests related to ReplaceCallFix. 2021-03-23 11:04:33 +01:00
Mark Punzalan
05deecaafa FIR IDE: Move ReplaceCallFix to idea-frontend-independent. 2021-03-23 11:04:33 +01:00
Andrei Klunnyi
482c677274 KT-44299 [Sealed Interfaces]: when exhaustiveness in IDE considers java inheritor
^KT-44299 fixed
2021-03-23 10:55:20 +01:00
hungvietnguyen
7c4225b9d1 [Kapt] Ensure flag names and default values are consistent
Group flag names and default values in one place to make the code easier
to read and prevent mistakes and inconsistencies.
2021-03-23 10:41:28 +03:00
Igor Chevdar
752be27557 [K/N][tests] Disabled failing test for now 2021-03-23 11:57:56 +05:00
Svyatoslav Scherbina
818659f2bb Native: fix bug in KType support affecting only stdlib
Don't use IrClass.declarations to find enum entries during lowerings,
because this enum might already be lowered and thus have all entries
removed.
2021-03-23 09:45:40 +03:00
Ilmir Usmanov
886e3e6655 Update tests, which check -X... flag in LauncherScriptTest
Previously, -Xallow-result-return-type was used to test, whether the
launcher parses -X... flags correctly, however, it has no effect -
returning Result is allowed anyway. So, instead, use -Xno-inline and
check runtime behavior.
2021-03-22 23:14:23 +00:00
Vyacheslav Karpukhin
499ffd610a AndroidDependencyResolver: codestyle fixes after review 2021-03-22 22:29:12 +01:00
Vyacheslav Karpukhin
ac8d135a21 AndroidDependencyResolver:
1. Correctly process project dependencies
2. Don't include variant-specific dependencies into more generic sourcesets
2021-03-22 22:29:12 +01:00
Vyacheslav Karpukhin
3ce00f6eb4 AndroidDependencyResolver: when operating without Android IDE plugin, don't duplicate dependencies for Android sourcesets 2021-03-22 22:29:12 +01:00
Alexander Udalov
b5f9b1dfc0 JVM IR: support inline classes with private constructors from other modules
#KT-44723 Fixed
2021-03-22 21:57:07 +01:00
Alexander Udalov
dac218dc39 Minor, regroup compileKotlinAgainstKotlin tests on inline classes 2021-03-22 21:57:04 +01:00
Ilmir Usmanov
3124a4ddae Minor. Update test data 2021-03-22 17:35:08 +01:00
Mads Ager
571971c5db JVM: Fix local variable ranges in state machine transform.
When a suspension point is inlined, the inlining local spans
unspilling code where the local slot has not been initialized.

The transformer already inserted initialization code for the local,
however, it did not split the local variable table. Therefore,
the inlining local is defined on instructions where the local
slot has no value (namely the instructions that initialize
the local slot on the unspilling path).

This change adds splitting of the local variable table as well.
When updating to a new version of D8, the uninitialized local
slot showed up. D8 will repair it in this case, but it is
better to not generate such code.
2021-03-22 17:35:06 +01:00
Aleksei.Cherepanov
911c24d594 Additional trust artifacts for JPS build 2021-03-22 19:08:36 +03:00
Svyatoslav Scherbina
0730833135 Remove kotlin-native/common/src/hash
It is no longer used.
2021-03-22 16:03:31 +00:00
Svyatoslav Scherbina
ce239ccc3e Native runtime: remove unused dependency on common/src/hash
No longer required after c8633d8bda.
2021-03-22 16:03:30 +00:00
Svyatoslav Scherbina
2a7ccb11e8 Native compiler: remove unused dependency on common/src/hash 2021-03-22 16:03:29 +00:00
Svyatoslav Scherbina
a471bbc185 Native compiler: remove unused hashing code
It was used to compute hashes for class names, but this is no longer
required after c6ac807034.
2021-03-22 16:03:28 +00:00
Svyatoslav Scherbina
39d748dbbb Native compiler: replace C++ CityHash64 impl by Kotlin one 2021-03-22 16:03:28 +00:00
Ilya Kirillov
32be3cc703 FIR IDE: do not require read action to collect diagnostics 2021-03-22 16:18:24 +01:00
Ilya Kirillov
58a5f4f90b FIR IDE: do not fail on building anonymous function symbol 2021-03-22 16:15:33 +01:00
Ilmir Usmanov
b838ba8c62 Check whether backend is IR instead of distinct ones 2021-03-22 15:08:59 +00:00
Ilmir Usmanov
9c97f1ce35 Allow Result return type and nullability operators on Result type
by default
2021-03-22 14:56:16 +00:00
Yahor Berdnikau
6473d2a7c8 Bump advanced Gradle version to 7.0-milestone-3.
Fixed test setup that causes test failures.

^KT-44949 In Progress
2021-03-22 17:02:27 +03:00
Ilya Kirillov
c38a793352 FIR IDE: replace custom KtSymbolVisibility with compiler common Visibility 2021-03-22 14:02:20 +01:00
Ilya Kirillov
3154234107 FIR IDE: do not run STATUS phase under lock 2021-03-22 14:02:20 +01:00
Ivan Gavrilovic
093c8bfbb6 Register KAPT incremental apt cache as local state
This is so that incremental caches are removed on
non-incremental task run.
2021-03-22 15:59:20 +03:00
Br0mm
75e4c74256 [FIR] Add FirConstValWithGetterOrDelegateChecker 2021-03-22 15:05:40 +03:00
Ilya Kirillov
93f711e2b8 FIR: extract initializing of containingClassAttr into fun 2021-03-22 12:30:59 +01:00
Ilya Kirillov
9f0af3faba FIR: fix containigClassAttr for property accessor without body in light tree builder 2021-03-22 12:30:58 +01:00
Ilya Kirillov
801d4a0c77 FIR: initialize containingClassAttr in light tree builder to match RawFirBuilder 2021-03-22 12:30:58 +01:00
Ilya Kirillov
dcf64779a9 FIR: add declaration attributes checking to rawFirBuilder/lightTree tests 2021-03-22 12:30:58 +01:00
Ilmir Usmanov
3bcc2fe476 Minor. Add IDE MPP test 2021-03-22 11:13:14 +00:00
Ilmir Usmanov
164e9034d1 IC MPP: Allow expect value classes without @JvmInline
#KT-45525 Fixed
2021-03-22 11:13:13 +00:00
Sergey Bogolepov
8ba4f060f0 Enable linuxX64 target on macOsArm64 host
Because tests for Gradle plugin assumes that linuxX64
is available on all hosts.
2021-03-22 14:02:43 +03:00
Sergey Bogolepov
7e18b69e7d Add initial support for macos_arm64 host 2021-03-22 14:02:41 +03:00
Sergey Bogolepov
4222fb9629 Remove unused filterGradleNativeSoftwareFlags method 2021-03-22 14:02:40 +03:00
Sergey Bogolepov
ec23ebd1c5 Fix workerAutoreleasePool test on macos_arm64 using __autoreleasing
Also merge `createAutorelease` and `create. There is no need in
such separation since it was originally added to prevent
optimization `result`'s lifetime.
Turned out, it was still happening on Apple Silicon,
and only addition of __autoreleasing attribute solves the problem.
2021-03-22 14:02:39 +03:00
Ilya Kirillov
4826e3278f FIR IDE: get rid of constructor value parameter symbols 2021-03-22 11:27:31 +01:00
Ilya Kirillov
7b482bf70a FIR IDE: merge symbol building tests and symbol restoring tests 2021-03-22 11:27:30 +01:00
Ilya Kirillov
1d63dccfae FIR IDE: fix symbol pointer creation for non direct member symbols 2021-03-22 11:27:29 +01:00
Ilya Kirillov
a7b0c6c821 FIR IDE: fix symbol pointer creation for KtAnonymousObjectSymbol 2021-03-22 11:27:28 +01:00
Ilya Kirillov
0bb37db4bf FIR IDE: introduce AbstractSymbolByReferencePointerRestoreTest 2021-03-22 11:27:27 +01:00
Ilya Kirillov
846dc1b9b9 FIR IDE: add more info to require calls KtSymbolByFirBuilder 2021-03-22 11:27:26 +01:00
Ilya Kirillov
ae6eeb2501 FIR IDE: introduce KtBackingFieldSymbol 2021-03-22 11:27:25 +01:00
Ilya Kirillov
443a14756f FIR IDE: change KtPropertySymbol inheritors cratePointer to return specific symbols 2021-03-22 11:27:25 +01:00
Ilya Kirillov
ceed3e7355 FIR IDE: separate KtSymbolByFirBuilder.buildVariableSymbol into functions 2021-03-22 11:27:24 +01:00
Ilya Kirillov
010f1cb634 FIR IDE: build KtJavaFieldSymbol only for Java fields 2021-03-22 11:27:22 +01:00
Ilya Kirillov
8bf339a7cf FIR IDE: refactor, extract throwing unexpected element error into function 2021-03-22 11:27:20 +01:00
Ilya Kirillov
502087a3c7 FIR IDE: extract KtType building from KtSymbolByFirBuilder 2021-03-22 11:27:19 +01:00
Ilya Kirillov
b6d334b303 FIR IDE: extract callable symbol building from KtSymbolByFirBuilder 2021-03-22 11:27:19 +01:00
Ilya Kirillov
c06bcbad39 FIR IDE: extract variable-like symbol building from KtSymbolByFirBuilder 2021-03-22 11:27:18 +01:00
Ilya Kirillov
bafc61b56f FIR IDE: extract function-like symbol building from KtSymbolByFirBuilder 2021-03-22 11:27:17 +01:00
Ilya Kirillov
db64884bd0 FIR IDE: refactor callable symbol building in KtSymbolByFirBuilder 2021-03-22 11:27:16 +01:00
Ilya Kirillov
439e54aee6 FIR IDE: extract class-like symbol building to separate class 2021-03-22 11:27:15 +01:00
Ilya Kirillov
cf30be5957 FIR IDE: make KtAnonymousObject symbol to extend KtClassObjectSymbol 2021-03-22 11:27:14 +01:00
Ilya Kirillov
08433b9ac9 FIR IDE: fix constructor symbol building for type alias constructors 2021-03-22 11:27:13 +01:00
Ilya Kirillov
4d5da26696 FIR IDE: get rid of KtFirSetterParameterSymbol 2021-03-22 11:27:12 +01:00
Ilya Kirillov
5e14aa34ec FIR IDE: add more info to CCE in symbol builder 2021-03-22 11:27:12 +01:00
scaventz
0dc5ed53f8 Provide sensible toString for getter/setter in reflection. 2021-03-22 11:21:54 +01:00
Svyatoslav Scherbina
8b3ff11a2b Provide CName annotation in common stdlib as optional 2021-03-22 09:20:05 +00:00
Svyatoslav Scherbina
552bd108a9 stdlib: rename NativeAnnotationsH.kt -> NativeConcurrentAnnotations.kt
Also move it from libraries/stdlib/common/src/kotlin
to libraries/stdlib/src/kotlin/annotations
2021-03-22 09:20:05 +00:00
Igor Yakovlev
25929b50d9 [FIR IDE] RawFirBuilder for lazy bodies 2021-03-21 10:42:29 +01:00
Nikolay Krasko
1558bd7373 Trust all module metadata till Gradle 6.8 update (KTI-493)
There's and issue with absent module files in the cache that leads to
"Artifact has been deleted from dependency cache" that can be resolved
by cleaning caches. It should be fixed in Gradle 6.8

https://github.com/gradle/gradle/issues/12713
2021-03-21 00:05:54 +03:00
Nikolay Krasko
73bc16896d Trust all poms till Gradle 6.8 update (KTI-493)
There's and issue with absent poms in the cache that leads to
"Artifact has been deleted from dependency cache" that can be resolved
by cleaning caches. It should be fixed in Gradle 6.8

https://github.com/gradle/gradle/issues/12713
2021-03-21 00:05:54 +03:00
Nikolay Krasko
efcb071f24 Trust javadoc and sources artifacts as the shouldn't be used in builds (KTI-493) 2021-03-21 00:05:53 +03:00
Nikolay Krasko
fd921f1dc0 Trust kotlin-native-prebuild-* (KTI-493)
Need more investigation for this artifact
2021-03-21 00:05:53 +03:00
Nikolay Krasko
fae1215881 Trust kotlin artifacts for bootstrapping (KTI-493)
Can't predict exact version after build
2021-03-21 00:05:53 +03:00
Nikolay Krasko
4bbba74360 Trust ivy xml files as they are constantly regenerated (KTI-493) 2021-03-21 00:05:52 +03:00
Nikolay Krasko
8240f5e459 Add dependencies lock with md5 and sha256 (KTI-493)
Initial commit without explicit check or cleanup.

Includes Kotlin Native dependencies.
2021-03-21 00:05:52 +03:00
Keegan Witt
a1ceaa9e44 Change pronoun in execption from "his" to "its" 2021-03-19 23:36:53 +01:00
Ilya Goncharov
f85ad41674 [IR] Check pureness in inlining lowering after transformation 2021-03-19 21:52:51 +03:00
Ilya Goncharov
8ac8dbdab8 [JS IR] Type operator call pureness 2021-03-19 21:52:51 +03:00
Ilya Goncharov
47d050c420 [JS IR] Correct pureness of expressions for arrayLiteral 2021-03-19 21:52:50 +03:00
Ilya Goncharov
f890156dde [JS IR] arrayConcat not use additional slice 2021-03-19 21:52:50 +03:00
Ilya Goncharov
76005813ff [JS IR] Fix for pureness of vararg 2021-03-19 21:52:50 +03:00
Ilya Goncharov
278a8c27fc [JS IR] Not create temporary variable for pure expressions on inline 2021-03-19 21:52:50 +03:00
Ilya Goncharov
ece0e200d5 [JS IR] Not nullize external varargs if it is not on the end of call 2021-03-19 21:52:50 +03:00
Ilya Goncharov
b8d5712bc0 [JS IR] Not use double slice for external varargs 2021-03-19 21:52:50 +03:00
Ilya Goncharov
120b5b9e05 [JS IR] Move isPure check to backend.common and add platform-specific check on calls with side effects 2021-03-19 21:52:50 +03:00
Ilya Goncharov
7bbb5b77db [JS IR] Concat varargs with non varargs on compile time for function w/o receiver 2021-03-19 21:52:50 +03:00
Ilya Goncharov
fc559ab0cd [JS IR] Unite varargs and non varargs before vararg 2021-03-19 21:52:49 +03:00
Dmitry Petrov
9e30ddd12e JVM_IR KT-45581 generate H_INVOKEINTERFACE for interface method handles 2021-03-19 18:57:21 +03:00
Dmitry Petrov
73d4fa65ea JVM_IR KT-45431 don't optimize out $$delegatedProperties in companion
Corresponding delegates are initialized in the host class, using
'$$delegatedProperties'.
TODO figure out proper code generation scheme for delegated properties
in companions (KT-45580)
2021-03-19 18:54:01 +03:00
Dmitry Petrov
f6baabd98e JVM_IR KT-45408 rewrite static calls recursively 2021-03-19 18:53:59 +03:00
Alexander Udalov
e5f218859b JVM IR: minor, improve error messages for inline classes
It will help in diagnosing problems like KT-44723.
2021-03-19 16:33:42 +01:00
Ivan Kylchik
65fcd72ce1 [VISUALIZER] Add handler for dot qualified expression in fir
For some reason source element of such expression in fir
was changed, so to get FirFunctionCall we should seek it
in KtDotQualifiedExpression
2021-03-19 18:30:35 +03:00
Ivan Kylchik
0160174c7a Extract VisualizerDirectives to separate file 2021-03-19 18:30:34 +03:00
Ivan Kylchik
de351d8bd3 Extract output handlers in visualiser's tests to separate files 2021-03-19 18:30:33 +03:00
Ivan Kylchik
6a439ad186 Add Test postfix to Abstract(Psi|Fir)Visualizer classes 2021-03-19 18:30:31 +03:00
Ivan Kylchik
5efa00821d Replace junit dependencies with single testApiJUnit5 call 2021-03-19 18:30:30 +03:00
Ivan Kylchik
6f639a39a7 Remove unnecessary dependencies on visualizer module 2021-03-19 18:30:28 +03:00
Ivan Kylchik
13ef126d4c [VISUALIZER] Remove ignore directive from correct test files 2021-03-19 18:30:27 +03:00
Ivan Kylchik
59416f447e [VISUALIZER] Change rendering of equals call 2021-03-19 18:30:26 +03:00
Ivan Kylchik
dd8a7010f0 [VISUALIZER] Forbid to render unary minus for integer literals 2021-03-19 18:30:25 +03:00
Ivan Kylchik
685f599c82 [VISUALIZER] Allow to render all calls at unary expresion in fir 2021-03-19 18:30:23 +03:00
Ivan Kylchik
84d4a0609f [VISUALIZER] Fix typealias rendering in fir 2021-03-19 18:30:22 +03:00
Ivan Kylchik
c94a4e7baf [VISUALIZER] Fix class literals rendering 2021-03-19 18:30:21 +03:00
Ivan Kylchik
fb654ce09b [VISUALIZER] Fix extension types rendering in fir 2021-03-19 18:30:20 +03:00
Ivan Kylchik
9e5645777d [VISUALIZER] Add annotation text for backing field in fir 2021-03-19 18:30:19 +03:00
Ivan Kylchik
813e48ffb4 [VISUALIZER] Replace rendering of class with no name to anonymous 2021-03-19 18:30:18 +03:00
Ivan Kylchik
ca424a94ef [VISUALIZER] Add local path to local declarations in fir 2021-03-19 18:30:16 +03:00
Ivan Kylchik
607c7b3e82 [VISUALIZER] Add implicit receiver rendering in fir 2021-03-19 18:30:15 +03:00
Ivan Kylchik
0ca0304865 [VISUALIZER] Fix render of null constant in fir 2021-03-19 18:30:14 +03:00
Ivan Kylchik
a497a2fa9b [VISUALIZER] Forbid to render type of single underscore variable 2021-03-19 18:30:13 +03:00
Ivan Kylchik
48ee4791b6 [VISUALIZER] Fix rendering of enum class and enum entry in fir 2021-03-19 18:30:12 +03:00
Ivan Kylchik
e2a7da25b0 [VISUALIZER] Rewrite fir symbol's rendering 2021-03-19 18:30:10 +03:00
Ivan Kylchik
4259ad2d84 [VISUALIZER] Change result of psi render according to new test data 2021-03-19 18:30:09 +03:00
Ivan Kylchik
3e66d12bef [FIR] Change some raw-fir test files to make them correct
"correct" means that these files can be compiled. This change is
necessary for visualizer. Don't want to ignore these test files,
so they must not produce errors.
2021-03-19 18:30:08 +03:00
Ivan Kylchik
951d607445 [VISUALIZER] Forbid to walk inside type reference children in psi 2021-03-19 18:30:07 +03:00
Ivan Kylchik
cc7d82ab7b [VISUALIZER] Change rendering of equality operator 2021-03-19 18:30:06 +03:00
Ivan Kylchik
c678ad9eb9 [VISUALIZER] Fix superTypes test 2021-03-19 18:30:05 +03:00
Ivan Kylchik
05efb8c129 [VISUALIZER] Add possibility to render callable reference in fir part 2021-03-19 18:30:04 +03:00
Ivan Kylchik
ce844a9bba [VISUALIZER] Disable rendering of value arguments in psi part
For now instead of arguments will be rendered parameters
2021-03-19 18:30:03 +03:00
Ivan Kylchik
f2cf86a3ae [VISUALIZER] Fix package rendering 2021-03-19 18:30:02 +03:00
Ivan Kylchik
c4be67b518 [VISUALIZER] Change rendering of constructors in fir part 2021-03-19 18:30:01 +03:00
Ivan Kylchik
945cc36ce3 [VISUALIZER] Add annotation at Array.set method 2021-03-19 18:30:00 +03:00
Ivan Kylchik
ca1b20c7f4 [VISUALIZER] Add some tests to ignore list 2021-03-19 18:29:58 +03:00
Ivan Kylchik
919591909e Update test data for compiler visualizer 2021-03-19 18:29:56 +03:00
Ivan Kylchik
4ac38e5f29 Rewrite compiler visualizer tests using new test infrastructure 2021-03-19 18:29:55 +03:00
Roman Golyshev
4c0cab4756 FIR IDE: Always insert additional spaces into lambda brackets
The customization of this with
`INSERT_WHITESPACES_IN_SIMPLE_ONE_LINE_METHOD` will be supported later
2021-03-19 17:44:15 +03:00
Alexander Udalov
415d52fe54 Deprecate KotlinJvmOptions.useIR
Starting from language version 1.5, JVM IR is enabled by default, so
this option has no effect. To rollback to the old JVM backend, the new
option useOldBackend can be used.

 #KT-45504 Fixed
2021-03-19 14:57:55 +01:00
Alexander Udalov
a10ebcea51 Minor, add -Xopt-in=kotlin.RequiresOptIn to kotlin-test-js
To prevent compilation warning on usages of OptIn in new
assertContentEquals functions.
2021-03-19 14:56:37 +01:00
Alexander Udalov
b33d245dfb Do not print stdlib version substitution message if nothing changed 2021-03-19 14:56:14 +01:00
Alexander Udalov
ec3799a696 Do not print total bytes written in :core:builtins:serialize
To reduce the amount of output on a clean build. Will have effect after
the next bootstrap update.
2021-03-19 14:56:14 +01:00
Anastasiya Shadrina
94c4d1c23e Specify when the range is empty in KDoc 2021-03-19 20:40:06 +07:00
Victor Petukhov
60f2f85be7 Process captured types with type variable inside properly, in the operations related with the type variables fixation 2021-03-19 16:16:11 +03:00
Victor Petukhov
a2b1aa753b Substitute captured types with type variables properly
^KT-44687 Fixed
2021-03-19 16:16:09 +03:00
Sergey Bogolepov
d276d583ba Keep host_os and host_arch methods for backward-compatibility
Because it is still used by IDE plugin
2021-03-19 15:24:45 +03:00
Sergey Bogolepov
af3ff6c4d6 Revert "Revert "Remove unused protobuf from backend.native""
This reverts commit c4182c82
2021-03-19 15:24:44 +03:00
Sergey Bogolepov
bba82c0d60 Revert "Revert "Remove obsolete bc.frontend module""
This reverts commit e7a385f9
2021-03-19 15:24:43 +03:00
Sergey Bogolepov
30e9c645f8 Revert "Revert "Cleanup TargetManager.kt a little bit""
This reverts commit 3dd25e49
2021-03-19 15:24:42 +03:00
Sergey Bogolepov
1d8d76eb7f Revert "Revert "Cleanup HostManager.kt a little bit""
This reverts commit 98b2c000
2021-03-19 15:24:41 +03:00
Roman Golyshev
184838ae35 FIR IDE: Fix import of properties; also fix bug in alreadyHasImport 2021-03-19 12:37:43 +03:00
Roman Golyshev
054d6ccdfb FIR IDE: Refactor KotlinFirLookupElementFactory 2021-03-19 12:37:43 +03:00
Roman Golyshev
9db8bd8d38 FIR IDE: Refactor variables insertion handlers 2021-03-19 12:37:43 +03:00
Roman Golyshev
84386237a6 FIR IDE: Refactor classifiers insertion handlers 2021-03-19 12:37:42 +03:00
Roman Golyshev
fe921b98ce FIR IDE: Refactor functions insertion handler 2021-03-19 12:37:42 +03:00
Roman Golyshev
43b829b1f0 Fix test data
We do not need to check the imports order in this particular test
2021-03-19 12:37:42 +03:00
Roman Golyshev
7b7ba717d0 FIR IDE: Add more correct importing of the callables
Now we use scopes to decide if the callable really needs to be inserted
2021-03-19 12:37:42 +03:00
Roman Golyshev
76ff106458 FIR: Add collecting top-level scopes of the file
It will be useful in the completion when we need to dicide if we
need to import FQN or not
2021-03-19 12:37:42 +03:00
Roman Golyshev
3427e0aebb FIR IDE: Add extensions function completion from indices
The insertion handling test is not correct, we need to check file
imports before adding new ones
2021-03-19 12:37:41 +03:00
Roman Golyshev
8396e17c52 Improve test data (to avoid clash with stdlib) 2021-03-19 12:37:41 +03:00
Roman Golyshev
83a9b4fb87 FIR IDE: Only insert FqNames for non-extension non-members properties
This is not completely correct, will be fixed later
2021-03-19 12:37:41 +03:00
Roman Golyshev
bf52417268 Add test for synthetic java property completion to multi-file tests 2021-03-19 12:37:41 +03:00
Roman Golyshev
d955f8e0d3 FIR IDE: Add simple shortening completion handler for properties 2021-03-19 12:37:41 +03:00
Roman Golyshev
8392b36964 FIR IDE: Add more accurate shortening for properties 2021-03-19 12:37:41 +03:00
Roman Golyshev
03a1c6fcca Add multi-file completion handler tests for FIR code completion
This is a temporary (and dirty) solution to start using those tests as
fast as possible. We certainly need to refactor them so they can be
generated from the testData
2021-03-19 12:37:40 +03:00
Roman Golyshev
73e623b5ac Generate multi-file completion tests for FIR completion
Also remove `MultiFilePrimitiveJvmBasicCompletionTestGenerated` tests
2021-03-19 12:37:40 +03:00
Roman Golyshev
abeff5d5c5 Enable passing tests 2021-03-19 12:37:40 +03:00
Roman Golyshev
d6d3d3a6ad FIR IDE: Add completion for top level functions and properties 2021-03-19 12:37:40 +03:00
Roman Golyshev
62389bad0b FIR IDE: Add more useful Lookup Objects
Main purpose of those lookup objects for now is to allow same lookup
elements to merge
2021-03-19 12:37:40 +03:00
Roman Golyshev
ab191925cb FIR IDE: Update test data for completion handlers test 2021-03-19 12:37:39 +03:00
Roman Golyshev
9896512eda FIR IDE: Collect scopes information in reanalyze
It is needed for the completion, so after the changes in method bodies
all contexts are correctly collected
2021-03-19 12:37:39 +03:00
Roman Golyshev
f641466f70 FIR IDE: Fix searching for the closest function to re-resolve
If the function is local, there would be errors related to its
unresolved body and receiver type
2021-03-19 12:37:39 +03:00
Roman Golyshev
1d64c0789f FIR IDE: Add implementation of classifiers completion from indices 2021-03-19 12:37:38 +03:00
Alexander Shabalin
5b1c30c198 Extract initializing singleton marker
* Extract kInitializingSingleton marker
* Extract isNullOrMarker helper function
2021-03-19 08:19:10 +00:00
Vasily Levchenko
b3ae30fdea [llvm][context util] make error more readable 2021-03-19 08:04:00 +00:00
Sergey Bogolepov
e320f7efc3 Add libffi buildscript for Apple Silicon 2021-03-19 07:21:39 +00:00
Svyatoslav Scherbina
a9d0409f2e Don't use Function.reflect() in kotlin-native/Interop on JVM
Use inline functions and typeOf<T>() instead
2021-03-19 06:53:09 +00:00
Alexander Likhachev
008e2636b7 [Gradle] Prevent early capturing of project build dir in KotlinCompile
#KT-45301 Fixed
2021-03-18 19:51:08 +00:00
Ilya Gorbunov
42648d55a0 kotlin-test: make assertIs<T> returning value cast to T KT-45296 2021-03-18 21:57:16 +03:00
Ilya Goncharov
2fd8620551 [Gradle, JS] Support custom display name in npm versions generator
^KT-42921 fixed
2021-03-18 21:32:15 +03:00
Ilya Goncharov
a291895ebe [Gradle, JS] Add compatibility with webpack 4
^KT-42921 fixed
2021-03-18 21:32:14 +03:00
Ilya Goncharov
a1a01a1428 [Gradle, JS] Use compatible node version
^KT-42921 fixed
2021-03-18 21:32:12 +03:00
Ilya Goncharov
b2a2616c10 [Gradle, JS] Fix of using format-util
^KT-42921 fixed
2021-03-18 21:32:11 +03:00
Ilya Goncharov
965426bbd9 [Gradle, JS] Webpack serve for webpack-dev-server
^KT-42921 fixed
2021-03-18 21:32:10 +03:00
Ilya Goncharov
5827ed3f05 [Gradle, JS] Update versions with karma-webpack 5.0.0
^KT-42921 fixed
2021-03-18 21:32:08 +03:00
Ilya Goncharov
1b8c74337e [Gradle, JS] Adopt Gradle plugin to webpack 5
^KT-42921 fixed
2021-03-18 21:32:07 +03:00
Ilya Goncharov
a06feaf819 Add possibility to hardcode version
^KT-42921 fixed
2021-03-18 21:32:05 +03:00
Ilya Goncharov
88abb3d6c9 [JS IR] Fix creating of classes extended from nested one
[JS IR] Extract getClassRef method

 ^KT-44950 fixed
2021-03-18 21:14:00 +03:00
Ilya Goncharov
a61312120b [Gradle, JS] WA for tests with multiple binaries 2021-03-18 20:07:48 +03:00
Ilya Goncharov
8ffe70cb4d [Gradle, JS] Use one folder for sync tasks 2021-03-18 20:07:47 +03:00
Dmitry Petrov
17da240910 JVM_IR KT-45195 generate non-static annotation members as ACC_ABSTRACT 2021-03-18 19:41:24 +03:00
Dmitry Petrov
2fd69a5718 Add bytecode listing tests for 'allopen' plugin with JVM_IR 2021-03-18 19:41:23 +03:00
Victor Turansky
e4d98d4e39 Gradle 7.0 support. com.gradle.plugin-publish 0.12.0 -> 0.13.0
[With Gradle 7+ support](https://plugins.gradle.org/plugin/com.gradle.plugin-publish/0.13.0)
2021-03-18 19:11:26 +03:00
Steven Schäfer
d0424465b8 JVM IR: Resolve fake overrides when calculating return types (KT-44867) 2021-03-18 16:02:35 +01:00
Pavel Punegov
cae95b1ba0 [native] Fix kotlin.native.home properties order. 2021-03-18 14:41:03 +00:00
Roman Artemev
44d03bc727 [Psi2Ir] Fix generation of property references for synthetic java props
- Declare it on use-site
 - Fix export checker for that case
 - Fix KT-45297
2021-03-18 16:50:31 +03:00
Roman Artemev
9632839253 [JVM IR] Add jvm box test for KT-45297 2021-03-18 16:50:27 +03:00
Roman Artemev
0a4f2bc39c [IR] Add irText test for KT-45297 2021-03-18 16:50:22 +03:00
Mikhail Zarechenskiy
78a0d7b5bb Disable check about unimplemented check for real defaults
Now we can generate proper defaults and there is no need in additional
 checks about unimplemented methods

 #KT-41130 Fixed
2021-03-18 16:38:55 +03:00
Mikhail Zarechenskiy
641f08d561 Use compiler arguments for Java against Kotlin highlighting tests
This is needed for the next commit to check jvm-default options

 #KT-41130 In Progress
2021-03-18 16:38:54 +03:00
Mikhail Zarechenskiy
111e54c8c1 Do not generate DefaultImpls for light classes if not needed
#KT-41130 In Progress
2021-03-18 16:38:52 +03:00
Dmitry Petrov
ac6232b4ba JVM_IR KT-36853 patch parents after tailrecPhase 2021-03-18 15:19:24 +03:00
Dmitriy Novozhilov
34f8c7a68b [TEST] Add ability to register compiler extensions in EnvironmentConfigurator 2021-03-18 14:00:38 +03:00
Ivan Gavrilovic
875ef73371 KT-45519: Get AGP version only once per classloader
Memoize AGP version per classloader, instead of computing
it once per project.

Fixes #KT-45519
2021-03-18 12:08:04 +03:00
Dmitriy Novozhilov
fc2d294b6c [FIR] Fix tower priorities for invoke resolve
#KT-45316 Fixed
2021-03-18 10:24:57 +03:00
Sergey Shanshin
cfca7183e5 Add inspections and quickfixes of redundant Json format instantiation
Resolves KT-45075
2021-03-18 05:44:03 +03:00
Alexander Udalov
27174de891 Add JVM target bytecode version 16
#KT-45515 Fixed
2021-03-17 21:31:08 +01:00
Andrei Klunnyi
09f9489619 [FIR]: sealed hierarchy processor for IDE
From now on sealed declarations get resolved with the help of
FirIdeSealedHierarchyProcessor. This change entails correct IDE side
check for sealed when exhaustiveness.
2021-03-17 19:43:49 +01:00
Nikolay Krasko
98b2c00083 Revert "Cleanup HostManager.kt a little bit"
This reverts commit 9d957f68
2021-03-17 20:40:48 +03:00
Nikolay Krasko
3dd25e4965 Revert "Cleanup TargetManager.kt a little bit"
This reverts commit a4010c7a
2021-03-17 20:40:29 +03:00
Nikolay Krasko
e7a385f9da Revert "Remove obsolete bc.frontend module"
This reverts commit b48a42a5
2021-03-17 20:40:00 +03:00
Nikolay Krasko
c4182c8269 Revert "Remove unused protobuf from backend.native"
This reverts commit 7a526a85
2021-03-17 20:39:35 +03:00
Ilya Gorbunov
85a0538f0a Compile and run common tests of kotlin-test in kotlin-test-js-ir build 2021-03-17 17:53:54 +03:00
Ilya Gorbunov
e66eeefe2a kotlin-test: assertIs and assertIsNot KT-45296
- Rename assertNotIs to assertIsNot
- Extract parts of implementation to helper internal PublishedApi
functions in order to inline minimum amount of code at use sites
- Remove PublishedApi from messagePrefix, no longer needed
2021-03-17 17:53:54 +03:00
Ben Asher
3a0219d84c kotlin-test: add assertIs and assertNotIs assertions KT-45296 2021-03-17 17:53:54 +03:00
Svyatoslav Scherbina
542518f290 Remove contents of kotlin-native/CHANGELOG.md
Keep only links to old and new changelogs.
2021-03-17 13:53:05 +00:00
Svyatoslav Scherbina
8a940fc075 Update kotlin-native/BUILDING_LLVM.md after build rework
Running `dependencies:update` task is no longer required.
2021-03-17 13:53:04 +00:00
Svyatoslav Scherbina
1f5830404c Native: remove documents that were migrated to kotlin-web-site
These documents were moved from kotlin-native repo to kotlin-web-site.
So copies that got merged into kotlin repo are unused.
2021-03-17 13:53:03 +00:00
Sergey Bogolepov
7a526a852f Remove unused protobuf from backend.native 2021-03-17 13:44:05 +00:00
Sergey Bogolepov
b48a42a5a6 Remove obsolete bc.frontend module 2021-03-17 13:44:04 +00:00
Sergey Bogolepov
a4010c7abe Cleanup TargetManager.kt a little bit 2021-03-17 13:44:03 +00:00
Sergey Bogolepov
9d957f686a Cleanup HostManager.kt a little bit 2021-03-17 13:44:03 +00:00
Sergey Bogolepov
d7bd3d671c Fix formatting of HostManager.kt 2021-03-17 13:44:02 +00:00
Dmitry Petrov
7fabc19326 JVM_IR KT-45446 don't erase captured var if it's dead code 2021-03-17 15:37:35 +03:00
Svyatoslav Kuzmich
6bd34db725 [JS IR] Fix kotlin.js.js with complex constant expressions
Use IR interpreter to evaluate complex constexprs
2021-03-17 15:12:18 +03:00
Jinseong Jeon
93289aa899 FIR checker: report VAL_REASSIGNMENT_VIA_BACKING_FIELD(_ERROR) 2021-03-17 15:04:44 +03:00
Mikhail Glukhikh
a6d11b8914 FirFunctionParameterChecker: use reportOnWithSuppression 2021-03-17 15:04:44 +03:00
Tianyu Geng
94de193993 FIR: introduce VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION check
Besides adding VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION,
we remove here NO_TYPE_FOR_TYPE_PARAMETER since it doesn't exist in FE1.0.
The name also doesn't make much sense.
From the usage it looks like it should have been
VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION instead.
2021-03-17 15:04:43 +03:00
sebastian.sellmair
f4b840467f CommonizerIT: Mark Windows as non-executable target 2021-03-17 10:55:46 +00:00
Dmitriy Dolovov
5a35018a88 [Commonizer] Move source code to the folder that corresponds package name 2021-03-17 13:34:14 +03:00
Dmitriy Dolovov
fc4f66b702 [Commonizer] Change the main package name
org.jetbrains.kotlin.descriptors.commonizer -> org.jetbrains.kotlin.commonizer
2021-03-17 13:34:06 +03:00
Alexander Dudinsky
28e4ce191b [Test] Add 'kotlin-stdlib-jdk7' to dependency for publishing KGP 2021-03-17 13:12:57 +03:00
Mark Punzalan
10d16d10d5 Raw FIR: Fix downward propagation of external and inline from
property to default accessors for light-tree.
2021-03-17 10:45:26 +01:00
Mark Punzalan
7d31ea3e8f FIR checker: Add utility functions for FirModifierList. 2021-03-17 10:45:26 +01:00
Mark Punzalan
315047b164 FIR checker: Make FirJvmExternalDeclarationChecker a
FirMemberDeclarationChecker.

Set isExternal in status for FirRegularClass. Invoke member declaration
checkers for FirRegularClass.
2021-03-17 10:45:26 +01:00
Mark Punzalan
cef26a043e FIR checker: Merge FirConstDeclarationChecker with
FirConstPropertyChecker.
2021-03-17 10:45:26 +01:00
Mark Punzalan
beaeb74a26 FIR checker: Separate FirExternalDeclarationChecker as it is
JVM-specific.
2021-03-17 10:45:26 +01:00
Mark Punzalan
c3d2ce0c1f FIR checker/IDE: Add checker and quickfix for WRONG_MODIFIER_TARGET.
There are only simple checks for `external` and `const` for now. The
rest of the checks (see ModifiersChecker in FE1.0) will be added later.
2021-03-17 10:45:26 +01:00
Mikhail Glukhikh
ebfc431733 FIR body resolve context: fix accessor scope handling 2021-03-17 12:13:23 +03:00
Mikhail Glukhikh
ca15df7815 FIR: introduce separate containingClass in BodyResolveContext 2021-03-17 12:13:23 +03:00
Mikhail Glukhikh
f9618db9e2 FIR: rearrange functions in BodyResolveContext 2021-03-17 12:13:23 +03:00
Mikhail Glukhikh
d30299c29e FIR: introduce BodyResolveContext.forBlock, withWhenExpression 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
6ae948b655 FirAbstractBodyResolveTransformer: drop some unused context functions 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
cbf38b119c FIR: introduce BodyResolveContext.storeCallableReferenceContext 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
8b7b15f02b FIR: refactor delegating constructors resolve 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
8a9be56d07 FIR: introduce BodyResolveContext.forFunctionBody 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
b4cec3fb5d FIR: introduce BodyResolveContext.forEnumEntry 2021-03-17 12:13:22 +03:00
Mikhail Glukhikh
2db413d535 FIR: enhance (using mode inside) BodyResolveContext.withAnonymousFunction 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
798d848a91 FirReturnsImpliesAnalyzer: find receiver/variable of accessor properly 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
a345b81f2a Use BodyResolveContext.with* functions in FirContractResolveTransformer 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
4d519f646e FIR: extract BodyResolveContext.withAnonymousInitializer, withParameter 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
4235075f35 FIR: extract BodyResolveContext.withAnonymousFunction 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
d7b2ab6b99 FIR: extract BodyResolveContext.withConstructor in variations 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
bd2cdf2ec9 FIR: extract BodyResolveContext.withField 2021-03-17 12:13:21 +03:00
Mikhail Glukhikh
64353f34e9 FIR: extract BodyResolveContext.withProperty 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
06b3a0d57b FIR: extract BodyResolveContext.withSimpleFunction 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
db2b6e92e5 FIR: extract BodyResolveContext.withAnonymousObject 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
e5325e70fc FIR: extract BodyResolveContext.withRegularClass 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
4cff6d93be Get rid of containingClass storage in FirDeclarationsResolveTransformer 2021-03-17 12:13:20 +03:00
Mikhail Glukhikh
91607044d0 FIR: extract BodyResolveContext.withFile 2021-03-17 12:13:20 +03:00
Andrey
b7dc1e64b1 [KAPT] Disable JPMS when running annotation processing
If sources contain module-info.java javac tries to validate modules existence/visibility during AP phase and fails, because we don't specify modules-path/patch-module. All these checks will be done in kotlin compiler and in javac for java classes. And it is not necessary to do it in AP too.
So we go for easiest path possible - disable jpms for AP. 

#KT-32202 Fixed
2021-03-17 11:10:27 +03:00
Ilmir Usmanov
a90a5f6dd4 Check for backend when checking for suspend in fun interfaces 2021-03-16 22:37:44 +01:00
Steven Schäfer
bf2942b5cc JVM IR: Add Object.clone to JvmSymbols
The `clone` function is not available in the builtin classes created
from fir.
2021-03-16 21:30:18 +01:00
Steven Schäfer
99a4779c6b JVM IR: Don't produce line numbers in synthetic Enum members 2021-03-16 21:30:18 +01:00
Steven Schäfer
5be00cfa04 JVM IR: Don't use null checks in Enum.valueOf 2021-03-16 21:30:18 +01:00
Steven Schäfer
bea1a8c422 JVM IR: Use Object.clone in Enum.values 2021-03-16 21:30:18 +01:00
Ilmir Usmanov
e47715f52b Minor. Add tests with returning inline class from SAM adapter 2021-03-16 20:57:05 +01:00
Nikolay Krasko
aff25b3666 Remove jcenter usages 2021-03-16 22:24:10 +03:00
Nikolay Krasko
74dd8726c0 Update repositories in kotlin/buildSrc 2021-03-16 22:24:08 +03:00
Mikhail Glukhikh
0e8f8362da FIR checkers: use isNullableType() instead of isSubtypeOfAny() 2021-03-16 21:56:11 +03:00
Mikhail Glukhikh
599a0d9c2b Minor fixes in FirTypeParameterInQualifiedAccessChecker 2021-03-16 21:56:10 +03:00
Mikhail Glukhikh
0b9598d880 Minor fixes around FirKClassWithIncorrectTypeArgumentChecker 2021-03-16 21:56:10 +03:00
Jinseong Jeon
4c08d10cce FIR checker: report expression of nullable type parameter as LHS of class literals 2021-03-16 21:56:10 +03:00
Jinseong Jeon
26441ed64f FIR IDEA: avoid unnecessary type casting 2021-03-16 21:56:10 +03:00
Jinseong Jeon
7fff4108b6 FIR checker: report KClass with incorrect type argument 2021-03-16 21:56:10 +03:00
Jinseong Jeon
bc2228d434 FIR checker: don't report errors on type parameter as LHS of class literals
If a type paramter is not reified or nullable, different errors will
be reported by FirGetClassCallChecker.

When determining whether type parameter wrapped in qualified access is a
standalone expression or not, we examine whether the checker context has
other qualified accesses in stack. Class literals (::class) is desugared
to FirGetClassCall, and thus not stacked as qualified access. Since
class literals are a special type of callable reference (a subtype of
qualified access), we should keep track of FirGetClassCall in a similar
way.
2021-03-16 21:56:09 +03:00
Jinseong Jeon
e29b40b07f FIR checker: report TYPE_PARAMETER_AS_REIFIED 2021-03-16 21:56:09 +03:00
Jinseong Jeon
5ba5b63dee FIR checker: report nullable expression as LHS of class literals 2021-03-16 21:56:09 +03:00
Jinseong Jeon
33c5b49632 FIR checker: report non-typed LHS of callable references 2021-03-16 21:56:08 +03:00
scaventz
329be4f906 Add a test to for the situation where pathname of destination does not name a parent. 2021-03-16 18:44:12 +01:00
Georgy Bronnikov
bff6e9b972 IR: document lock priority. 2021-03-16 19:49:31 +03:00
Georgy Bronnikov
60f38369f1 JVM_IR: synchronize binary class reloading 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
42279c3b5b IR: introduce IrLock
Use a single lock object for synchronization to avoid deadlocks.
2021-03-16 19:49:30 +03:00
Georgy Bronnikov
215556511e JVM_IR: synchronization in InlineCodegen 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
be67dacef1 JVM_IR: synchronized getOrPut for SLRUMap 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
78d62dcb1e JVM_IR: use ConcurrentHashMap in codegen where appropriate 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
c36bc9f312 JVM_IR: use synchronized map in ClassFileFactory 2021-03-16 19:49:30 +03:00
Georgy Bronnikov
3a10ea4f88 JVM_IR: synchronize code generation for inline functions 2021-03-16 19:49:29 +03:00
Georgy Bronnikov
c7feaee8ae IR: make copying optional in performByIrFile
For codegen phases, input files are readonly data. There is no need to
copy them.
2021-03-16 19:49:29 +03:00
Georgy Bronnikov
1383c31caf JVM_IR: use threadLocal in GlobalInlineContext 2021-03-16 19:49:29 +03:00
Georgy Bronnikov
fe4d33dcb1 JVM_IR: make codegen a phase 2021-03-16 19:49:29 +03:00
sebastian.sellmair
b68fee9cbc CliCommonizer: Guard input- and dependency- libraries 2021-03-16 15:47:29 +00:00
sebastian.sellmair
d03a85525d [Commonizer] DependencyLibrariesOptionType: Make option optional (default: empty) 2021-03-16 15:47:28 +00:00
sebastian.sellmair
73222fbc4f [Commonizer] Add more verbose debugging information when failing to parse a task 2021-03-16 15:47:28 +00:00
sebastian.sellmair
f6e8afcbcc Move Gradle property 'kotlin.commonizer.jvmArgs' to 'kotlin.mpp.commonizerJvmArgs' 2021-03-16 15:47:27 +00:00
sebastian.sellmair
56661068bd CommonizerIT: Reuse DISABLED_NATIVE_TARGETS_REPORTER_WARNING_PREFIX instead of hardcoded string 2021-03-16 15:47:26 +00:00
sebastian.sellmair
5a10cb6a3e CommonizerIT: Add integration tests for user defined c-interop commonization 2021-03-16 15:47:25 +00:00
sebastian.sellmair
80e964c166 [Commonizer] NativeKlibCommonize: Remove optimization for only loading dependencies from native distribution
This is removed for now, because of test failures on Windows.
It seems like the dependencies in the klib produced by Windows are not
correct.

See: https://youtrack.jetbrains.com/issue/KT-45471
^KT-45471
2021-03-16 15:47:25 +00:00
sebastian.sellmair
b777c89bc8 [Commonizer] NativeKlibCommonize: Only load dependencies from native distribution 2021-03-16 15:47:24 +00:00
sebastian.sellmair
97a57a7d93 Forward dependencies from CInteropCommonizerTask to commonizer 2021-03-16 15:47:23 +00:00
sebastian.sellmair
49cf386258 Limit CInteropCommonizerTask to only one level of commonization
See ^KT-39324
2021-03-16 15:47:23 +00:00
sebastian.sellmair
261934d881 Implement CopyCommonizeCInteropForIdeTask to survive build folder cleaning 2021-03-16 15:47:22 +00:00
sebastian.sellmair
a53df56781 Implement CInteropIdentifier.Scope 2021-03-16 15:47:21 +00:00
sebastian.sellmair
6efd04edc0 Implement CInteropCommonizerTask to support commonization of user-defined cinterops
^KT-40975 Verification Pending
2021-03-16 15:47:20 +00:00
sebastian.sellmair
7cf8e9ec58 CInteropProcess: Promote settings to constructor
This enforces that the specified c-interop settings cannot be re-set on
a CInteropProcess.
2021-03-16 15:47:20 +00:00
sebastian.sellmair
be84b7b419 Rename 'getSourceSetHierarchy' to 'withAllDependsOnSourceSets' and lift the previous Deprecation 2021-03-16 15:47:19 +00:00
sebastian.sellmair
7da7dd92d6 Deprecate KotlinSourceSet.getSourceSetHierarchy in favour of 'resolveAllDependsOnSourceSets' and general purpose 'transitiveClosure' 2021-03-16 15:47:18 +00:00
sebastian.sellmair
4e07dcf2d8 Minor: Add dictionaries/sebastiansellmair.xml 2021-03-16 15:47:17 +00:00
Ilya Matveev
6643119f08 [K/N][New MM] Move ThreadStateGuard to the main Memory.h
Integrating the stdlib with the thread states machinery requires
accessing to some parts of the new MM. This patch provides this
access by moving these parts to the main Memory.h header.
2021-03-16 17:04:26 +03:00
Ilya Matveev
482305cfb2 [K/N][New MM] Move RunInNewThread to the main ThreadSupport.hpp
Some of unit-tests for the C++ part of the stdlib will require
thread state switching. In the new MM, we already have a helper
function that allows us to scopely initialize the memory subsystem
for a separate thread. This patch makes this helper available
for tests in the main runtime module by moving it to the main
ThreadSupport.hpp.
2021-03-16 17:04:25 +03:00
Ilya Matveev
fc43fbf578 [K/N][New MM] Move MemoryState conversions to separate header 2021-03-16 17:04:23 +03:00
Nikolay Krasko
da6440c59e Add heap-dumps collection to BaseGradleIT.kt for TC investigations
Disable in daemon tests that checks defaults of -XX:MaxMetaspaceSize as
it looks like settings any jvm options reset defaults.
2021-03-16 15:55:01 +03:00
Nikolay Krasko
48f2db51d2 Stop polluting output for successful Gradle tests 2021-03-16 15:55:00 +03:00
Dmitry Petrov
decfaa3ba5 JVM_IR KT-44993 preserve inner expression type when fusing if-null 2021-03-16 15:30:45 +03:00
Jinseong Jeon
922419efb8 FIR CFG: route to exit of try main for throw in try main
to make the remaining part of try main marked as dead.

^KT-45475 Fixed
2021-03-16 15:11:56 +03:00
Jinseong Jeon
7a7114f896 FIR CFG: create TryMainBlockExitNode before visiting try main block
so that a node that returns Nothing inside try main block can route to
the exit of try main block, instead of exit target for try directly.
2021-03-16 15:11:55 +03:00
Jinseong Jeon
7e5b562b33 Reproduce KT-45475: no smartcast after conditional throw in try expression 2021-03-16 15:11:53 +03:00
Svyatoslav Scherbina
1f6f996faf kotlin-native/samples: workaround build for linuxArm32Hfp
libSDL2.so is missing in new sysroot (since 1.5), use one from
the old sysroot as a workaround.
2021-03-16 11:58:56 +00:00
Yan Zhulanow
1dad549c81 All-open: Add Micronaut preset (KT-26325) 2021-03-16 19:21:50 +09:00
Yan Zhulanow
69fedd9791 Avoid serializing non-serializable properties (EA-253232) 2021-03-16 19:21:50 +09:00
Yan Zhulanow
0fb57d7253 Pill: Exclude native-commonizer from JPS modules 2021-03-16 19:21:50 +09:00
Yan Zhulanow
5fca37fa0f Pill: Do not delete existing artifacts for JPS build 2021-03-16 19:21:49 +09:00
Yan Zhulanow
cfd585e221 Pill: Remove 'kotlin-coroutines-experimental-compat' from mapped libraries 2021-03-16 19:21:49 +09:00
Yan Zhulanow
4e8ec69ca7 Pill: Support kotlinx.serialization plugin 2021-03-16 19:21:49 +09:00
Yan Zhulanow
bcce187e3f Pill: Import kotlinx-metadata only in FULL mode 2021-03-16 19:21:49 +09:00
Yan Zhulanow
cc41ccc3b9 Pill: Disable all compiler plugins by default 2021-03-16 19:21:48 +09:00
Yan Zhulanow
61cd97b340 Pill: Remove unused EmbeddedComponents class 2021-03-16 19:21:48 +09:00
Yan Zhulanow
a00f3b97c5 Pill: Move utility classes to util package 2021-03-16 19:21:48 +09:00
Yan Zhulanow
6da03c0cda Pill: Move project model out of parser file 2021-03-16 19:21:48 +09:00
Yan Zhulanow
e4ce48d9ef Pill: Extract artifact-related components to their own package 2021-03-16 19:21:47 +09:00
Yan Zhulanow
901bfbb3c7 Pill: Create KotlinArtifact only for variants that include BASE 2021-03-16 19:21:47 +09:00
Yan Zhulanow
6ff68311c1 Pill: Support module prefixes 2021-03-16 19:21:47 +09:00
Yan Zhulanow
a561fb85ad Pill: minor, fix inspection warnings 2021-03-16 19:21:47 +09:00
Yan Zhulanow
4708525b9a Pill: Refactor Pill variants, replace DEFAULT variant with nullable value 2021-03-16 19:21:46 +09:00
Yan Zhulanow
51a23b7aeb Pill: Always import Pill importer module for debugging purposes 2021-03-16 19:21:46 +09:00
Yan Zhulanow
c2cbbc5aba Pill: Removed unused NONE variant 2021-03-16 19:21:46 +09:00
Yan Zhulanow
a355d82b37 Pill: Fix warnings in PillExtension 2021-03-16 19:21:46 +09:00
Yan Zhulanow
f84c1d7354 Pill: Fix warnings in PillExtensionMirror 2021-03-16 19:21:45 +09:00
Yan Zhulanow
880067946e Pill: Do not import kotlin-serialization library as dist dependency as it doesn't exist in dist/kotlinc 2021-03-16 19:21:45 +09:00
Yan Zhulanow
38d88877a3 Pill: Map kotlin-coroutines-experimental-compat library 2021-03-16 19:21:45 +09:00
Yan Zhulanow
cc56511585 Pill: Map 'java9' source sets of standard library and tests 2021-03-16 19:21:45 +09:00
Zac Sweers
12a6352bef Fix NPE in KaptJavaLog
See https://issuetracker.google.com/issues/162446295 for more context, but in short: this will fail if the project:
* targets java 8
* consumes external libraries targeting a higher version (java 9+). This includes Android SDK 30's android.jar, which targets java 9
* has `mapDiagnosticLocations` enabled for kapt

targetElement is a nullable type, so this seems like a pretty cut-and-dry NPE fix
2021-03-16 19:21:44 +09:00
Vladimir Dolzhenko
462b752763 Mark flaky test 2021-03-16 11:03:05 +01:00
Dmitriy Novozhilov
cef859fced Fix exponential pseudocode size on incorrect prefix increments and decrements
#KT-44153 Fixed
2021-03-16 12:25:23 +03:00
Denis.Zharkov
6c5557dae3 FIR2IR: Optimize computation of fake overrides in lazy classes 2021-03-16 09:28:52 +03:00
Denis.Zharkov
fbed88d32d FIR2IR: Do not unwrap fake override when computing overridden 2021-03-16 09:28:52 +03:00
Denis.Zharkov
74ecae7f6d IR: Optimize IrSimpleFunction::collectRealOverrides 2021-03-16 09:28:52 +03:00
Denis.Zharkov
1a36ee2110 IR: Postpone computing real fake overrides at SyntheticAccessorLowering 2021-03-16 09:28:52 +03:00
Denis.Zharkov
c09fe3ea6f FIR: Optimize unnecessary interface casts by adding relevant overload 2021-03-16 09:28:52 +03:00
Denis.Zharkov
f141c276be IR: Avoid recomputing Symbols::progressionElementTypes 2021-03-16 09:28:52 +03:00
Alexander Udalov
d9a9bd0136 Fix compilation of Interop/Runtime after fc36178f3a 2021-03-15 20:34:24 +01:00
Dmitry Petrov
d74168fb8f PSI2IR KT-44414 fix adapted reference to imported object member 2021-03-15 21:24:25 +03:00
Mikhail Glukhikh
e7129329d2 Revert "FIR: do not eagerly resolve class references in imported annotations"
This reverts commit 1a57d60f
2021-03-15 18:36:13 +03:00
Alexander Udalov
83a4b6396a Deduplicate source roots in psi2ir and CLI
Compiler plugins can add new source roots to the next compilation round
by using `AnalysisResult.RetryWithAdditionalRoots`. Some plugins added
already existing source roots to this list in some cases. For example,
this is reproducible with `square/anvil` with incremental compilation
(KT-45100, KT-44925). Psi2ir didn't deduplicate the source files before,
which resulted in several classes with the same name linked to the same
symbol. This led to a "symbol is already bound" exception, and in case
of KT-44925, to an additional NPE when we were rendering the class to
display it in the message.

The solution is to deduplicate classes before psi2ir. Note that this
commit has two changes, in CLI and in psi2ir. Any one of these is
sufficient for fixing the problem, however both are made just to make it
more future-proof against new components and/or changes in existing
subsystems (e.g. fir2ir).

In the old JVM backend, similar deduplication was happening in
`ClassFileFactory.registerSourceFiles`, which is why the problem is not
reproducible there.

 #KT-45100 Fixed
2021-03-15 16:30:46 +01:00
Alexander Udalov
fc36178f3a Annotate kotlin.reflect.jvm.reflect with ExperimentalReflectionOnLambdas
This function was always experimental, as explained in its kdoc, but it
was introduced before opt-in requirement markers were supported. Thus,
breaking changes (such as in KT-42746) were always expected, and the
`@ExperimentalReflectionOnLambdas` annotation just makes it clearer.

 #KT-45486 Fixed
2021-03-15 15:54:31 +01:00
pyos
43140db65e FIR2IR: better filter out non-declared data class properties 2021-03-15 17:32:41 +03:00
pyos
1a57d60f68 FIR: do not eagerly resolve class references in imported annotations 2021-03-15 17:32:39 +03:00
Dmitry Petrov
e630e00e99 JVM_IR KT-44744 check accessibility of enum entry 'this' 2021-03-15 17:26:49 +03:00
Svyatoslav Scherbina
14cb762133 Update the docs to reflect Kotlin/Native merge to kotlin repo
Also:
* Revamp kotlin-native/README.md a bit: make it more up-to-date,
  add useful links
* Remove "composite build" section from ReadMe.md:
  it was used for Kotlin + Kotlin/Native composite;
  this is no longer required.
2021-03-15 14:09:00 +00:00
Ilya Kirillov
d7da17d8e6 FIR: fix FirOldFrontendDiagnosticsTestGenerated.testVariableInvoke test 2021-03-15 14:31:12 +01:00
Igor Chevdar
c37f8ba708 [IR][cache] Fix for https://youtrack.jetbrains.com/issue/KT-44764
The .konanLibrary is cached for each declaration for performance purposes, but it is only ok to do it
after IR has been lowered to its final state (or at least when declarations aren't being moved around),
so the fix respects that by only taking .konanLibrary of a IrFile (it is assumed that files stay on their place
during entire backend lowering procedure).

(cherry picked from commit e021138368b48e306ba99a96f47d93ecbe039f4d)
2021-03-15 15:54:51 +03:00
Alexander Udalov
c56f719dcc Fix/suppress some warnings
(cherry picked from commit d8a43c216925b3a9e1475b786978436835a57927)
2021-03-15 15:54:50 +03:00
Igor Chevdar
c5249ac714 Disposed target data
(cherry picked from commit 250be87acf66d5c780fb593f46da3540a536e049)
2021-03-15 15:54:49 +03:00
Vladimir Ivanov
ba50a8275c Add test for [KT-3706]
Issue is already fixed by metadata-based cinterop

(cherry picked from commit fd4f5b2c07ebdc431d6243ac087f911ee30e88ca)
2021-03-15 15:54:48 +03:00
Vladimir Ivanov
64129314fb Fix sample file naming for case-sensitive FS
(cherry picked from commit 72235c31852fba4f2ab330d8178197c2584b1cda)
2021-03-15 15:54:46 +03:00
Jinseong Jeon
8dce6f2ac9 FIR CFG: don't propagate deadness on the uncaught exception path 2021-03-15 15:54:22 +03:00
Jinseong Jeon
d27ecca0e9 FIR CFA: keep UncaughtExceptionPath separated 2021-03-15 15:54:21 +03:00
Mikhail Glukhikh
06a80c0b34 FIR tree generator: merge fields from parents properly 2021-03-15 15:33:38 +03:00
Mikhail Glukhikh
7f7a964b2e FIR: annotate 'replaceSource' with '@FirImplementationDetail' 2021-03-15 15:33:38 +03:00
Mikhail Glukhikh
c641fa739b FIR: provide 'replaceSource' only for FirQualifiedAccess inheritors 2021-03-15 15:33:38 +03:00
Dmitriy Novozhilov
4d65b0ef5a [FIR2IR] Unmute passing black box test 2021-03-15 15:12:11 +03:00
Alexander Shabalin
f51c85a63f Add test support for types and objects creation
* test_support::TypeInfoHolder to create TypeInfo given payload description
* test_support::Object<Payload> to create objects with Payload and to get them from ObjHeader* after checking that their type_info are layout compatible.
* test_support::*Array<Count> to create various arrays with given length and similarly get them from ArrayHeader*.
2021-03-15 11:25:04 +00:00
Yaroslav Chernyshev
aff49c76a9 loadClassOrNull: catch 'ClassNotFoundException' and 'LinkageError' over 'Exception' 2021-03-15 13:35:37 +03:00
Yaroslav Chernyshev
116b11d8be Continue 'populateModuleDependenciesBySourceSetVisibilityGraph' on missing GradleSourceSetData' 2021-03-15 13:35:36 +03:00
Yaroslav Chernyshev
d053ee33a8 Precise platform importing changes ported from new repository 2021-03-15 13:35:35 +03:00
Yaroslav Chernyshev
960a7dca45 Re-structure KotlinMPPGradleProjectResolver.populateModuleDependencies 2021-03-15 13:35:34 +03:00
Yaroslav Chernyshev
18a06dc37e HMPP import: add dependencies present on all compilation a jvm&android shared source set participates 2021-03-15 13:35:33 +03:00
Dmitry Savvinov
96a4d19365 Minor: inline addDependsOnSourceSets in buildCompilation 2021-03-15 13:35:33 +03:00
Dmitry Savvinov
4927777ffb Minor: rename KotlinCompilation.sourceSets -> allSourceSets 2021-03-15 13:35:32 +03:00
Dmitry Savvinov
1143865e88 Minor: add test on importing platform of commonMain in single-backend project 2021-03-15 13:35:32 +03:00
Dmitry Savvinov
c3f5d57d3b Implement precise platforms importing in MPP
- skip metadata target from importing. That lead to metadata
compilations being imported is well -> some source-sets were
participating in metadata compilations as well -> logic for determining
platforms used to consider metadata compilations as well, adding COMMON
platform to set of platforms

Seems like metadata was never needed in import/IDE, and got there purely
by accident

- Use only targets, actually present in the project, as the default
platform. This is needed mostly for corner-cases/miconfigurations, like
orphan source-sets (source-sets which are created but not included into
any configuraion). Still, for those source-sets the tooling is required
to behave properly; presence of non-existing target can lead to various
issues like showing gutters for test runs, which would fail on launch
(because tests for that target actually do not exist)

^KT-37127 Fixed
2021-03-15 13:35:31 +03:00
Dmitry Savvinov
7a5b4ccb9a Refactoring: collect all logic regarding detecting sourceSet platform in one function
Note that previously addSourceSetsToCompilation had logic regarding
platforms. The reason for that is that it was the last place where
default soruce sets of compilations could be distinguished from all
participated source sets.

So, to move that logic, we have to preserve default source sets.
Therefore, this commit introduces 'KotlinCompilation.defaultSourceSets',
and 'ImportingContext.isDefaultSourceSet' method.

The rest is trivial code moving/methods introduction

The resulting code isn't really pretty and likely has non-orthogonal
predicates, this will be cleaned-up in the next commits
2021-03-15 13:35:31 +03:00
Dmitry Savvinov
ef04ae041e Minor: swap receiver and parameter for shouldCoerceToCommon
Otherwise, it reads as if KotlinSourceSet coerces ImportingContext,
which is in fact the other way around
2021-03-15 13:35:30 +03:00
Dmitry Savvinov
7ddcdca6bb Dont coerce platforms of source-sets in HMPP to set of available targets in project 2021-03-15 13:35:30 +03:00
Andrey Uskov
9c000000cf Update Gradle verion in tests from 6.1 to 6.1.1
Gradle 6.1 is not suitable for testing because of memory leak on
artefact validation (https://github.com/gradle/gradle/issues/11966)
2021-03-15 12:28:08 +03:00
Dmitriy Novozhilov
054c278c83 [FIR] Fix determining nullability of type variables and type parameters 2021-03-15 12:13:10 +03:00
Dmitriy Novozhilov
e00ff5c473 [FIR] Make FirClassifierSymbol sealed 2021-03-15 12:13:09 +03:00
Dmitriy Novozhilov
631b771251 [FIR] Report proper resolution diagnostics from arguments checks 2021-03-15 12:13:08 +03:00
Dmitriy Novozhilov
6cc3fff48d [FIR] Properly handle that type variable is contained in inv or contravar positions
#KT-45344 Fixed
2021-03-15 12:13:07 +03:00
Dmitriy Novozhilov
3d1f4b8386 [FIR] Don't add @EnhancedVisibility to types with @Nullable annotation 2021-03-15 12:13:06 +03:00
Dmitriy Novozhilov
a7c08345b4 Extract Generate Compiler Tests run configuration back to top level 2021-03-15 12:13:04 +03:00
Dmitriy Novozhilov
329d9a58bc Generate IDE run configurations for modularized and full pipeline test
To generate configuration you need to specify path to root directory
  with modularized testdata for kotlin project in `local.properties`:

```
kotlin.fir.modularized.testdata=/path/to/testdata/modularized-kotlin
```
2021-03-15 12:13:02 +03:00
Dmitriy Novozhilov
f5d00716d1 Advance kotlin-build-gradle-plugin version to 0.0.26 2021-03-15 12:13:01 +03:00
Dmitriy Novozhilov
ab62680a03 Add new configuration flag to kotlin-build-gradle-plugin
This flag is needed for auto-generation of run configurations
  for modularized tests which are used by FIR team
2021-03-15 12:12:59 +03:00
Andrey
fe6ddcc1fa [KAPT] Skip kapt tasks if no annotations processors are provided (#4190)
So we don't do any preparation, don't spin up compiler.  And user will see SKIPPED in task execution
2021-03-15 11:37:06 +03:00
Svyatoslav Scherbina
77161af92a Delete obsolete kotlin-native/GRADLE_PLUGIN.md 2021-03-15 08:30:23 +00:00
Dmitriy Dolovov
6791ae81db [Commonizer] Minor. Clean-up in AbstractCommonizerTest 2021-03-15 11:25:48 +03:00
Dmitriy Dolovov
aa196ae813 [Commonizer] Minor. Clean-up in ValueParameterCommonizerTest 2021-03-15 11:25:43 +03:00
Dmitriy Dolovov
0bd5fdb611 [Commonizer] Minor. Formatted 2021-03-15 11:25:37 +03:00
Dmitriy Dolovov
ed98d878df [Commonizer] Minor. Reorganize CirClass.supertypes 2021-03-15 11:25:32 +03:00
Mikhael Bogdanov
cdb2dd6661 Advance bootstrap to 1.5.20-dev-2613 2021-03-15 07:10:03 +01:00
Ilmir Usmanov
64abb2501f Minor. Add FIR_IDENTICAL directive 2021-03-15 06:19:22 +01:00
Ilmir Usmanov
c9f41a2440 Minor. Ignore tests on WASM 2021-03-15 06:14:44 +01:00
Ilmir Usmanov
149064803d JVM_IR: Do not unbox Result argument inside java SAM adapters
#KT-45259
2021-03-15 06:14:42 +01:00
Ilmir Usmanov
4099dfc7e0 JVM_IR: Do not unbox Result argument inside SAM adapters
#KT-45259 Fixed
2021-03-15 06:14:40 +01:00
Mikhael Bogdanov
6fab1305e9 Fix compilation after @JvmDefault deprecation
Suppress could be removed after switch to -Xjvm-default=all
2021-03-13 08:24:18 +00:00
Mikhail Bogdanov
95654bb9bc Deprecate @JvmDefault
#KT-40392 Fixed

(cherry picked from commit c11f38688e)
2021-03-13 08:24:17 +00:00
Abduqodiri Qurbonzoda
77c263fcc4 Mark kt45410.kt with TARGET_BACKEND: JVM 2021-03-13 02:30:24 +03:00
Alexander Shabalin
391458c355 Fix CompileToBitcode's llvm-link invocation
Porting https://github.com/jetbrains/kotlin-native/pull/4536 which got
lost in c85c3ac123
2021-03-12 16:53:47 +00:00
Ilmir Usmanov
d3b42709fd Revert "Value Classes: Forbid var properties with value class receivers"
This reverts commit f43899086a.
2021-03-12 17:51:24 +01:00
Ilmir Usmanov
6429ac17d8 Revert "Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error"
This reverts commit bad197e075.
2021-03-12 17:51:21 +01:00
Roman Artemev
050db6d454 [KLIB] Add box test for generic annotations 2021-03-12 19:03:04 +03:00
Roman Artemev
0d8fff7186 [KLIB] Fix annotation type deserialization
Instead of hardcoded `Unit` restore it basing on annotation class and
constructor's type arguments
2021-03-12 19:03:04 +03:00
Roman Artemev
607a598f1a [IR] Add irText test for generic annotations 2021-03-12 19:02:29 +03:00
Roman Artemev
79935e29de [IR] Support type arguments in psi2ir 2021-03-12 19:02:29 +03:00
Roman Artemev
b60ebc0975 [IR] Support type arguments on annotations in IR render 2021-03-12 19:00:11 +03:00
Roman Artemev
ab8f64a3ee [FIR] Mute failing tests 2021-03-12 18:47:34 +03:00
Roman Artemev
92eac7e124 [IR] Fix irText test runner
Do not ignore compilation errors if they are existed
2021-03-12 18:36:33 +03:00
Anton Lakotka
d023f09bd4 Don't add common compiler plugin artifacts to native targets
Make native plugin configuration be non-transitive
2021-03-12 18:28:26 +03:00
Ilya Kirillov
f339748f5b FIR IDE: fix origin of synthetic functional interfaces
^KT-45312 fixed
2021-03-12 15:17:33 +01:00
Ilya Kirillov
41d1ef22b6 FIR: specify BODY_RESOLVE for synthetic functional interface 2021-03-12 15:15:32 +01:00
Alexander Likhachev
6b774b07e0 [Gradle, K/N] Fix broken iOS, watchOS, tvOS tests
They were broken in 2a8e2613a2
2021-03-12 16:36:18 +03:00
Alexander Likhachev
aedd8a104d [Gradle, K/N] Fix native test execution test on Macs 2021-03-12 15:56:03 +03:00
Mads Ager
8588412a56 [JVM IR] Support break in do-while condition.
This breaks from the loop itself which is inconsistent with
what happens for breaks in while conditions.

Also, the frontend will report that code after the loop is
unreachable, which it isn't. :-\

However, those issues are covered in
https://youtrack.jetbrains.com/issue/KT-17728, so for now
we follow the old backend to not "break" anyone. :)

Fixes KT-44412
2021-03-12 13:46:27 +01:00
Dmitry Petrov
d0d3b57366 Minor: mute test in FIR 2021-03-12 15:08:24 +03:00
Victor Petukhov
91d2f32a57 Don't lose upper non-expected type constraints to include them to intersection type during finding the result type of the fixing type variable 2021-03-12 14:36:54 +03:00
Victor Petukhov
b87c2a15b5 Don't stop constraints processing if all type variables have proper equality constraints
Those type variable may have other constraints after incorporation into which, the constraint error may appear

^KT-42042 Fixed
2021-03-12 14:36:54 +03:00
Victor Petukhov
7f7bb70596 Don't fix a type variable into the intersection type if there is an explicit expected type
^KT-43303 Fixed
^KT-42396 Fixed
^KT-42472 Fixed
2021-03-12 14:36:53 +03:00
pyos
e06bacafad JVM: fix inline cycle detection
1. use the correct descriptor in the old backend;
 2. clear the temporary variables for arguments in the IR backend.

 #KT-45292 Fixed
2021-03-12 11:49:42 +01:00
Ilya Kirillov
4e98d1b857 FIR IDE: update lazy resolve tests testdata 2021-03-12 11:44:00 +01:00
Ilya Kirillov
f8828abeba FIR: fix declaration phase updating in FirContractResolveTransformer 2021-03-12 11:44:00 +01:00
Ilya Kirillov
4dc040b91a FIR: update enum entry resolve phase in body resolve transformers 2021-03-12 11:44:00 +01:00
Ilya Kirillov
d49913944c FIR: add tests which checks that every declaration in file has body resolve phase after resolving the fiile 2021-03-12 11:44:00 +01:00
Ilya Kirillov
0dd18006e8 FIR: do not update phase from IMPLICIT_TYPES_BODY_RESOLVE to BODY_RESOLVE
This is not needed as such declarations are now marked with body resolve phase
2021-03-12 11:44:00 +01:00
Ilya Kirillov
fe207492b7 FIR: mark declarations resolved to BODY_RESOLVE with BODY_RESOLVE phase in implicit body transformer 2021-03-12 11:43:59 +01:00
Ilya Kirillov
ded234074d FIR: render value parameter/lambda/accessor resolve phase if RenderMode.renderDeclarationResolvePhase is enabled 2021-03-12 11:43:59 +01:00
Alexander Udalov
869a153327 Enable -Werror for buildSrc 2021-03-12 11:19:07 +01:00
Alexander Udalov
848b08a475 Minor, suppress 1.3 language version warnings 2021-03-12 11:18:57 +01:00
Ilya Goncharov
ead0b50107 [JS IR] In file:JsModule top level with fresh names 2021-03-12 12:57:56 +03:00
Ilya Kirillov
600e1725cb Do not run wizard project importing tests in TC
They will be run only in kotlin-ide plugin
2021-03-12 10:56:41 +01:00
Igor Yakovlev
023b7fbb8f [ULC] Fix invalid primitive type annotating
Fixed #KT-45417
2021-03-12 10:35:37 +01:00
Abduqodiri Qurbonzoda
ff5b2404af Introduce firstNotNullOf and firstNotNullOfOrNull #KT-12109 2021-03-12 09:27:14 +03:00
Abduqodiri Qurbonzoda
d4b3ae92cb [K/N] Strict version of String.toBoolean() #KT-42071 2021-03-12 09:26:58 +03:00
Abduqodiri Qurbonzoda
09ad5ca602 Strict version of String.toBoolean() #KT-42071 2021-03-12 09:26:55 +03:00
Abduqodiri Qurbonzoda
5f4a4fd8ae Introduce assertContentEquals in kotlin-test #KT-32996 2021-03-12 09:24:15 +03:00
Dmitry Petrov
44e6483090 JVM_IR Spill stack on array constructor call
KT-42932
2021-03-12 09:18:35 +03:00
Alexander Likhachev
dbfe45993a [Build] Fix test distribution plugin applying condition 2021-03-12 08:02:44 +03:00
Anton Lakotka
99ce047733 Add separate Plugin Classpaths per compilation
Make them extend the common CP for sake of backward compatibility
^KT-45020 Fixed
2021-03-11 22:34:21 +01:00
Tianyu Geng
9476175cc2 FIR: add mapping to partially resolved arg list
Initially I tried adding `mapping` field to `FirArgumentList` but it
seems to be very difficult to make it flexible enough to do what I want.

So instead, I am creating a `FirPartialResolvedArgumentList`, which
seems to be very simple.
2021-03-11 22:57:58 +03:00
Mikhail Glukhikh
5d3afbad54 Rename: BadNamedArgumentsTarget -> ForbiddenNamedArgumentsTarget 2021-03-11 22:57:57 +03:00
Tianyu Geng
be0dd84a06 FIR: check NAMED_ARGUMENTS_NOT_ALLOWED
The check has already been partially implemented in
org.jetbrains.kotlin.fir.resolve.calls.FirCallArgumentsProcessor. This
change completes the missing piece that determines if a `FirFunction`
has stable parameter names.
2021-03-11 22:57:57 +03:00
Tianyu Geng
0d4e9ca0b9 FIR: allow reporting multiple FirDiagnostics from a ConeDiagnostic 2021-03-11 22:57:57 +03:00
Mikhail Glukhikh
1f15ce2d26 FIR diagnostics: extract mapUnsafeCallError 2021-03-11 22:57:57 +03:00
Mark Punzalan
bb790195a2 FIR IDE: Enable ChangeVariableMutabilityFix for MUST_BE_INITIALIZED. 2021-03-11 16:31:40 +01:00
Ilya Chernikov
09fb2cd746 [minor] disable implicits test on IR, see added comments for details 2021-03-11 15:50:33 +01:00
Ilya Chernikov
e05c8ac57b Add script metedata flag 2021-03-11 15:50:33 +01:00
Ilya Chernikov
7c63105bb7 Mark script result expression as used to avoid coercion to unit 2021-03-11 15:50:32 +01:00
Ilya Chernikov
7d07010785 Fix handling of lambdas in top-level destructuring declarations 2021-03-11 15:50:32 +01:00
Ilya Chernikov
22f1814911 Fix CFA for destructuring declarations in scripts
in particular without the fix, the CFA skipped marking of the used
result values in lambdas and they were coerced to unit in IR
2021-03-11 15:50:31 +01:00
Ilya Chernikov
10567d9a37 [minor] fix scripting test dependencies 2021-03-11 15:50:31 +01:00
Ilya Chernikov
9c786a9cd9 [minor] uncomment 2 scripting tests:
Tests were failing before, but now fixed, most likely by switching to
default target 1.8 and some changes in scripting IR support.
#KT-44471 fixed
2021-03-11 15:50:31 +01:00
Ilya Chernikov
ef01411d20 [minor] fix script util tests 2021-03-11 15:50:30 +01:00
Ilya Chernikov
375441832e Implement REPL support in IR scripting 2021-03-11 15:50:30 +01:00
Ilya Chernikov
c066b7843c Fix provided properties generation in ir scripting 2021-03-11 15:50:07 +01:00
Ilya Chernikov
bc6c17d4b2 Enable IR in jvm scripting host tests 2021-03-11 15:50:06 +01:00
Ilya Chernikov
e9da385f7c Implement property for passing argumens to isolated script compiler 2021-03-11 15:50:06 +01:00
Ilya Chernikov
43d7536a28 Protect scripts compilation from passing -Xuse-ir via configuration
as well as other options that require changes in the compilation setup
before compiler options from the configuration could be processed
2021-03-11 15:50:06 +01:00
Ilya Chernikov
bac6a7346e Extend GeneratorExtensions with previous script, implemt it for JS REPL
also refactor JS REPL for better compatibility with the generic
REPL/scripting infrastructure
2021-03-11 15:50:01 +01:00
Ilya Chernikov
83da5f61fd [minor] Implement in-process test for main.kts cache
mainly to ease debugging
2021-03-11 15:49:46 +01:00
Ilya Chernikov
4dc228a0a3 Implement proper call to the base class ctor in ir script lowering 2021-03-11 15:49:46 +01:00
Ilya Chernikov
32d0c99289 Implement metadata handling for IR scripts 2021-03-11 15:49:45 +01:00
Ilya Chernikov
4c6b5ff0b8 Implement IR backend support in scripting tests, enable for some tests 2021-03-11 15:49:44 +01:00
Alexander Likhachev
d1ee05c7f6 Revert "[Build] Fix configuration cache issues with install task"
This reverts commit 078849d1
2021-03-11 17:22:37 +03:00
Yahor Berdnikau
543ab3fa2a Fix issues in Android test projects setup. 2021-03-11 16:36:54 +03:00
Yahor Berdnikau
590bab82e2 Remove not-needed test task validation.
Now all test 'install' dependencies are added via centralized 'dependsOnKotlinGradlePluginInstall()' method.
2021-03-11 16:36:53 +03:00
Yahor Berdnikau
3f953bcdfc Use lazy query for KGP test SourceSet output. 2021-03-11 16:36:52 +03:00
Yahor Berdnikau
7e7552bf5d Use JUnit 5 platform to run KGP tests.
Enabled vintage engine, so existing tests could run without any
modification.

^KT-45353 In Progress
2021-03-11 16:36:50 +03:00
Tianyu Geng
9bdae40ad8 FIR IDE: check generated primary constructor
Currently the IDE skips checking the delegated constructor call because
the primary constructor is generated if it's declared with the class.
2021-03-11 14:30:54 +01:00
Svyatoslav Scherbina
2b994e1b66 Native: fix links in RELEASE_NOTES.md 2021-03-11 13:25:42 +00:00
Jinseong Jeon
55561fad37 FIR CFG: correct target and label for rethrow in try expression
^KT-45385 Fixed
2021-03-11 16:19:16 +03:00
Jinseong Jeon
4f20d2dccf Reproduce KT-45385: false positive MUST_BE_INITIALIZED_* after rethrow 2021-03-11 16:19:15 +03:00
Alexander Udalov
f4c63c8ba2 Update public API dump for stdlib 2021-03-11 14:17:33 +01:00
Michael Hoisie
83383ab9e5 Make kotlin.jvm.internal.DefaultConstructorMarker public
DefaultConstructorMarker is used as a marker to ensure that a
constructor is unique for companion objects. Prior to this change,
DefaultConstructorMarker was package private.

Being package private worked when calling the
DefaultConstructorMarker-marked constsructor using `invokespecial`,
likely because the JVM may not perform strict access checks in this
situation.

However, when access checks are performed, trying to call a
DefaultConstructorMarker-marked constructor will fail. This could happen
if the constructor was called using reflection or the MethodHandle API.
These APIs may be used by tools that perform bytecode instrumentation
on Kotlin JVM bytecode, such as Robolectric. It also caused problems
when using ByteBuddy validation.

Fixes https://youtrack.jetbrains.com/issue/KT-20869
2021-03-11 14:17:33 +01:00
Alexander Likhachev
78ed758704 [Gradle, K/N] Rework environment input on test tasks
Provide method `trackEnvironment` to track environment variables. Use only tracked environment variables as task input.
#KT-44059 Fixed
2021-03-11 15:44:37 +03:00
Alexander Likhachev
c5a9f20a6f [Gradle, K/N] Don't add unsupported targets to default fat frameworks task 2021-03-11 15:37:36 +03:00
Alexander Udalov
bc5fc122c5 JVM, JVM IR: report error if not all parts of multifile class are @JvmSynthetic
#KT-41884 Fixed
2021-03-11 13:33:25 +01:00
Alexander Udalov
75850a618c Minor, move bytecodeListing tests on JvmMultifileClass 2021-03-11 13:33:25 +01:00
Steven Schäfer
057ead358c JVM: Add FILE target to the JvmSynthetic annotation (#4149) 2021-03-11 13:33:07 +01:00
Victor Petukhov
b45d5abeb1 [jspecify] Change annotations' package from org.jspecify.annotations to org.jspecify.nullness, and DefaultNonNull to NullMarked
^KT-45409 Fixed
2021-03-11 15:32:14 +03:00
Alexander Likhachev
2ae7740c46 Set explicit lang version 1.3 for kotlin-native-utils & kotlin-util-io
Without explicit version we cannot use those modules in buildscripts with Gradle 6.8+ because Gradle doesn't set flag `skipPrereleaseCheck` (previously was named `skipMetadataVersionCheck`). This way we make it compatible with all supported versions of Gradle.
2021-03-11 14:12:38 +03:00
Alexander Likhachev
875cf1acf9 [Build] Add https://nodejs.org/dist to cache redirector
https://nodejs.org/dist repository is being added by Gradle Node plugin (com.github.node-gradle.node) at configuration phase in project.afterEvaluate so we need to wrap it once more to setup redirection later than repository is added
2021-03-11 14:12:37 +03:00
Alexander Likhachev
35df00e071 [Build] Apply :idea:idea-gradle classpath modification on JPS build only
This modification is incompatible with Gradle configuration cache
Relates to #KT-44611
2021-03-11 14:12:37 +03:00
Alexander Likhachev
57f5939f5e [Build] Fix configuration cache issues (part 7)
* Read system property "disable.verification.tasks" using Gradle provider
* Fix compileTestKotlin tasks with instrumented classes
* Read Gradle property "kotlin.test.maxParallelForks" using Gradle provider
* Change :idea:performanceTests jackson version to fixed ones
Relates to #KT-44611
2021-03-11 14:12:37 +03:00
Alexander Likhachev
6bd44df861 [Build] Fix configuration cache issues (part 6)
Make DexMethodCountStats task class, tasks :examples:kotlin-jsr223-daemon-local-eval-example:test,:idea:idea-fir:test, :idea:idea-fir-performance-tests:test, :idea:idea-frontend-fir:test, :idea:idea-frontend-fir:idea-fir-low-level-api:test, :kotlin-compiler-client-embeddable:test, :kotlin-compiler-embeddable:test, :kotlin-stdlib-js-ir:compileTestKotlinJs, :plugins:android-extensions-compiler:test, :plugins:parcelize:parcelize-compiler:test, :compiler:test compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:36 +03:00
Alexander Likhachev
1751b5182b [Build] Apply test distribution plugin conditionally only if it's needed
This buildscript logic change is motivated by configuration cache incompatibility of the plugin
Relates to #KT-44611
2021-03-11 14:12:36 +03:00
Alexander Likhachev
9be06da045 [Build] Make Gradle IT buildscript property reads via Gradle providers
Relates to #KT-44611
2021-03-11 14:12:36 +03:00
Alexander Likhachev
ca7dfe02b2 [Build] Replace deprecated configurations usage :tools:kotlinp 2021-03-11 14:12:36 +03:00
Alexander Likhachev
078849d133 [Build] Fix configuration cache issues with install task
* `install` task provided by `maven` plugin doesn't support configuration cache so replace `maven` plugin with `maven-publish` and use task that is subtype of PublishToMavenRepository. `maven-publish` partially support configuration cache, see https://github.com/gradle/gradle/issues/13468
* Apply `signing` plugin only if it really needed. The plugin doesn't support configuration cache. See https://github.com/gradle/gradle/issues/13470
Relates to #KT-44611
2021-03-11 14:12:35 +03:00
Alexander Likhachev
46b056c929 [Build] Fix configuration cache issues (part 5)
Make Project.configureFormInstrumentation and Task.useAndroidConfiguration extensions, :dependencies:android-sdk unzip tasks compatible with configuration cache

Relates to #KT-44611
2021-03-11 14:12:35 +03:00
Alexander Likhachev
da6544ae3c [Build] Make projectTest() extension compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:35 +03:00
Alexander Likhachev
ce49664366 [Build] Bump test-retry plugin version to 1.2.0 to support conf cache
Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev
74ab5c21a8 [Build] Fix configuration cache issues (part 4)
Make :kotlin-stdlib-js:prepareComparableSource, :kotlin-stdlib-js:prepareBuiltinsSources, :kotlin-stdlib-js:compileJs, :kotlin-stdlib-js:compileJs, :prepare:build.version:writeBuildNumber, :kotlin-compiler:distKotlinc compatible with configuration cache

Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev
5f10c98a38 [Build] Fix configuration cache issues (part 3)
* Make IntelliJInstrumentCodeTask compatible with configuration cache
* Make CoreXmlShadingTransformer compatible with configuration cache
* Make :kotlin-reflect:relocateCoreSources compatible with configuration cache
* Copy some properties to not capture it's owning object into lambda to support configuration cache
Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev
0e4e90dc13 [Build] Bump gradle-node-plugin version to 3.0.1 to support conf cache
:kotlin-test:kotlin-test-js:kotlin-test-js-it will still have old version as integration test run logic cannot be fully refactored to the new version (approximately till 3.1)
Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev
89a78a02d4 [Build] Make generatePom tasks compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:33 +03:00
Alexander Likhachev
2a49dcab47 [Build] Bump shadow plugin version to 6.1.0 to support configuration cache
Relates to #KT-44611
2021-03-11 14:12:33 +03:00
Alexander Likhachev
faf9600ff0 [Build] Fix configuration cache issues (part 2)
* Make WriteCopyrightToFile task compatible with configuration cache
* Configure shadowJar task in compatible with configuration cache way
* Configure compileJava9Java task in compatible with configuration cache way
* Make :js:js.tests buildscript compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:33 +03:00
Alexander Likhachev
ce19063e43 [Build] Disable reporters when configuration cache is enabled
Relates to #KT-44611
2021-03-11 14:12:32 +03:00
Alexander Likhachev
27956adf3f [Build] Fix configuration cache issues (part 1)
* Make `clean` task compatible with configuration cache
* Make Java compile instrumentation compatible with configuration cache
* Make settings.gradle compatible with configuration cache
* Initial work on making IntelliJInstrumentCodeTask compatible with configuration cache
* Make writeStdlibVersion task compatible with configuration cache
* Copy some properties to not capture it's owning object into lambda to support configuration cache

Relates to #KT-44611
2021-03-11 14:12:28 +03:00
Mikhail Glukhikh
111e67dc8d Use DECLARATION_NAME strategy for FirErrors.PRIMARY_CONSTRUCTOR_REQUIRED 2021-03-11 13:25:52 +03:00
Tianyu Geng
6e8bad6ef6 FIR: Implement data class constructor checker 2021-03-11 13:25:51 +03:00
Jinseong Jeon
d2da15e039 FIR checker: report (expected|unnecessary) lateinit 2021-03-11 13:25:51 +03:00
Dmitriy Novozhilov
815e40620c [FIR-IDE] Update testdata after previous changes about java nullability enhancement 2021-03-11 13:10:05 +03:00
Dmitriy Novozhilov
dceb8b2991 [FIR] Don't render ! at the end of ConeFlexibleType 2021-03-11 13:10:05 +03:00
Dmitriy Novozhilov
932eed2c14 [FIR] Fix determining nullability of arguments during enhancement 2021-03-11 13:10:05 +03:00
Dmitriy Novozhilov
65ea4e184a [FIR] Fix enhancement of FlexibleNullability and EnhancedNullability
- Add utilities to add new attribute to ConeAttributes
- Get rid of FlexibleNullability attribute (it can be easily inferred
    for any flexible type at any moment)
- Fix determining of EnhancedNullability attribute
2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov
0108f8a1b4 [FIR2IR] Don't create implicit not null cast on IrGetEnumValue 2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov
01e8019c4c [FIR] Properly handle friend modules in modularized and full-pipeline tests 2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov
f82c7c4678 [FIR] Cleanup session creation utils 2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov
f1edca8ca8 Move default gradle run configurations to separate folders 2021-03-11 13:10:03 +03:00
Dmitriy Novozhilov
8995fe36f3 Add .idea/csv-plugin.xml to .gitignore 2021-03-11 13:10:03 +03:00
Vladimir Dolzhenko
fbe18164b4 Filter KtAnnotated on-the-fly diagnostic elements
Relates to #KTIJ-1760
Relates to #KT-45254
2021-03-11 08:43:36 +00:00
Dmitriy Novozhilov
cba63f2c12 Regenerate tests 2021-03-11 00:58:26 +03:00
Dmitriy Novozhilov
74118930b4 [FE] Don't fail with exception if ESVisitor tries to visit ESLambda
#KT-45243 Fixed
2021-03-11 00:58:24 +03:00
Mikhail Glukhikh
f3135baba9 FIR: eliminate replaceSource usages in transformTypeToArrayType 2021-03-10 22:23:21 +03:00
Dmitry Petrov
0cca07fa19 Bump d8 used in box tests to 2.1.75 2021-03-10 21:04:12 +03:00
Dmitry Petrov
737fbe271f JVM_IR Do not generate generic signatures for lifted lambda methods 2021-03-10 21:04:11 +03:00
Dmitry Petrov
00a335129b JVM_IR indy-SAM: use '-Xsam-conversions=indy' if JVM 1.8+, LV 1.5+ 2021-03-10 21:04:08 +03:00
Alexander Udalov
bf844aa8e4 JVM IR: prevent behavior change with operator dot calls on literals
#KT-42321 Fixed
2021-03-10 18:46:30 +01:00
Alexander Udalov
c7498dd74d Remove one layer of nested exceptions in JVM backend 2021-03-10 18:44:11 +01:00
Igor Chevdar
6608ca5795 [K/N][IR] Fixed bug with parents setting
Fixes IR_VALIDATION warning as a side effect
2021-03-10 21:29:11 +05:00
Andrey Zinovyev
d941d41776 [KAPT] Fix broken incremental test 2021-03-10 17:30:10 +03:00
Alexander Udalov
a3a745e7a5 Fix ParallelBuildTest for Windows
Enclose file paths in raw strings. Otherwise in the string
"C:\Users\...", "\U" was detected as an illegal escape which led to an
error.
2021-03-10 14:25:06 +01:00
Roman Golyshev
5d0760c685 KT-44756 Ignore annotations on value parameters if metadata says so
There is a `gradle-api-impldep.jar` created by Gradle which contains
our nullability annotations, but relocated in the
`org.gradle.internal.impldep` package

In the deserialization process we use a `HAS_ANNOTATIONS` flag, and
if it is present on the declaration, we do not try to build annotations
for it, even when they are actually present and even when they are
relocated
(see usages of Flags.HAS_ANNOTATIONS in org.jetbrains.kotlin.serialization.deserialization.MemberDeserializer)

In the stubs builder we also use this HAS_ANNOTATIONS flag, but we did
not use it for the value parameters. This commit fixes that - now, if
the `org.jetbrains.annotations` packages are relocated, it should not
cause `Stub Mismatch Error` for the value parameters

Lets consider two possible cases:

1. If the value parameter has a user-defined annotation,
it will be marked as having annotations (HAS_ANNOTATIONS == true), and
both stubs and deserialized descriptors will have to
use all available annotations (even a relocated ones)

2. If, for example, the value parameter is of non-nullable type, it will
have a `@NotNull` annotation on it, but will be marked as having
no annotations at all (HAS_ANNOTATIONS == false), since `NotNull` is
considered as auxiliary by the compiler. Because of the flag, both stubs
and descriptors will ignore all present annotations (even if they were
relocated)

In the both cases, the stubs and the descriptors will completely match

^KT-44756 Fixed

See IDEA-262971 about fixing the Gradle jar and the details

N.B. This does not fixes the cases when `kotlin.Metadata` and similar
annotations are relocated (e.g. KT-25709)
2021-03-10 11:53:33 +00:00
Elena Lepilkina
f7099d34d4 [K/N] Fixed build of performance server project 2021-03-10 11:49:39 +00:00
Dmitriy Dolovov
cd2f55ea2f [Commonizer] Minor. Remove unused utility functions 2021-03-10 13:50:00 +03:00
Dmitriy Dolovov
c1848a26c3 [Commonizer] Use more compact interner based on THashSet 2021-03-10 13:49:54 +03:00
Dmitriy Dolovov
7a11c722c6 [Commonizer] Introduce CirProvided.ExportedForwardDeclarationClass
To represent classifiers that are actually exported forward declarations
2021-03-10 13:49:48 +03:00
Dmitriy Dolovov
76d93b6dca [Commonizer] Read exported forward declarations for every C-interop module 2021-03-10 13:49:41 +03:00
Ilya Gorbunov
a7fda66fa1 Suggest duration static factories instead of number extension properties
Introduce Duration companion functions to convert numbers to Duration.
Deprecate number extension properties and propose to use these
new functions instead.
2021-03-10 13:23:32 +03:00
9369 changed files with 289735 additions and 88642 deletions

2
.bunch
View File

@@ -1,4 +1,2 @@
202
201
as41_201
as42

5
.gitignore vendored
View File

@@ -32,6 +32,8 @@ build/
.idea/modules
.idea/runConfigurations/JPS_*.xml
.idea/runConfigurations/PILL_*.xml
.idea/runConfigurations/_FP_*.xml
.idea/runConfigurations/_MT_*.xml
.idea/libraries
.idea/modules.xml
.idea/gradle.xml
@@ -54,6 +56,7 @@ build/
.idea/artifacts/kotlin_test_js_ir_*
.idea/artifacts/kotlin_stdlib_wasm_*
.idea/jarRepositories.xml
.idea/csv-plugin.xml
kotlin-ultimate/
node_modules/
.rpt2_cache/
@@ -63,4 +66,4 @@ buildSrcTmp/
distTmp/
outTmp/
/test.output
/kotlin-native/dist
/kotlin-native/dist

View File

@@ -63,27 +63,6 @@
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
</codeStyleSettings>
<codeStyleSettings language="PROTO">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
@@ -101,4 +80,4 @@
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
</codeStyleSettings>
</code_scheme>
</component>
</component>

View File

@@ -0,0 +1,9 @@
<component name="ProjectDictionaryState">
<dictionary name="sebastiansellmair">
<words>
<w>cinterops</w>
<w>interops</w>
<w>klibrary</w>
</words>
</dictionary>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -21,4 +21,4 @@
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
</component>

View File

@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate FIR tree" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/compiler/fir/tree" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="generateTree" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
<method v="2" />
</configuration>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/kotlin-stdlib-gen" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true">
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -16,4 +16,4 @@
<option name="vmOptions" value="" />
</ExternalSystemSettings>
</configuration>
</component>
</component>

View File

@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: Commonizer" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--tests &quot;org.jetbrains.kotlin.gradle.CommonizerHierarchicalIT&quot; --tests &quot;org.jetbrains.kotlin.gradle.CommonizerIT&quot; --tests &quot;org.jetbrains.kotlin.commonizer.**&quot;" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":native:kotlin-klib-commonizer-api:test" />
<option value=":native:kotlin-klib-commonizer:test" />
<option value=":kotlin-gradle-plugin-integration-tests:test" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method v="2" />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/binary-compatibility-validator" />
@@ -18,4 +18,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -19,4 +19,4 @@
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
<method v="2" />
</configuration>
</component>
</component>

View File

@@ -106,6 +106,8 @@ To reproduce TeamCity build use `-Pteamcity=true` flag. Local builds don't run p
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
To build Kotlin/Native, see
[kotlin-native/README.md](kotlin-native/README.md#building-from-source).
### Building for different versions of IntelliJ IDEA and Android Studio
@@ -145,28 +147,27 @@ From this root project there are Run/Debug Configurations for running `IDEA` or
* Run the `IDEA` run configuration in the project
* A child IntelliJ IDEA with the Kotlin plugin will then startup
### Including into composite build
### Dependency verification
To include kotlin compiler into [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) you need to define `dependencySubstitution` for `kotlin-compiler` module in `settings.gradle.kts`
We have a [dependencies verification](https://docs.gradle.org/current/userguide/dependency_verification.html) feature enabled in the
repository for all Gradle builds. Gradle will check hashes (md5 and sha256) of used dependencies and will fail builds with
`Dependency verification failed` errors when local artifacts are absent or have different hashes listed in the
[verification-metadata.xml](https://github.com/JetBrains/kotlin/blob/master/gradle/verification-metadata.xml) file.
```Kotlin
includeBuild("/path/to/kotlin") {
dependencySubstitution {
substitute(module("org.jetbrains.kotlin:kotlin-compiler"))
.with(project(":include:kotlin-compiler"))
}
}
```
It's expected that `verification-metadata.xml` should only be updated with the commits that modify the build. There are some tips how
to perform such updates:
or in `settings.gradle`
- Use auto-generation for getting an initial list of new hashes (verify updates relate to you changes).
```Groovy
includeBuild('/path/to/kotlin') {
dependencySubstitution {
substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler')
}
}
```
`./gradlew -M sha256,md5 help`
*(any other task may be used instead of `help`)*
- Consider removing old versions from the file if you are updating dependencies.
- Leave meaningful `origin` attribute (instead of `Generated by Gradle`) if you did some manual verification of the artifact.
- Always do manual verification if several hashes are needed and a new `also-trust` tag has to be added.
- If youre adding a dependency with OS mentioning in an artifact name (`darwin`, `mac`, `osx`, `linux`, `windows`), remember to add
counterparts for other platforms.
# License
Kotlin is distributed under the terms of the Apache License (Version 2.0). See [license folder](license/README.md) for details.

View File

@@ -1,36 +1,11 @@
import kotlinx.benchmark.gradle.benchmark
val benchmarks_version = "0.2.0-dev-7"
buildscript {
val benchmarks_version = "0.2.0-dev-7"
repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
}
}
dependencies {
classpath("org.jetbrains.kotlinx:kotlinx.benchmark.gradle:$benchmarks_version")
}
}
apply(plugin = "kotlinx.benchmark")
val benchmarks_version = "0.3.0"
plugins {
java
kotlin("jvm")
}
repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
}
id("org.jetbrains.kotlinx.benchmark") version "0.3.0"
}
dependencies {
@@ -42,7 +17,7 @@ dependencies {
compile(jpsStandalone()) { includeJars("jps-model") }
compile(intellijPluginDep("java"))
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
compile("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:$benchmarks_version")
}
sourceSets {
@@ -92,18 +67,16 @@ benchmark {
}
}
tasks.named("classes") {
doLast {
tasks.named("mainBenchmarkJar", Zip::class.java) {
isZip64 = true
archiveName = "benchmarks.jar"
}
listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark").forEach {
tasks.named(it, JavaExec::class.java) {
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
}
}
}
tasks.matching { it is Zip && it.name == "mainBenchmarkJar" }.configureEach {
this as Zip
isZip64 = true
archiveFileName.set("benchmarks.jar")
}
val benchmarkTasks = listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark")
tasks.matching { it is JavaExec && it.name in benchmarkTasks }.configureEach {
this as JavaExec
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
}
tasks.register<JavaExec>("runBenchmark") {

View File

@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.context.withProject
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
import org.jetbrains.kotlin.fir.createSession
import org.jetbrains.kotlin.fir.createSessionForTests
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
@@ -150,7 +150,7 @@ abstract class AbstractSimpleFileBenchmark {
private fun analyzeGreenFileIr(bh: Blackhole) {
val scope = GlobalSearchScope.filesScope(env.project, listOf(file.virtualFile))
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
val session = createSession(env, scope)
val session = createSessionForTests(env, scope)
val firProvider = session.firProvider as FirProviderImpl
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)

View File

@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.metadata.jvm.deserialization.ModuleMapping
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.org.objectweb.asm.*
@@ -399,7 +400,9 @@ open class IncrementalJvmCache(
}
for (const in oldMap.keys + newMap.keys) {
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(), const, oldMap[const], newMap[const])
//Constant can be declared via companion object or via const field declaration
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(companion = true), const, oldMap[const], newMap[const])
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(companion = false), const, oldMap[const], newMap[const])
}
}
@@ -599,11 +602,12 @@ sealed class ChangeInfo(val fqName: FqName) {
}
}
private fun LocalFileKotlinClass.scopeFqName() =
when (classHeader.kind) {
KotlinClassHeader.Kind.CLASS -> className.fqNameForClassNameWithoutDollars
else -> className.packageFqName
private fun LocalFileKotlinClass.scopeFqName(companion: Boolean = false) = when (classHeader.kind) {
KotlinClassHeader.Kind.CLASS -> {
className.fqNameForClassNameWithoutDollars.let { if (companion) it.child(DEFAULT_NAME_FOR_COMPANION_OBJECT) else it }
}
else -> className.packageFqName
}
fun ByteArray.md5(): Long {
val d = MessageDigest.getInstance("MD5").digest(this)!!

View File

@@ -182,6 +182,21 @@ open class ProtoCompareGenerated(
if (!checkEqualsClassSealedSubclassFqName(old, new)) return false
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) return false
if (old.hasInlineClassUnderlyingPropertyName()) {
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) return false
}
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) return false
if (old.hasInlineClassUnderlyingType()) {
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) return false
}
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) return false
if (old.hasInlineClassUnderlyingTypeId()) {
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) return false
}
if (!checkEqualsClassVersionRequirement(old, new)) return false
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
@@ -266,6 +281,9 @@ open class ProtoCompareGenerated(
TYPE_ALIAS_LIST,
ENUM_ENTRY_LIST,
SEALED_SUBCLASS_FQ_NAME_LIST,
INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
INLINE_CLASS_UNDERLYING_TYPE,
INLINE_CLASS_UNDERLYING_TYPE_ID,
VERSION_REQUIREMENT_LIST,
VERSION_REQUIREMENT_TABLE,
JVM_EXT_CLASS_MODULE_NAME,
@@ -314,6 +332,21 @@ open class ProtoCompareGenerated(
if (!checkEqualsClassSealedSubclassFqName(old, new)) result.add(ProtoBufClassKind.SEALED_SUBCLASS_FQ_NAME_LIST)
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
if (old.hasInlineClassUnderlyingPropertyName()) {
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
}
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
if (old.hasInlineClassUnderlyingType()) {
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
}
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
if (old.hasInlineClassUnderlyingTypeId()) {
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
}
if (!checkEqualsClassVersionRequirement(old, new)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_LIST)
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
@@ -1728,6 +1761,18 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + fqNameIndexes(getSealedSubclassFqName(i))
}
if (hasInlineClassUnderlyingPropertyName()) {
hashCode = 31 * hashCode + stringIndexes(inlineClassUnderlyingPropertyName)
}
if (hasInlineClassUnderlyingType()) {
hashCode = 31 * hashCode + inlineClassUnderlyingType.hashCode(stringIndexes, fqNameIndexes, typeById)
}
if (hasInlineClassUnderlyingTypeId()) {
hashCode = 31 * hashCode + typeById(inlineClassUnderlyingTypeId).hashCode(stringIndexes, fqNameIndexes, typeById)
}
for(i in 0..versionRequirementCount - 1) {
hashCode = 31 * hashCode + getVersionRequirement(i)
}

View File

@@ -290,6 +290,11 @@ class DifferenceCalculatorForClass(
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE,
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID -> {
isClassAffected = true
}
}
}

View File

@@ -23,7 +23,8 @@ data class BuildLogFinder(
private val isGradleEnabled: Boolean = false,
private val isJsEnabled: Boolean = false,
private val isScopeExpansionEnabled: Boolean = false,
private val isKlibEnabled: Boolean = false
private val isKlibEnabled: Boolean = false,
private val isFirEnabled: Boolean = false
) {
companion object {
private const val JS_LOG = "js-build.log"
@@ -32,6 +33,8 @@ data class BuildLogFinder(
private const val GRADLE_LOG = "gradle-build.log"
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
const val JS_JPS_LOG = "js-jps-build.log"
private const val FIR_LOG = "fir-build.log"
private const val GRADLE_FIR_LOG = "gradle-fir-build.log"
private const val SIMPLE_LOG = "build.log"
fun isJpsLogFile(file: File): Boolean =
@@ -45,6 +48,8 @@ data class BuildLogFinder(
isScopeExpansionEnabled && SCOPE_EXPANDING_LOG in files -> SCOPE_EXPANDING_LOG
isKlibEnabled && KLIB_LOG in files -> KLIB_LOG
isJsEnabled && JS_LOG in files -> JS_LOG
isGradleEnabled && isFirEnabled && GRADLE_FIR_LOG in files -> GRADLE_FIR_LOG
isFirEnabled && FIR_LOG in files -> FIR_LOG
isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG
isJsEnabled && JS_JPS_LOG in files -> JS_JPS_LOG
isDataContainerBuildLogEnabled && DATA_CONTAINER_LOG in files -> DATA_CONTAINER_LOG

View File

@@ -10,17 +10,21 @@ public final class DebugKlibMetadataProtoBuf {
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.packageFqName);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classFile);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classKdoc);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classUniqId);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorKdoc);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorUniqId);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionFile);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionKdoc);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionUniqId);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyGetterAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertySetterAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyFile);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyKdoc);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyUniqId);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.enumEntryOrdinal);
@@ -3163,6 +3167,17 @@ public final class DebugKlibMetadataProtoBuf {
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int CLASS_KDOC_FIELD_NUMBER = 176;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
java.lang.String> classKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.String.class,
null);
public static final int CLASS_UNIQ_ID_FIELD_NUMBER = 171;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
@@ -3185,6 +3200,17 @@ public final class DebugKlibMetadataProtoBuf {
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int CONSTRUCTOR_KDOC_FIELD_NUMBER = 173;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
java.lang.String> constructorKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.String.class,
null);
public static final int CONSTRUCTOR_UNIQ_ID_FIELD_NUMBER = 172;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
@@ -3218,6 +3244,17 @@ public final class DebugKlibMetadataProtoBuf {
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int FUNCTION_KDOC_FIELD_NUMBER = 174;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.lang.String> functionKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.String.class,
null);
public static final int FUNCTION_UNIQ_ID_FIELD_NUMBER = 173;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
@@ -3284,6 +3321,17 @@ public final class DebugKlibMetadataProtoBuf {
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int PROPERTY_KDOC_FIELD_NUMBER = 180;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.lang.String> propertyKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.String.class,
null);
public static final int PROPERTY_UNIQ_ID_FIELD_NUMBER = 179;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
@@ -3480,72 +3528,79 @@ public final class DebugKlibMetadataProtoBuf {
".metadata.Class\030\252\001 \003(\0132).org.jetbrains.k" +
"otlin.metadata.Annotation:?\n\nclass_file\022",
"$.org.jetbrains.kotlin.metadata.Class\030\257\001" +
" \001(\005B\004\200\265\030\001:u\n\rclass_uniq_id\022$.org.jetbra" +
"ins.kotlin.metadata.Class\030\253\001 \001(\01327.org.j" +
"etbrains.kotlin.library.metadata.Descrip" +
"torUniqId:v\n\026constructor_annotation\022*.or" +
"g.jetbrains.kotlin.metadata.Constructor\030" +
"\252\001 \003(\0132).org.jetbrains.kotlin.metadata.A" +
"nnotation:\201\001\n\023constructor_uniq_id\022*.org." +
"jetbrains.kotlin.metadata.Constructor\030\254\001" +
" \001(\01327.org.jetbrains.kotlin.library.meta",
"data.DescriptorUniqId:p\n\023function_annota" +
"tion\022\'.org.jetbrains.kotlin.metadata.Fun" +
"ction\030\252\001 \003(\0132).org.jetbrains.kotlin.meta" +
"data.Annotation:E\n\rfunction_file\022\'.org.j" +
"etbrains.kotlin.metadata.Function\030\254\001 \001(\005" +
"B\004\200\265\030\001:{\n\020function_uniq_id\022\'.org.jetbrai" +
"ns.kotlin.metadata.Function\030\255\001 \001(\01327.org" +
".jetbrains.kotlin.library.metadata.Descr" +
"iptorUniqId:p\n\023property_annotation\022\'.org" +
".jetbrains.kotlin.metadata.Property\030\252\001 \003",
"(\0132).org.jetbrains.kotlin.metadata.Annot" +
"ation:w\n\032property_getter_annotation\022\'.or" +
"g.jetbrains.kotlin.metadata.Property\030\261\001 " +
"\003(\0132).org.jetbrains.kotlin.metadata.Anno" +
"tation:w\n\032property_setter_annotation\022\'.o" +
"rg.jetbrains.kotlin.metadata.Property\030\262\001" +
" \003(\0132).org.jetbrains.kotlin.metadata.Ann" +
"otation:~\n\022compile_time_value\022\'.org.jetb" +
"rains.kotlin.metadata.Property\030\255\001 \001(\01328." +
"org.jetbrains.kotlin.metadata.Annotation",
".Argument.Value:E\n\rproperty_file\022\'.org.j" +
"etbrains.kotlin.metadata.Property\030\260\001 \001(\005" +
"B\004\200\265\030\001:{\n\020property_uniq_id\022\'.org.jetbrai" +
"ns.kotlin.metadata.Property\030\263\001 \001(\01327.org" +
".jetbrains.kotlin.library.metadata.Descr" +
"iptorUniqId:s\n\025enum_entry_annotation\022(.o" +
"rg.jetbrains.kotlin.metadata.EnumEntry\030\252" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:E\n\022enum_entry_ordinal\022(.org.jet" +
"brains.kotlin.metadata.EnumEntry\030\253\001 \001(\005:",
"~\n\022enum_entry_uniq_id\022(.org.jetbrains.ko" +
"tlin.metadata.EnumEntry\030\254\001 \001(\01327.org.jet" +
"brains.kotlin.library.metadata.Descripto" +
"rUniqId:w\n\024parameter_annotation\022-.org.je" +
"tbrains.kotlin.metadata.ValueParameter\030\252" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:h\n\017type_annotation\022#.org.jetbra" +
"ins.kotlin.metadata.Type\030\252\001 \003(\0132).org.je" +
"tbrains.kotlin.metadata.Annotation:{\n\031ty" +
"pe_parameter_annotation\022,.org.jetbrains.",
"kotlin.metadata.TypeParameter\030\252\001 \003(\0132).o" +
"rg.jetbrains.kotlin.metadata.Annotation:" +
"\202\001\n\022type_param_uniq_id\022,.org.jetbrains.k" +
"otlin.metadata.TypeParameter\030\253\001 \001(\01327.or" +
"g.jetbrains.kotlin.library.metadata.Desc" +
"riptorUniqId:U\n\026package_fragment_files\022." +
".org.jetbrains.kotlin.metadata.PackageFr" +
"agment\030\252\001 \003(\005B\004\200\265\030\001:A\n\010is_empty\022..org.je" +
"tbrains.kotlin.metadata.PackageFragment\030" +
"\254\001 \001(\010:@\n\007fq_name\022..org.jetbrains.kotlin",
".metadata.PackageFragment\030\255\001 \001(\t:G\n\nclas" +
"s_name\022..org.jetbrains.kotlin.metadata.P" +
"ackageFragment\030\256\001 \003(\005B\002\020\001:~\n\022type_alias_" +
"uniq_id\022(.org.jetbrains.kotlin.metadata." +
"TypeAlias\030\203\001 \001(\01327.org.jetbrains.kotlin." +
"library.metadata.DescriptorUniqIdB\033B\031Deb" +
"ugKlibMetadataProtoBuf"
" \001(\005B\004\200\265\030\001:?\n\nclass_kdoc\022$.org.jetbrains" +
".kotlin.metadata.Class\030\260\001 \001(\tB\004\200\265\030\001:u\n\rc" +
"lass_uniq_id\022$.org.jetbrains.kotlin.meta" +
"data.Class\030\253\001 \001(\01327.org.jetbrains.kotlin" +
".library.metadata.DescriptorUniqId:v\n\026co" +
"nstructor_annotation\022*.org.jetbrains.kot" +
"lin.metadata.Constructor\030\252\001 \003(\0132).org.je" +
"tbrains.kotlin.metadata.Annotation:K\n\020co" +
"nstructor_kdoc\022*.org.jetbrains.kotlin.me",
"tadata.Constructor\030\255\001 \001(\tB\004\200\265\030\001:\201\001\n\023cons" +
"tructor_uniq_id\022*.org.jetbrains.kotlin.m" +
"etadata.Constructor\030\254\001 \001(\01327.org.jetbrai" +
"ns.kotlin.library.metadata.DescriptorUni" +
"qId:p\n\023function_annotation\022\'.org.jetbrai" +
"ns.kotlin.metadata.Function\030\252\001 \003(\0132).org" +
".jetbrains.kotlin.metadata.Annotation:E\n" +
"\rfunction_file\022\'.org.jetbrains.kotlin.me" +
"tadata.Function\030\254\001 \001(\005B\004\200\265\030\001:E\n\rfunction" +
"_kdoc\022\'.org.jetbrains.kotlin.metadata.Fu",
"nction\030\256\001 \001(\tB\004\200\265\030\001:{\n\020function_uniq_id\022" +
"\'.org.jetbrains.kotlin.metadata.Function" +
"\030\255\001 \001(\01327.org.jetbrains.kotlin.library.m" +
"etadata.DescriptorUniqId:p\n\023property_ann" +
"otation\022\'.org.jetbrains.kotlin.metadata." +
"Property\030\252\001 \003(\0132).org.jetbrains.kotlin.m" +
"etadata.Annotation:w\n\032property_getter_an" +
"notation\022\'.org.jetbrains.kotlin.metadata" +
".Property\030\261\001 \003(\0132).org.jetbrains.kotlin." +
"metadata.Annotation:w\n\032property_setter_a",
"nnotation\022\'.org.jetbrains.kotlin.metadat" +
"a.Property\030\262\001 \003(\0132).org.jetbrains.kotlin" +
".metadata.Annotation:~\n\022compile_time_val" +
"ue\022\'.org.jetbrains.kotlin.metadata.Prope" +
"rty\030\255\001 \001(\01328.org.jetbrains.kotlin.metada" +
"ta.Annotation.Argument.Value:E\n\rproperty" +
"_file\022\'.org.jetbrains.kotlin.metadata.Pr" +
"operty\030\260\001 \001(\005B\004\200\265\030\001:E\n\rproperty_kdoc\022\'.o" +
"rg.jetbrains.kotlin.metadata.Property\030\264\001" +
" \001(\tB\004\200\265\030\001:{\n\020property_uniq_id\022\'.org.jet",
"brains.kotlin.metadata.Property\030\263\001 \001(\01327" +
".org.jetbrains.kotlin.library.metadata.D" +
"escriptorUniqId:s\n\025enum_entry_annotation" +
"\022(.org.jetbrains.kotlin.metadata.EnumEnt" +
"ry\030\252\001 \003(\0132).org.jetbrains.kotlin.metadat" +
"a.Annotation:E\n\022enum_entry_ordinal\022(.org" +
".jetbrains.kotlin.metadata.EnumEntry\030\253\001 " +
"\001(\005:~\n\022enum_entry_uniq_id\022(.org.jetbrain" +
"s.kotlin.metadata.EnumEntry\030\254\001 \001(\01327.org" +
".jetbrains.kotlin.library.metadata.Descr",
"iptorUniqId:w\n\024parameter_annotation\022-.or" +
"g.jetbrains.kotlin.metadata.ValueParamet" +
"er\030\252\001 \003(\0132).org.jetbrains.kotlin.metadat" +
"a.Annotation:h\n\017type_annotation\022#.org.je" +
"tbrains.kotlin.metadata.Type\030\252\001 \003(\0132).or" +
"g.jetbrains.kotlin.metadata.Annotation:{" +
"\n\031type_parameter_annotation\022,.org.jetbra" +
"ins.kotlin.metadata.TypeParameter\030\252\001 \003(\013" +
"2).org.jetbrains.kotlin.metadata.Annotat" +
"ion:\202\001\n\022type_param_uniq_id\022,.org.jetbrai",
"ns.kotlin.metadata.TypeParameter\030\253\001 \001(\0132" +
"7.org.jetbrains.kotlin.library.metadata." +
"DescriptorUniqId:U\n\026package_fragment_fil" +
"es\022..org.jetbrains.kotlin.metadata.Packa" +
"geFragment\030\252\001 \003(\005B\004\200\265\030\001:A\n\010is_empty\022..or" +
"g.jetbrains.kotlin.metadata.PackageFragm" +
"ent\030\254\001 \001(\010:@\n\007fq_name\022..org.jetbrains.ko" +
"tlin.metadata.PackageFragment\030\255\001 \001(\t:G\n\n" +
"class_name\022..org.jetbrains.kotlin.metada" +
"ta.PackageFragment\030\256\001 \003(\005B\002\020\001:~\n\022type_al",
"ias_uniq_id\022(.org.jetbrains.kotlin.metad" +
"ata.TypeAlias\030\203\001 \001(\01327.org.jetbrains.kot" +
"lin.library.metadata.DescriptorUniqIdB\033B" +
"\031DebugKlibMetadataProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -3582,30 +3637,34 @@ public final class DebugKlibMetadataProtoBuf {
packageFqName.internalInit(descriptor.getExtensions().get(0));
classAnnotation.internalInit(descriptor.getExtensions().get(1));
classFile.internalInit(descriptor.getExtensions().get(2));
classUniqId.internalInit(descriptor.getExtensions().get(3));
constructorAnnotation.internalInit(descriptor.getExtensions().get(4));
constructorUniqId.internalInit(descriptor.getExtensions().get(5));
functionAnnotation.internalInit(descriptor.getExtensions().get(6));
functionFile.internalInit(descriptor.getExtensions().get(7));
functionUniqId.internalInit(descriptor.getExtensions().get(8));
propertyAnnotation.internalInit(descriptor.getExtensions().get(9));
propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(10));
propertySetterAnnotation.internalInit(descriptor.getExtensions().get(11));
compileTimeValue.internalInit(descriptor.getExtensions().get(12));
propertyFile.internalInit(descriptor.getExtensions().get(13));
propertyUniqId.internalInit(descriptor.getExtensions().get(14));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(15));
enumEntryOrdinal.internalInit(descriptor.getExtensions().get(16));
enumEntryUniqId.internalInit(descriptor.getExtensions().get(17));
parameterAnnotation.internalInit(descriptor.getExtensions().get(18));
typeAnnotation.internalInit(descriptor.getExtensions().get(19));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(20));
typeParamUniqId.internalInit(descriptor.getExtensions().get(21));
packageFragmentFiles.internalInit(descriptor.getExtensions().get(22));
isEmpty.internalInit(descriptor.getExtensions().get(23));
fqName.internalInit(descriptor.getExtensions().get(24));
className.internalInit(descriptor.getExtensions().get(25));
typeAliasUniqId.internalInit(descriptor.getExtensions().get(26));
classKdoc.internalInit(descriptor.getExtensions().get(3));
classUniqId.internalInit(descriptor.getExtensions().get(4));
constructorAnnotation.internalInit(descriptor.getExtensions().get(5));
constructorKdoc.internalInit(descriptor.getExtensions().get(6));
constructorUniqId.internalInit(descriptor.getExtensions().get(7));
functionAnnotation.internalInit(descriptor.getExtensions().get(8));
functionFile.internalInit(descriptor.getExtensions().get(9));
functionKdoc.internalInit(descriptor.getExtensions().get(10));
functionUniqId.internalInit(descriptor.getExtensions().get(11));
propertyAnnotation.internalInit(descriptor.getExtensions().get(12));
propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(13));
propertySetterAnnotation.internalInit(descriptor.getExtensions().get(14));
compileTimeValue.internalInit(descriptor.getExtensions().get(15));
propertyFile.internalInit(descriptor.getExtensions().get(16));
propertyKdoc.internalInit(descriptor.getExtensions().get(17));
propertyUniqId.internalInit(descriptor.getExtensions().get(18));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(19));
enumEntryOrdinal.internalInit(descriptor.getExtensions().get(20));
enumEntryUniqId.internalInit(descriptor.getExtensions().get(21));
parameterAnnotation.internalInit(descriptor.getExtensions().get(22));
typeAnnotation.internalInit(descriptor.getExtensions().get(23));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(24));
typeParamUniqId.internalInit(descriptor.getExtensions().get(25));
packageFragmentFiles.internalInit(descriptor.getExtensions().get(26));
isEmpty.internalInit(descriptor.getExtensions().get(27));
fqName.internalInit(descriptor.getExtensions().get(28));
className.internalInit(descriptor.getExtensions().get(29));
typeAliasUniqId.internalInit(descriptor.getExtensions().get(30));
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry =
org.jetbrains.kotlin.protobuf.ExtensionRegistry.newInstance();
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipMessageInComparison);
@@ -3613,6 +3672,10 @@ public final class DebugKlibMetadataProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalUpdateFileDescriptor(descriptor, registry);
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();

View File

@@ -10347,6 +10347,37 @@ public final class DebugProtoBuf {
*/
int getSealedSubclassFqName(int index);
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
boolean hasInlineClassUnderlyingPropertyName();
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
int getInlineClassUnderlyingPropertyName();
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
boolean hasInlineClassUnderlyingType();
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType();
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder();
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
boolean hasInlineClassUnderlyingTypeId();
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
int getInlineClassUnderlyingTypeId();
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
*/
@@ -10585,9 +10616,32 @@ public final class DebugProtoBuf {
input.popLimit(limit);
break;
}
case 136: {
bitField0_ |= 0x00000008;
inlineClassUnderlyingPropertyName_ = input.readInt32();
break;
}
case 146: {
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder subBuilder = null;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
subBuilder = inlineClassUnderlyingType_.toBuilder();
}
inlineClassUnderlyingType_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(inlineClassUnderlyingType_);
inlineClassUnderlyingType_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000010;
break;
}
case 152: {
bitField0_ |= 0x00000020;
inlineClassUnderlyingTypeId_ = input.readInt32();
break;
}
case 242: {
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder subBuilder = null;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
if (((bitField0_ & 0x00000040) == 0x00000040)) {
subBuilder = typeTable_.toBuilder();
}
typeTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.PARSER, extensionRegistry);
@@ -10595,13 +10649,13 @@ public final class DebugProtoBuf {
subBuilder.mergeFrom(typeTable_);
typeTable_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000040;
break;
}
case 248: {
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00004000;
mutable_bitField0_ |= 0x00020000;
}
versionRequirement_.add(input.readInt32());
break;
@@ -10609,9 +10663,9 @@ public final class DebugProtoBuf {
case 250: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000) && input.getBytesUntilLimit() > 0) {
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000) && input.getBytesUntilLimit() > 0) {
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00004000;
mutable_bitField0_ |= 0x00020000;
}
while (input.getBytesUntilLimit() > 0) {
versionRequirement_.add(input.readInt32());
@@ -10621,7 +10675,7 @@ public final class DebugProtoBuf {
}
case 258: {
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder subBuilder = null;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
if (((bitField0_ & 0x00000080) == 0x00000080)) {
subBuilder = versionRequirementTable_.toBuilder();
}
versionRequirementTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.PARSER, extensionRegistry);
@@ -10629,7 +10683,7 @@ public final class DebugProtoBuf {
subBuilder.mergeFrom(versionRequirementTable_);
versionRequirementTable_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000010;
bitField0_ |= 0x00000080;
break;
}
}
@@ -10670,7 +10724,7 @@ public final class DebugProtoBuf {
if (((mutable_bitField0_ & 0x00001000) == 0x00001000)) {
sealedSubclassFqName_ = java.util.Collections.unmodifiableList(sealedSubclassFqName_);
}
if (((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
if (((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
}
this.unknownFields = unknownFields.build();
@@ -11225,13 +11279,64 @@ public final class DebugProtoBuf {
}
private int sealedSubclassFqNameMemoizedSerializedSize = -1;
public static final int INLINE_CLASS_UNDERLYING_PROPERTY_NAME_FIELD_NUMBER = 17;
private int inlineClassUnderlyingPropertyName_;
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public boolean hasInlineClassUnderlyingPropertyName() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public int getInlineClassUnderlyingPropertyName() {
return inlineClassUnderlyingPropertyName_;
}
public static final int INLINE_CLASS_UNDERLYING_TYPE_FIELD_NUMBER = 18;
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_;
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public boolean hasInlineClassUnderlyingType() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
return inlineClassUnderlyingType_;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
return inlineClassUnderlyingType_;
}
public static final int INLINE_CLASS_UNDERLYING_TYPE_ID_FIELD_NUMBER = 19;
private int inlineClassUnderlyingTypeId_;
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public boolean hasInlineClassUnderlyingTypeId() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public int getInlineClassUnderlyingTypeId() {
return inlineClassUnderlyingTypeId_;
}
public static final int TYPE_TABLE_FIELD_NUMBER = 30;
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_;
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
*/
public boolean hasTypeTable() {
return ((bitField0_ & 0x00000008) == 0x00000008);
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
@@ -11286,7 +11391,7 @@ public final class DebugProtoBuf {
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
*/
public boolean hasVersionRequirementTable() {
return ((bitField0_ & 0x00000010) == 0x00000010);
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
@@ -11315,6 +11420,9 @@ public final class DebugProtoBuf {
typeAlias_ = java.util.Collections.emptyList();
enumEntry_ = java.util.Collections.emptyList();
sealedSubclassFqName_ = java.util.Collections.emptyList();
inlineClassUnderlyingPropertyName_ = 0;
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
inlineClassUnderlyingTypeId_ = 0;
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
versionRequirement_ = java.util.Collections.emptyList();
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
@@ -11371,6 +11479,12 @@ public final class DebugProtoBuf {
return false;
}
}
if (hasInlineClassUnderlyingType()) {
if (!getInlineClassUnderlyingType().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasTypeTable()) {
if (!getTypeTable().isInitialized()) {
memoizedIsInitialized = 0;
@@ -11443,12 +11557,21 @@ public final class DebugProtoBuf {
output.writeInt32NoTag(sealedSubclassFqName_.get(i));
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeInt32(17, inlineClassUnderlyingPropertyName_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeMessage(18, inlineClassUnderlyingType_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeInt32(19, inlineClassUnderlyingTypeId_);
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeMessage(30, typeTable_);
}
for (int i = 0; i < versionRequirement_.size(); i++) {
output.writeInt32(31, versionRequirement_.get(i));
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeMessage(32, versionRequirementTable_);
}
extensionWriter.writeUntil(19000, output);
@@ -11544,6 +11667,18 @@ public final class DebugProtoBuf {
sealedSubclassFqNameMemoizedSerializedSize = dataSize;
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(17, inlineClassUnderlyingPropertyName_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(18, inlineClassUnderlyingType_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(19, inlineClassUnderlyingTypeId_);
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(30, typeTable_);
}
@@ -11556,7 +11691,7 @@ public final class DebugProtoBuf {
size += dataSize;
size += 2 * getVersionRequirementList().size();
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(32, versionRequirementTable_);
}
@@ -11678,6 +11813,7 @@ public final class DebugProtoBuf {
getPropertyFieldBuilder();
getTypeAliasFieldBuilder();
getEnumEntryFieldBuilder();
getInlineClassUnderlyingTypeFieldBuilder();
getTypeTableFieldBuilder();
getVersionRequirementTableFieldBuilder();
}
@@ -11742,20 +11878,30 @@ public final class DebugProtoBuf {
}
sealedSubclassFqName_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00001000);
inlineClassUnderlyingPropertyName_ = 0;
bitField0_ = (bitField0_ & ~0x00002000);
if (inlineClassUnderlyingTypeBuilder_ == null) {
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
} else {
inlineClassUnderlyingTypeBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00004000);
inlineClassUnderlyingTypeId_ = 0;
bitField0_ = (bitField0_ & ~0x00008000);
if (typeTableBuilder_ == null) {
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
} else {
typeTableBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00002000);
bitField0_ = (bitField0_ & ~0x00010000);
versionRequirement_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00004000);
bitField0_ = (bitField0_ & ~0x00020000);
if (versionRequirementTableBuilder_ == null) {
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
} else {
versionRequirementTableBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00008000);
bitField0_ = (bitField0_ & ~0x00040000);
return this;
}
@@ -11877,18 +12023,34 @@ public final class DebugProtoBuf {
if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
to_bitField0_ |= 0x00000008;
}
result.inlineClassUnderlyingPropertyName_ = inlineClassUnderlyingPropertyName_;
if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
to_bitField0_ |= 0x00000010;
}
if (inlineClassUnderlyingTypeBuilder_ == null) {
result.inlineClassUnderlyingType_ = inlineClassUnderlyingType_;
} else {
result.inlineClassUnderlyingType_ = inlineClassUnderlyingTypeBuilder_.build();
}
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
to_bitField0_ |= 0x00000020;
}
result.inlineClassUnderlyingTypeId_ = inlineClassUnderlyingTypeId_;
if (((from_bitField0_ & 0x00010000) == 0x00010000)) {
to_bitField0_ |= 0x00000040;
}
if (typeTableBuilder_ == null) {
result.typeTable_ = typeTable_;
} else {
result.typeTable_ = typeTableBuilder_.build();
}
if (((bitField0_ & 0x00004000) == 0x00004000)) {
if (((bitField0_ & 0x00020000) == 0x00020000)) {
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
bitField0_ = (bitField0_ & ~0x00004000);
bitField0_ = (bitField0_ & ~0x00020000);
}
result.versionRequirement_ = versionRequirement_;
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
to_bitField0_ |= 0x00000010;
if (((from_bitField0_ & 0x00040000) == 0x00040000)) {
to_bitField0_ |= 0x00000080;
}
if (versionRequirementTableBuilder_ == null) {
result.versionRequirementTable_ = versionRequirementTable_;
@@ -12132,13 +12294,22 @@ public final class DebugProtoBuf {
}
onChanged();
}
if (other.hasInlineClassUnderlyingPropertyName()) {
setInlineClassUnderlyingPropertyName(other.getInlineClassUnderlyingPropertyName());
}
if (other.hasInlineClassUnderlyingType()) {
mergeInlineClassUnderlyingType(other.getInlineClassUnderlyingType());
}
if (other.hasInlineClassUnderlyingTypeId()) {
setInlineClassUnderlyingTypeId(other.getInlineClassUnderlyingTypeId());
}
if (other.hasTypeTable()) {
mergeTypeTable(other.getTypeTable());
}
if (!other.versionRequirement_.isEmpty()) {
if (versionRequirement_.isEmpty()) {
versionRequirement_ = other.versionRequirement_;
bitField0_ = (bitField0_ & ~0x00004000);
bitField0_ = (bitField0_ & ~0x00020000);
} else {
ensureVersionRequirementIsMutable();
versionRequirement_.addAll(other.versionRequirement_);
@@ -12200,6 +12371,12 @@ public final class DebugProtoBuf {
return false;
}
}
if (hasInlineClassUnderlyingType()) {
if (!getInlineClassUnderlyingType().isInitialized()) {
return false;
}
}
if (hasTypeTable()) {
if (!getTypeTable().isInitialized()) {
@@ -14258,6 +14435,186 @@ public final class DebugProtoBuf {
return this;
}
private int inlineClassUnderlyingPropertyName_ ;
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public boolean hasInlineClassUnderlyingPropertyName() {
return ((bitField0_ & 0x00002000) == 0x00002000);
}
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public int getInlineClassUnderlyingPropertyName() {
return inlineClassUnderlyingPropertyName_;
}
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public Builder setInlineClassUnderlyingPropertyName(int value) {
bitField0_ |= 0x00002000;
inlineClassUnderlyingPropertyName_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public Builder clearInlineClassUnderlyingPropertyName() {
bitField0_ = (bitField0_ & ~0x00002000);
inlineClassUnderlyingPropertyName_ = 0;
onChanged();
return this;
}
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder> inlineClassUnderlyingTypeBuilder_;
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public boolean hasInlineClassUnderlyingType() {
return ((bitField0_ & 0x00004000) == 0x00004000);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
if (inlineClassUnderlyingTypeBuilder_ == null) {
return inlineClassUnderlyingType_;
} else {
return inlineClassUnderlyingTypeBuilder_.getMessage();
}
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public Builder setInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
if (inlineClassUnderlyingTypeBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
inlineClassUnderlyingType_ = value;
onChanged();
} else {
inlineClassUnderlyingTypeBuilder_.setMessage(value);
}
bitField0_ |= 0x00004000;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public Builder setInlineClassUnderlyingType(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder builderForValue) {
if (inlineClassUnderlyingTypeBuilder_ == null) {
inlineClassUnderlyingType_ = builderForValue.build();
onChanged();
} else {
inlineClassUnderlyingTypeBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00004000;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public Builder mergeInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
if (inlineClassUnderlyingTypeBuilder_ == null) {
if (((bitField0_ & 0x00004000) == 0x00004000) &&
inlineClassUnderlyingType_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance()) {
inlineClassUnderlyingType_ =
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.newBuilder(inlineClassUnderlyingType_).mergeFrom(value).buildPartial();
} else {
inlineClassUnderlyingType_ = value;
}
onChanged();
} else {
inlineClassUnderlyingTypeBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00004000;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public Builder clearInlineClassUnderlyingType() {
if (inlineClassUnderlyingTypeBuilder_ == null) {
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
onChanged();
} else {
inlineClassUnderlyingTypeBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00004000);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder getInlineClassUnderlyingTypeBuilder() {
bitField0_ |= 0x00004000;
onChanged();
return getInlineClassUnderlyingTypeFieldBuilder().getBuilder();
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
if (inlineClassUnderlyingTypeBuilder_ != null) {
return inlineClassUnderlyingTypeBuilder_.getMessageOrBuilder();
} else {
return inlineClassUnderlyingType_;
}
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>
getInlineClassUnderlyingTypeFieldBuilder() {
if (inlineClassUnderlyingTypeBuilder_ == null) {
inlineClassUnderlyingTypeBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>(
getInlineClassUnderlyingType(),
getParentForChildren(),
isClean());
inlineClassUnderlyingType_ = null;
}
return inlineClassUnderlyingTypeBuilder_;
}
private int inlineClassUnderlyingTypeId_ ;
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public boolean hasInlineClassUnderlyingTypeId() {
return ((bitField0_ & 0x00008000) == 0x00008000);
}
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public int getInlineClassUnderlyingTypeId() {
return inlineClassUnderlyingTypeId_;
}
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public Builder setInlineClassUnderlyingTypeId(int value) {
bitField0_ |= 0x00008000;
inlineClassUnderlyingTypeId_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public Builder clearInlineClassUnderlyingTypeId() {
bitField0_ = (bitField0_ & ~0x00008000);
inlineClassUnderlyingTypeId_ = 0;
onChanged();
return this;
}
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTableOrBuilder> typeTableBuilder_;
@@ -14265,7 +14622,7 @@ public final class DebugProtoBuf {
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
*/
public boolean hasTypeTable() {
return ((bitField0_ & 0x00002000) == 0x00002000);
return ((bitField0_ & 0x00010000) == 0x00010000);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
@@ -14290,7 +14647,7 @@ public final class DebugProtoBuf {
} else {
typeTableBuilder_.setMessage(value);
}
bitField0_ |= 0x00002000;
bitField0_ |= 0x00010000;
return this;
}
/**
@@ -14304,7 +14661,7 @@ public final class DebugProtoBuf {
} else {
typeTableBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00002000;
bitField0_ |= 0x00010000;
return this;
}
/**
@@ -14312,7 +14669,7 @@ public final class DebugProtoBuf {
*/
public Builder mergeTypeTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable value) {
if (typeTableBuilder_ == null) {
if (((bitField0_ & 0x00002000) == 0x00002000) &&
if (((bitField0_ & 0x00010000) == 0x00010000) &&
typeTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance()) {
typeTable_ =
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.newBuilder(typeTable_).mergeFrom(value).buildPartial();
@@ -14323,7 +14680,7 @@ public final class DebugProtoBuf {
} else {
typeTableBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00002000;
bitField0_ |= 0x00010000;
return this;
}
/**
@@ -14336,14 +14693,14 @@ public final class DebugProtoBuf {
} else {
typeTableBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00002000);
bitField0_ = (bitField0_ & ~0x00010000);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder getTypeTableBuilder() {
bitField0_ |= 0x00002000;
bitField0_ |= 0x00010000;
onChanged();
return getTypeTableFieldBuilder().getBuilder();
}
@@ -14376,9 +14733,9 @@ public final class DebugProtoBuf {
private java.util.List<java.lang.Integer> versionRequirement_ = java.util.Collections.emptyList();
private void ensureVersionRequirementIsMutable() {
if (!((bitField0_ & 0x00004000) == 0x00004000)) {
if (!((bitField0_ & 0x00020000) == 0x00020000)) {
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>(versionRequirement_);
bitField0_ |= 0x00004000;
bitField0_ |= 0x00020000;
}
}
/**
@@ -14463,7 +14820,7 @@ public final class DebugProtoBuf {
*/
public Builder clearVersionRequirement() {
versionRequirement_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00004000);
bitField0_ = (bitField0_ & ~0x00020000);
onChanged();
return this;
}
@@ -14475,7 +14832,7 @@ public final class DebugProtoBuf {
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
*/
public boolean hasVersionRequirementTable() {
return ((bitField0_ & 0x00008000) == 0x00008000);
return ((bitField0_ & 0x00040000) == 0x00040000);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
@@ -14500,7 +14857,7 @@ public final class DebugProtoBuf {
} else {
versionRequirementTableBuilder_.setMessage(value);
}
bitField0_ |= 0x00008000;
bitField0_ |= 0x00040000;
return this;
}
/**
@@ -14514,7 +14871,7 @@ public final class DebugProtoBuf {
} else {
versionRequirementTableBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00008000;
bitField0_ |= 0x00040000;
return this;
}
/**
@@ -14522,7 +14879,7 @@ public final class DebugProtoBuf {
*/
public Builder mergeVersionRequirementTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable value) {
if (versionRequirementTableBuilder_ == null) {
if (((bitField0_ & 0x00008000) == 0x00008000) &&
if (((bitField0_ & 0x00040000) == 0x00040000) &&
versionRequirementTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance()) {
versionRequirementTable_ =
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.newBuilder(versionRequirementTable_).mergeFrom(value).buildPartial();
@@ -14533,7 +14890,7 @@ public final class DebugProtoBuf {
} else {
versionRequirementTableBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00008000;
bitField0_ |= 0x00040000;
return this;
}
/**
@@ -14546,14 +14903,14 @@ public final class DebugProtoBuf {
} else {
versionRequirementTableBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00008000);
bitField0_ = (bitField0_ & ~0x00040000);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder getVersionRequirementTableBuilder() {
bitField0_ |= 0x00008000;
bitField0_ |= 0x00040000;
onChanged();
return getVersionRequirementTableFieldBuilder().getBuilder();
}
@@ -34382,7 +34739,7 @@ public final class DebugProtoBuf {
"Variance:\003INV\0228\n\013upper_bound\030\005 \003(\0132#.org" +
".jetbrains.kotlin.metadata.Type\022\036\n\016upper" +
"_bound_id\030\006 \003(\005B\006\020\001\240\265\030\001\"$\n\010Variance\022\006\n\002I" +
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\250\007\n\005Class\022\020" +
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\327\010\n\005Class\022\020" +
"\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq_name\030\003 \002(\005B\004\220\265\030\001\022",
"#\n\025companion_object_name\030\004 \001(\005B\004\210\265\030\001\022D\n\016" +
"type_parameter\030\005 \003(\0132,.org.jetbrains.kot" +
@@ -34398,122 +34755,127 @@ public final class DebugProtoBuf {
"brains.kotlin.metadata.TypeAlias\022<\n\nenum" +
"_entry\030\r \003(\0132(.org.jetbrains.kotlin.meta" +
"data.EnumEntry\022\'\n\027sealed_subclass_fq_nam" +
"e\030\020 \003(\005B\006\020\001\220\265\030\001\022<\n\ntype_table\030\036 \001(\0132(.or" +
"g.jetbrains.kotlin.metadata.TypeTable\022\033\n" +
"\023version_requirement\030\037 \003(\005\022Y\n\031version_re" +
"quirement_table\030 \001(\01326.org.jetbrains.ko" +
"tlin.metadata.VersionRequirementTable\"x\n" +
"\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_",
"CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024\n\020ANNOTATION_CL" +
"ASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMPANION_OBJECT\020\006*" +
"\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010function\030\003 \003(\0132\'." +
"org.jetbrains.kotlin.metadata.Function\0229" +
"\n\010property\030\004 \003(\0132\'.org.jetbrains.kotlin." +
"metadata.Property\022<\n\ntype_alias\030\005 \003(\0132(." +
"org.jetbrains.kotlin.metadata.TypeAlias\022" +
"<\n\ntype_table\030\036 \001(\0132(.org.jetbrains.kotl" +
"in.metadata.TypeTable\022Y\n\031version_require" +
"ment_table\030 \001(\01326.org.jetbrains.kotlin.",
"metadata.VersionRequirementTable*\005\010d\020\310\001\"" +
"`\n\tTypeTable\0221\n\004type\030\001 \003(\0132#.org.jetbrai" +
"ns.kotlin.metadata.Type\022\032\n\016first_nullabl" +
"e\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Constructor\022\020\n\005fla" +
"gs\030\001 \001(\005:\0016\022F\n\017value_parameter\030\002 \003(\0132-.o" +
"rg.jetbrains.kotlin.metadata.ValueParame" +
"ter\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224\001" +
"\"\246\004\n\010Function\022\020\n\005flags\030\t \001(\005:\0016\022\024\n\told_f" +
"lags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013ret" +
"urn_type\030\003 \001(\0132#.org.jetbrains.kotlin.me",
"tadata.Type\022\034\n\016return_type_id\030\007 \001(\005B\004\240\265\030" +
"\001\022D\n\016type_parameter\030\004 \003(\0132,.org.jetbrain" +
"s.kotlin.metadata.TypeParameter\022:\n\rrecei" +
"ver_type\030\005 \001(\0132#.org.jetbrains.kotlin.me" +
"tadata.Type\022\036\n\020receiver_type_id\030\010 \001(\005B\004\240" +
"\265\030\001\022F\n\017value_parameter\030\006 \003(\0132-.org.jetbr" +
"ains.kotlin.metadata.ValueParameter\022<\n\nt" +
"ype_table\030\036 \001(\0132(.org.jetbrains.kotlin.m" +
"etadata.TypeTable\022\033\n\023version_requirement" +
"\030\037 \003(\005\0229\n\010contract\030 \001(\0132\'.org.jetbrains",
".kotlin.metadata.Contract*\006\010d\020\270\224\001\"\345\003\n\010Pr" +
"operty\022\022\n\005flags\030\013 \001(\005:\003518\022\027\n\told_flags\030" +
"\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013retur" +
"n_type\030\003 \001(\0132#.org.jetbrains.kotlin.meta" +
"data.Type\022\034\n\016return_type_id\030\t \001(\005B\004\240\265\030\001\022" +
"D\n\016type_parameter\030\004 \003(\0132,.org.jetbrains." +
"kotlin.metadata.TypeParameter\022:\n\rreceive" +
"r_type\030\005 \001(\0132#.org.jetbrains.kotlin.meta" +
"data.Type\022\036\n\020receiver_type_id\030\n \001(\005B\004\240\265\030" +
"\001\022M\n\026setter_value_parameter\030\006 \001(\0132-.org.",
"jetbrains.kotlin.metadata.ValueParameter" +
"\022\024\n\014getter_flags\030\007 \001(\005\022\024\n\014setter_flags\030\010" +
" \001(\005\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224" +
"\001\"\357\001\n\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022" +
"\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004type\030\003 \001(\0132#.org.j" +
"etbrains.kotlin.metadata.Type\022\025\n\007type_id" +
"\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_element_type\030\004 \001(" +
"\0132#.org.jetbrains.kotlin.metadata.Type\022$" +
"\n\026vararg_element_type_id\030\006 \001(\005B\004\240\265\030\001*\005\010d" +
"\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flags\030\001 \001(\005:\0016\022\022\n\004n",
"ame\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_parameter\030\003 \003(\0132" +
",.org.jetbrains.kotlin.metadata.TypePara" +
"meter\022<\n\017underlying_type\030\004 \001(\0132#.org.jet" +
"brains.kotlin.metadata.Type\022 \n\022underlyin" +
"g_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\rexpanded_type\030\006" +
" \001(\0132#.org.jetbrains.kotlin.metadata.Typ" +
"e\022\036\n\020expanded_type_id\030\007 \001(\005B\004\240\265\030\001\022=\n\nann" +
"otation\030\010 \003(\0132).org.jetbrains.kotlin.met" +
"adata.Annotation\022\033\n\023version_requirement\030" +
"\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry\022\022\n\004name\030\001 \001(\005B",
"\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionRequirement\022\017\n\007v" +
"ersion\030\001 \001(\005\022\024\n\014version_full\030\002 \001(\005\022M\n\005le" +
"vel\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
"a.VersionRequirement.Level:\005ERROR\022\022\n\nerr" +
"or_code\030\004 \001(\005\022\025\n\007message\030\005 \001(\005B\004\230\265\030\001\022e\n\014" +
"version_kind\030\006 \001(\0162=.org.jetbrains.kotli" +
"n.metadata.VersionRequirement.VersionKin" +
"d:\020LANGUAGE_VERSION\"+\n\005Level\022\013\n\007WARNING\020" +
"\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"J\n\013VersionKind\022" +
"\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020COMPILER_VERSIO",
"N\020\001\022\017\n\013API_VERSION\020\002\"a\n\027VersionRequireme" +
"ntTable\022F\n\013requirement\030\001 \003(\01321.org.jetbr" +
"ains.kotlin.metadata.VersionRequirement\"" +
"\217\002\n\017PackageFragment\022;\n\007strings\030\001 \001(\0132*.o" +
"rg.jetbrains.kotlin.metadata.StringTable" +
"\022J\n\017qualified_names\030\002 \001(\01321.org.jetbrain" +
"s.kotlin.metadata.QualifiedNameTable\0227\n\007" +
"package\030\003 \001(\0132&.org.jetbrains.kotlin.met" +
"adata.Package\0223\n\005class\030\004 \003(\0132$.org.jetbr" +
"ains.kotlin.metadata.Class*\005\010d\020\310\001\"A\n\010Con",
"tract\0225\n\006effect\030\001 \003(\0132%.org.jetbrains.ko" +
"tlin.metadata.Effect\"\306\003\n\006Effect\022E\n\013effec" +
"t_type\030\001 \001(\01620.org.jetbrains.kotlin.meta" +
"data.Effect.EffectType\022N\n\033effect_constru" +
"ctor_argument\030\002 \003(\0132).org.jetbrains.kotl" +
"in.metadata.Expression\022S\n conclusion_of_" +
"conditional_effect\030\003 \001(\0132).org.jetbrains" +
".kotlin.metadata.Expression\022B\n\004kind\030\004 \001(" +
"\01624.org.jetbrains.kotlin.metadata.Effect" +
".InvocationKind\"C\n\nEffectType\022\024\n\020RETURNS",
"_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n\020RETURNS_NOT_NU" +
"LL\020\002\"G\n\016InvocationKind\022\020\n\014AT_MOST_ONCE\020\000" +
"\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_LEAST_ONCE\020\002\"\245\003" +
"\n\nExpression\022\020\n\005flags\030\001 \001(\005:\0010\022!\n\031value_" +
"parameter_reference\030\002 \001(\005\022O\n\016constant_va" +
"lue\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
"a.Expression.ConstantValue\022=\n\020is_instanc" +
"e_type\030\004 \001(\0132#.org.jetbrains.kotlin.meta" +
"data.Type\022!\n\023is_instance_type_id\030\005 \001(\005B\004" +
"\240\265\030\001\022?\n\014and_argument\030\006 \003(\0132).org.jetbrai",
"ns.kotlin.metadata.Expression\022>\n\013or_argu" +
"ment\030\007 \003(\0132).org.jetbrains.kotlin.metada" +
"ta.Expression\".\n\rConstantValue\022\010\n\004TRUE\020\000" +
"\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010Modality\022\t\n\005FIN" +
"AL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002\022\n\n\006SEALED\020\003" +
"*b\n\nVisibility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020" +
"\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVATE_" +
"TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nMemberKind\022\017\n\013DE" +
"CLARATION\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022\016\n\nDELEGA" +
"TION\020\002\022\017\n\013SYNTHESIZED\020\003B\017B\rDebugProtoBuf"
"e\030\020 \003(\005B\006\020\001\220\265\030\001\0223\n%inline_class_underlyi" +
"ng_property_name\030\021 \001(\005B\004\210\265\030\001\022I\n\034inline_c" +
"lass_underlying_type\030\022 \001(\0132#.org.jetbrai" +
"ns.kotlin.metadata.Type\022-\n\037inline_class_" +
"underlying_type_id\030\023 \001(\005B\004\240\265\030\001\022<\n\ntype_t" +
"able\030\036 \001(\0132(.org.jetbrains.kotlin.metada",
"ta.TypeTable\022\033\n\023version_requirement\030\037 \003(" +
"\005\022Y\n\031version_requirement_table\030 \001(\01326.o" +
"rg.jetbrains.kotlin.metadata.VersionRequ" +
"irementTable\"x\n\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTER" +
"FACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024" +
"\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMP" +
"ANION_OBJECT\020\006*\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010fu" +
"nction\030\003 \003(\0132\'.org.jetbrains.kotlin.meta" +
"data.Function\0229\n\010property\030\004 \003(\0132\'.org.je" +
"tbrains.kotlin.metadata.Property\022<\n\ntype",
"_alias\030\005 \003(\0132(.org.jetbrains.kotlin.meta" +
"data.TypeAlias\022<\n\ntype_table\030\036 \001(\0132(.org" +
".jetbrains.kotlin.metadata.TypeTable\022Y\n\031" +
"version_requirement_table\030 \001(\01326.org.je" +
"tbrains.kotlin.metadata.VersionRequireme" +
"ntTable*\005\010d\020\310\001\"`\n\tTypeTable\0221\n\004type\030\001 \003(" +
"\0132#.org.jetbrains.kotlin.metadata.Type\022\032" +
"\n\016first_nullable\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Con" +
"structor\022\020\n\005flags\030\001 \001(\005:\0016\022F\n\017value_para" +
"meter\030\002 \003(\0132-.org.jetbrains.kotlin.metad",
"ata.ValueParameter\022\033\n\023version_requiremen" +
"t\030\037 \003(\005*\006\010d\020\270\224\001\"\246\004\n\010Function\022\020\n\005flags\030\t " +
"\001(\005:\0016\022\024\n\told_flags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002" +
"(\005B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetb" +
"rains.kotlin.metadata.Type\022\034\n\016return_typ" +
"e_id\030\007 \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\013" +
"2,.org.jetbrains.kotlin.metadata.TypePar" +
"ameter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetb" +
"rains.kotlin.metadata.Type\022\036\n\020receiver_t" +
"ype_id\030\010 \001(\005B\004\240\265\030\001\022F\n\017value_parameter\030\006 ",
"\003(\0132-.org.jetbrains.kotlin.metadata.Valu" +
"eParameter\022<\n\ntype_table\030\036 \001(\0132(.org.jet" +
"brains.kotlin.metadata.TypeTable\022\033\n\023vers" +
"ion_requirement\030\037 \003(\005\0229\n\010contract\030 \001(\0132" +
"\'.org.jetbrains.kotlin.metadata.Contract" +
"*\006\010d\020\270\224\001\"\345\003\n\010Property\022\022\n\005flags\030\013 \001(\005:\00351" +
"8\022\027\n\told_flags\030\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005" +
"B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetbra" +
"ins.kotlin.metadata.Type\022\034\n\016return_type_" +
"id\030\t \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\0132,",
".org.jetbrains.kotlin.metadata.TypeParam" +
"eter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetbra" +
"ins.kotlin.metadata.Type\022\036\n\020receiver_typ" +
"e_id\030\n \001(\005B\004\240\265\030\001\022M\n\026setter_value_paramet" +
"er\030\006 \001(\0132-.org.jetbrains.kotlin.metadata" +
".ValueParameter\022\024\n\014getter_flags\030\007 \001(\005\022\024\n" +
"\014setter_flags\030\010 \001(\005\022\033\n\023version_requireme" +
"nt\030\037 \003(\005*\006\010d\020\270\224\001\"\357\001\n\016ValueParameter\022\020\n\005f" +
"lags\030\001 \001(\005:\0010\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004typ" +
"e\030\003 \001(\0132#.org.jetbrains.kotlin.metadata.",
"Type\022\025\n\007type_id\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_el" +
"ement_type\030\004 \001(\0132#.org.jetbrains.kotlin." +
"metadata.Type\022$\n\026vararg_element_type_id\030" +
"\006 \001(\005B\004\240\265\030\001*\005\010d\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flag" +
"s\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_p" +
"arameter\030\003 \003(\0132,.org.jetbrains.kotlin.me" +
"tadata.TypeParameter\022<\n\017underlying_type\030" +
"\004 \001(\0132#.org.jetbrains.kotlin.metadata.Ty" +
"pe\022 \n\022underlying_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\r" +
"expanded_type\030\006 \001(\0132#.org.jetbrains.kotl",
"in.metadata.Type\022\036\n\020expanded_type_id\030\007 \001" +
"(\005B\004\240\265\030\001\022=\n\nannotation\030\010 \003(\0132).org.jetbr" +
"ains.kotlin.metadata.Annotation\022\033\n\023versi" +
"on_requirement\030\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry" +
"\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionR" +
"equirement\022\017\n\007version\030\001 \001(\005\022\024\n\014version_f" +
"ull\030\002 \001(\005\022M\n\005level\030\003 \001(\01627.org.jetbrains" +
".kotlin.metadata.VersionRequirement.Leve" +
"l:\005ERROR\022\022\n\nerror_code\030\004 \001(\005\022\025\n\007message\030" +
"\005 \001(\005B\004\230\265\030\001\022e\n\014version_kind\030\006 \001(\0162=.org.",
"jetbrains.kotlin.metadata.VersionRequire" +
"ment.VersionKind:\020LANGUAGE_VERSION\"+\n\005Le" +
"vel\022\013\n\007WARNING\020\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"" +
"J\n\013VersionKind\022\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020" +
"COMPILER_VERSION\020\001\022\017\n\013API_VERSION\020\002\"a\n\027V" +
"ersionRequirementTable\022F\n\013requirement\030\001 " +
"\003(\01321.org.jetbrains.kotlin.metadata.Vers" +
"ionRequirement\"\217\002\n\017PackageFragment\022;\n\007st" +
"rings\030\001 \001(\0132*.org.jetbrains.kotlin.metad" +
"ata.StringTable\022J\n\017qualified_names\030\002 \001(\013",
"21.org.jetbrains.kotlin.metadata.Qualifi" +
"edNameTable\0227\n\007package\030\003 \001(\0132&.org.jetbr" +
"ains.kotlin.metadata.Package\0223\n\005class\030\004 " +
"\003(\0132$.org.jetbrains.kotlin.metadata.Clas" +
"s*\005\010d\020\310\001\"A\n\010Contract\0225\n\006effect\030\001 \003(\0132%.o" +
"rg.jetbrains.kotlin.metadata.Effect\"\306\003\n\006" +
"Effect\022E\n\013effect_type\030\001 \001(\01620.org.jetbra" +
"ins.kotlin.metadata.Effect.EffectType\022N\n" +
"\033effect_constructor_argument\030\002 \003(\0132).org" +
".jetbrains.kotlin.metadata.Expression\022S\n",
" conclusion_of_conditional_effect\030\003 \001(\0132" +
").org.jetbrains.kotlin.metadata.Expressi" +
"on\022B\n\004kind\030\004 \001(\01624.org.jetbrains.kotlin." +
"metadata.Effect.InvocationKind\"C\n\nEffect" +
"Type\022\024\n\020RETURNS_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n" +
"\020RETURNS_NOT_NULL\020\002\"G\n\016InvocationKind\022\020\n" +
"\014AT_MOST_ONCE\020\000\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_" +
"LEAST_ONCE\020\002\"\245\003\n\nExpression\022\020\n\005flags\030\001 \001" +
"(\005:\0010\022!\n\031value_parameter_reference\030\002 \001(\005" +
"\022O\n\016constant_value\030\003 \001(\01627.org.jetbrains",
".kotlin.metadata.Expression.ConstantValu" +
"e\022=\n\020is_instance_type\030\004 \001(\0132#.org.jetbra" +
"ins.kotlin.metadata.Type\022!\n\023is_instance_" +
"type_id\030\005 \001(\005B\004\240\265\030\001\022?\n\014and_argument\030\006 \003(" +
"\0132).org.jetbrains.kotlin.metadata.Expres" +
"sion\022>\n\013or_argument\030\007 \003(\0132).org.jetbrain" +
"s.kotlin.metadata.Expression\".\n\rConstant" +
"Value\022\010\n\004TRUE\020\000\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010" +
"Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRAC" +
"T\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERNA",
"L\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLI" +
"C\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nM" +
"emberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERR" +
"IDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B\017" +
"B\rDebugProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -34587,7 +34949,7 @@ public final class DebugProtoBuf {
internal_static_org_jetbrains_kotlin_metadata_Class_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_metadata_Class_descriptor,
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "InlineClassUnderlyingPropertyName", "InlineClassUnderlyingType", "InlineClassUnderlyingTypeId", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
internal_static_org_jetbrains_kotlin_metadata_Package_descriptor =
getDescriptor().getMessageTypes().get(6);
internal_static_org_jetbrains_kotlin_metadata_Package_fieldAccessorTable = new
@@ -34696,6 +35058,8 @@ public final class DebugProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipMessageInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);

View File

@@ -27,7 +27,7 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("serialization", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
@@ -159,6 +159,7 @@ rootProject.apply {
from(rootProject.file("gradle/checkArtifacts.gradle.kts"))
from(rootProject.file("gradle/checkCacheability.gradle.kts"))
from(rootProject.file("gradle/retryPublishing.gradle.kts"))
from(rootProject.file("gradle/modularizedTestConfigurations.gradle.kts"))
}
IdeVersionConfigurator.setCurrentIde(project)
@@ -182,7 +183,7 @@ extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["versions.trove4j"] = "1.0.20181211"
extra["versions.completion-ranking-kotlin"] = "0.1.3"
extra["versions.r8"] = "2.0.88"
extra["versions.r8"] = "2.1.96"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
@@ -191,7 +192,7 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.5-dev-17775"
extra["versions.kotlin-native"] = "1.5.20-dev-5613"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
@@ -354,6 +355,12 @@ val coreLibProjects = listOfNotNull(
":kotlin-reflect"
)
val projectsWithDisabledFirBootstrap = coreLibProjects + listOf(
":kotlin-gradle-plugin",
":kotlinx-metadata",
":kotlinx-metadata-jvm"
)
val gradlePluginProjects = listOf(
":kotlin-gradle-plugin",
":kotlin-gradle-plugin-api",
@@ -361,7 +368,8 @@ val gradlePluginProjects = listOf(
":kotlin-annotation-processing-gradle",
":kotlin-noarg",
":kotlin-sam-with-receiver",
":kotlin-parcelize-compiler"
":kotlin-parcelize-compiler",
":kotlin-lombok"
)
apply {
@@ -422,14 +430,19 @@ allprojects {
repositories {
kotlinBuildLocalRepo(project)
mirrorRepo?.let(::maven)
jcenter()
maven(protobufRepo)
maven(intellijRepo)
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
maven("https://dl.google.com/dl/android/maven2")
bootstrapKotlinRepo?.let(::maven)
internalBootstrapRepo?.let(::maven)
bootstrapKotlinRepo?.let(::maven)
maven(protobufRepo)
maven(intellijRepo)
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://dl.google.com/dl/android/maven2")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
jcenter()
}
configureJvmProject(javaHome!!, jvmTarget!!)
@@ -463,7 +476,7 @@ allprojects {
useIR = true
}
if (useJvmFir) {
if (useJvmFir && this@allprojects.name !in projectsWithDisabledFirBootstrap) {
freeCompilerArgs += "-Xuse-fir"
freeCompilerArgs += "-Xabi-stability=stable"
}
@@ -565,22 +578,6 @@ allprojects {
}
}
gradle.buildFinished {
val taskGraph = gradle?.taskGraph
if (taskGraph != null) {
taskGraph.allTasks
.filterIsInstance<SourceTask>()
.filter { it.didWork }
.forEach {
it.source.visit {
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
}
}
}
}
}
gradle.taskGraph.whenReady {
fun Boolean.toOnOff(): String = if (this) "on" else "off"
val profile = if (isTeamcityBuild) "CI" else "Local"
@@ -621,17 +618,12 @@ val ideaPlugin by task<Task> {
}
tasks {
named("clean") {
doLast {
delete("$buildDir/repo")
delete(distDir)
}
named<Delete>("clean") {
delete += setOf("$buildDir/repo", distDir)
}
register("cleanupArtifacts") {
doLast {
delete(artifactsDir)
}
register<Delete>("cleanupArtifacts") {
delete = setOf(artifactsDir)
}
listOf("clean", "assemble", "install").forEach { taskName ->
@@ -730,10 +722,12 @@ tasks {
register("scriptingTest") {
dependsOn("dist")
dependsOn(":kotlin-script-util:test")
dependsOn(":kotlin-scripting-compiler-embeddable:test")
dependsOn(":kotlin-scripting-compiler:test")
dependsOn(":kotlin-scripting-compiler:testWithIr")
dependsOn(":kotlin-scripting-common:test")
dependsOn(":kotlin-scripting-jvm:test")
dependsOn(":kotlin-scripting-jvm-host-test:test")
dependsOn(":kotlin-scripting-jvm-host-test:testWithIr")
dependsOn(":kotlin-scripting-dependencies:test")
dependsOn(":kotlin-scripting-dependencies-maven:test")
dependsOn(":kotlin-scripting-jsr223-test:test")
@@ -741,6 +735,7 @@ tasks {
// dependsOn(":kotlin-scripting-jvm-host-test:embeddableTest")
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
dependsOn(":kotlin-main-kts-test:test")
dependsOn(":kotlin-main-kts-test:testWithIr")
dependsOn(":kotlin-scripting-ide-services-test:test")
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
dependsOn(":kotlin-scripting-js-test:test")
@@ -766,6 +761,9 @@ tasks {
dependsOn("jvmCompilerIntegrationTest")
dependsOn(":plugins:parcelize:parcelize-compiler:test")
dependsOn(":kotlin-util-io:test")
dependsOn(":kotlin-util-klib:test")
}
register("toolsTest") {
@@ -806,7 +804,6 @@ tasks {
dependsOn("dist")
dependsOn(
":idea:idea-maven:test",
":j2k:test",
":nj2k:test",
":idea:jvm-debugger:jvm-debugger-core:test",
":idea:jvm-debugger:jvm-debugger-evaluation:test",
@@ -892,17 +889,11 @@ tasks {
if (Ide.IJ()) {
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
":idea:idea-new-project-wizard:test" // Temporary here. Remove after enabling builds for ideaIntegrationsTests
":libraries:tools:new-project-wizard:new-project-wizard-cli:test"
)
}
}
register("ideaIntegrationsTests") {
if (Ide.IJ()) {
dependsOn(":idea:idea-new-project-wizard:test")
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
@@ -1209,7 +1200,8 @@ val Jar.outputFile: File
val Project.sourceSetsOrNull: SourceSetContainer?
get() = convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets
val disableVerificationTasks = System.getProperty("disable.verification.tasks") == "true"
val disableVerificationTasks = providers.systemProperty("disable.verification.tasks")
.forUseAtConfigurationTime().orNull?.toBoolean() ?: false
if (disableVerificationTasks) {
gradle.taskGraph.whenReady {
allTasks.forEach {

View File

@@ -11,10 +11,8 @@ buildscript {
repositories {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
} else {
jcenter()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
}
@@ -24,7 +22,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -84,10 +82,9 @@ extra["versions.androidDxSources"] = "5.0.0_r2"
extra["customDepsOrg"] = "kotlin.build"
repositories {
jcenter()
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
mavenCentral()
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://kotlin.bintray.com/kotlinx")
gradlePluginPortal()
extra["bootstrapKotlinRepo"]?.let {
@@ -147,8 +144,8 @@ java {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
implementation("com.gradle.publish:plugin-publish-plugin:0.14.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
@@ -161,7 +158,7 @@ dependencies {
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")
implementation("org.gradle:test-retry-gradle-plugin:1.1.9")
implementation("org.gradle:test-retry-gradle-plugin:1.2.0")
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
compileOnly(gradleApi())
@@ -199,6 +196,7 @@ java {
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.allWarningsAsErrors = true
kotlinOptions.freeCompilerArgs += listOf(
"-Xopt-in=kotlin.RequiresOptIn",
"-Xskip-runtime-version-check",
@@ -262,4 +260,4 @@ gradlePlugin {
implementationClass = "org.jetbrains.kotlin.NativeInteropPlugin"
}
}
}
}

View File

@@ -65,28 +65,11 @@ repositories {
artifact()
}
}
ivy {
url = URI("https://dl.bintray.com/kotlin/as/")
patternLayout {
artifact("[artifact]-[revision]-$androidStudioOs.[ext]")
}
credentials {
username = System.getenv("AS_BINTRAY_USER_NAME") ?: findProperty("bintray.user") as String?
password = System.getenv("AS_BINTRAY_API_KEY") ?: findProperty("bintray.apikey") as String?
}
metadataSources {
artifact()
}
}
}
maven("https://www.jetbrains.com/intellij-repository/$intellijReleaseType")
maven("https://plugins.jetbrains.com/maven")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
}
val intellij by configurations.creating

View File

@@ -20,7 +20,7 @@ buildscript {
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
}
}

View File

@@ -0,0 +1,51 @@
import org.gradle.api.Action
import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withGroovyBuilder
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
class InstrumentJava(@Transient val javaInstrumentator: Configuration, @Transient val sourceSet: SourceSet) : Action<Task> {
private val instrumentatorClasspath: String by lazy {
javaInstrumentator.asPath
}
private val srcDirs: FileCollection by lazy {
sourceSet.allJava.sourceDirectories
}
override fun execute(task: Task) {
require(task is JavaCompile) { "$task is not of type JavaCompile!" }
task.doLast {
task.ant.withGroovyBuilder {
"taskdef"(
"name" to "instrumentIdeaExtensions",
"classpath" to instrumentatorClasspath,
"loaderref" to "java2.loader",
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
)
}
val javaSourceDirectories = srcDirs.filter { it.exists() }
task.ant.withGroovyBuilder {
javaSourceDirectories.forEach { directory ->
"instrumentIdeaExtensions"(
"srcdir" to directory,
"destdir" to task.destinationDir,
"classpath" to task.classpath.asPath,
"includeantruntime" to false,
"instrumentNotNull" to true
)
}
}
}
}
}

View File

@@ -25,7 +25,6 @@ import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.Upload
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer
import plugins.KotlinBuildPublishingPlugin

View File

@@ -8,48 +8,37 @@ package tasks
import groovy.util.Node
import groovy.util.XmlParser
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.io.File
import java.util.*
open class WriteCopyrightToFile : DefaultTask() {
abstract class WriteCopyrightToFile : DefaultTask() {
@InputFile
var path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
val path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
@OutputFile
var outputFile: File? = null
@get:OutputFile
abstract val outputFile: RegularFileProperty
@Input
var commented: Boolean = true
@get:Input
val commented: Property<Boolean> = project.objects.property(Boolean::class.java).convention(true)
@TaskAction
fun write() {
if (commented) {
outputFile!!.writeText(project.readCopyrightCommented())
} else {
outputFile!!.writeText(project.readCopyright())
}
val file = outputFile.asFile.get()
file.writeText(if (commented.get()) readCopyrightCommented() else readCopyright())
}
fun Project.readCopyright(): String {
val file = rootDir.resolve(".idea/copyright/apache.xml")
assert(file.exists()) {
"File $file with copyright not found"
private fun readCopyright(): String {
assert(path.exists()) {
"File $path with copyright not found"
}
val xmlParser = XmlParser()
val node = xmlParser.parse(file)
val node = xmlParser.parse(path)
assert(node.attribute("name") == "CopyrightManager") {
"Format changed occasionally?"
}
@@ -59,7 +48,7 @@ open class WriteCopyrightToFile : DefaultTask() {
return noticeNode.attribute("value").toString().replace("&#36;today.year", GregorianCalendar()[Calendar.YEAR].toString())
}
fun Project.readCopyrightCommented(): String {
private fun readCopyrightCommented(): String {
return "/*\n" + readCopyright().prependIndent(" * ") + "\n */"
}
}

View File

@@ -118,7 +118,8 @@ fun DependencyHandler.projectArchives(name: String): ProjectDependency = project
fun Project.testApiJUnit5(
vintageEngine: Boolean = false,
runner: Boolean = false,
suiteApi: Boolean = false
suiteApi: Boolean = false,
jupiterParams: Boolean = false
) {
with(dependencies) {
val platformVersion = commonVer("org.junit", "junit-bom")
@@ -127,6 +128,11 @@ fun Project.testApiJUnit5(
if (vintageEngine) {
testApi("org.junit.vintage:junit-vintage-engine:$platformVersion")
}
if (jupiterParams) {
testApi("org.junit.jupiter:junit-jupiter-params:$platformVersion")
}
val componentsVersion = commonVer("org.junit.platform", "")
val components = mutableListOf(

View File

@@ -128,7 +128,6 @@ fun Project.rewriteDepsToShadedJar(
archiveClassifier.set("original")
}
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
shadowJarTask.configure {
dependsOn(originalJarTask)
@@ -136,7 +135,8 @@ fun Project.rewriteDepsToShadedJar(
// When Gradle traverses the inputs, reject the shaded compiler JAR,
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
val compilerDummyJarFile = project.provider { configurations.getByName("compilerDummyJar").singleFile }
exclude { it.file == compilerDummyJarFile.get() }
archiveClassifier.set("original")
body()

View File

@@ -21,15 +21,18 @@ import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.internal.ConventionTask
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.tasks.*
import org.gradle.api.tasks.compile.AbstractCompile
import org.gradle.kotlin.dsl.*
import java.io.File
import javax.inject.Inject
fun Project.configureFormInstrumentation() {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.configureEach {
// When we change the output classes directory, Gradle will automatically configure
// the test compile tasks to use the instrumented classes. Normally this is fine,
// however, it causes problems for Kotlin projects:
@@ -42,31 +45,36 @@ fun Project.configureFormInstrumentation() {
// This fails when we change the classes dir. The easiest fix is to prepend the
// classes from the "friendly directory" to the compile classpath.
val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile?
testCompile?.doFirst {
val originalClassesDirs = files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy"))
if (!tasks.names.contains("compileTestKotlin")) return@configureEach
testCompile.classpath = (testCompile.classpath
- mainSourceSet.output.classesDirs
+ originalClassesDirs)
tasks.named<AbstractCompile>("compileTestKotlin") {
val objects = project.objects
val classesDirs = project.mainSourceSet.output.classesDirs
val classesDirsCopy = project.provider { (mainSourceSet as ExtensionAware).extra.get("classesDirsCopy") }
doFirst {
val originalClassesDirs = objects.fileCollection().from(classesDirsCopy)
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
// -Xfriend-paths compiler argument as well.
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
classpath = (classpath
- classesDirs
+ originalClassesDirs)
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
// -Xfriend-paths compiler argument as well.
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
}
addFreeCompilerArgs(this as AbstractCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
}
addFreeCompilerArgs(testCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
}
}
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
@@ -76,7 +84,7 @@ fun Project.configureFormInstrumentation() {
}
afterEvaluate {
sourceSets.all { sourceSetParam ->
sourceSets.forEach { sourceSetParam ->
// This copy will ignore filters, but they are unlikely to be used.
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
@@ -88,66 +96,82 @@ fun Project.configureFormInstrumentation() {
(sourceSetParam.output.classesDirs as ConfigurableFileCollection).setFrom(instrumentedClassesDir)
val instrumentTask =
project.tasks.register(sourceSetParam.getTaskName("instrument", "classes"), IntelliJInstrumentCodeTask::class.java) {
dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty }
sourceSet = sourceSetParam
instrumentationClasspath = instrumentationClasspathCfg
originalClassesDirs = classesDirsCopy
output = instrumentedClassesDir
outputs.dir(instrumentedClassesDir)
dependsOn(sourceSetParam.classesTaskName)
compileClasspath.from(sourceSetParam.compileClasspath)
sourceDirs.from(project.files({ sourceSetParam.allSource.srcDirs.filter { !sourceSetParam.resources.contains(it) && it.exists() } }))
instrumentationClasspathConfiguration = instrumentationClasspathCfg
originalClassesDirs.from(classesDirsCopy)
output.set(instrumentedClassesDir)
}
// Ensure that our task is invoked when the source set is built
sourceSetParam.compiledBy(instrumentTask)
@Suppress("UNUSED_EXPRESSION")
true
}
}
}
@CacheableTask
open class IntelliJInstrumentCodeTask : ConventionTask() {
abstract class IntelliJInstrumentCodeTask : ConventionTask() {
companion object {
private const val FILTER_ANNOTATION_REGEXP_CLASS = "com.intellij.ant.ClassFilterAnnotationRegexp"
private const val LOADER_REF = "java2.loader"
}
@Classpath
var instrumentationClasspath: Configuration? = null
@Transient
@Internal
lateinit var instrumentationClasspathConfiguration: Configuration
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
var originalClassesDirs: FileCollection? = null
@get:Classpath
val instrumentationClasspath: String by lazy {
instrumentationClasspathConfiguration.asPath
}
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:SkipWhenEmpty
abstract val originalClassesDirs: ConfigurableFileCollection
@get:Input
var instrumentNotNull: Boolean = false
@Internal
var sourceSet: SourceSet? = null
@get:InputFiles
@get:Classpath
abstract val compileClasspath: ConfigurableFileCollection
// Instrumentation needs to have access to sources of forms for inclusion
private val depSourceDirectorySets by lazy {
project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
}
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
val sourceDirs: FileCollection
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
abstract val sourceDirs: ConfigurableFileCollection
@get:OutputDirectory
lateinit var output: File
abstract val output: RegularFileProperty
@get:Inject
abstract val fs: FileSystemOperations
@TaskAction
fun instrumentClasses() {
logger.info(
"input files are: ${originalClassesDirs?.joinToString(
"; ",
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })}"
"input files are: ${
originalClassesDirs.joinToString(
"; ",
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })
}"
)
output.deleteRecursively()
output.asFile.get().deleteRecursively()
copyOriginalClasses()
val classpath = instrumentationClasspath!!
val classpath = instrumentationClasspath
ant.withGroovyBuilder {
"taskdef"(
"name" to "instrumentIdeaExtensions",
"classpath" to classpath.asPath,
"classpath" to classpath,
"loaderref" to LOADER_REF,
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
)
@@ -155,14 +179,14 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
logger.info("Compiling forms and instrumenting code with nullability preconditions")
if (instrumentNotNull) {
prepareNotNullInstrumenting(classpath.asPath)
prepareNotNullInstrumenting(classpath)
}
instrumentCode(sourceDirs, instrumentNotNull)
}
private fun copyOriginalClasses() {
project.copy {
fs.copy {
from(originalClassesDirs)
into(output)
}
@@ -181,12 +205,10 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
val headlessOldValue = System.setProperty("java.awt.headless", "true")
val output = output.get().asFile
// Instrumentation needs to have access to sources of forms for inclusion
val depSourceDirectorySets = project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
val instrumentationClasspath =
depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
depSourceDirectorySets.fold(compileClasspath as FileCollection) { acc, v -> acc + v }.asPath.also {
logger.info("Using following dependency source dirs: $it")
}

View File

@@ -10,31 +10,16 @@ import java.io.File
import org.gradle.api.Project
open class PillExtension {
/*
* Here's how you can specify a custom variant:
* `./gradlew pill -Dpill.variant=<NAME>`
*/
enum class Variant {
// Default variant (./gradlew pill)
BASE() {
override val includes = setOf(BASE)
},
// Full variant (./gradlew pill -Dpill.variant=full)
FULL() {
override val includes = setOf(BASE, FULL)
},
// Do not import the project to JPS model, but set some options for it
NONE() {
override val includes = emptySet<Variant>()
},
// 'BASE' if the "jps-compatible" plugin is applied, 'NONE' otherwise
DEFAULT() {
override val includes = emptySet<Variant>()
};
abstract val includes: Set<Variant>
BASE, // Includes compiler and IDE (default)
FULL, // Includes compiler, IDE and Gradle plugin
}
open var variant: Variant = Variant.DEFAULT
open var variant: Variant? = null
open var excludedDirs: List<File> = emptyList()
@@ -45,7 +30,7 @@ open class PillExtension {
@Suppress("unused")
fun serialize() = mapOf<String, Any?>(
"variant" to variant.name,
"variant" to variant?.name,
"excludedDirs" to excludedDirs
)
}

View File

@@ -64,6 +64,9 @@ private fun createMavenMarkerPublication(
): MavenPublication {
return publications.create<MavenPublication>(declaration.name.toString() + "PluginMarkerMaven") {
val pluginId: String = declaration.id
val cGroupId = coordinates.groupId
val cArtifactId = coordinates.artifactId
val cVersion = coordinates.version
artifactId = pluginId + PLUGIN_MARKER_SUFFIX
groupId = pluginId
pom.withXml {
@@ -72,11 +75,11 @@ private fun createMavenMarkerPublication(
val dependencies = root.appendChild(document.createElement("dependencies"))
val dependency = dependencies.appendChild(document.createElement("dependency"))
val groupId = dependency.appendChild(document.createElement("groupId"))
groupId.textContent = coordinates.groupId
groupId.textContent = cGroupId
val artifactId = dependency.appendChild(document.createElement("artifactId"))
artifactId.textContent = coordinates.artifactId
artifactId.textContent = cArtifactId
val version = dependency.appendChild(document.createElement("version"))
version.textContent = coordinates.version
version.textContent = cVersion
}
pom.name.set(declaration.displayName)

View File

@@ -6,12 +6,15 @@
import com.jakewharton.dex.*
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.*
import org.gradle.jvm.tasks.Jar
import java.io.File
@CacheableTask
open class DexMethodCount : DefaultTask() {
abstract class DexMethodCount : DefaultTask() {
data class Counts(
val total: Int,
@@ -24,16 +27,18 @@ open class DexMethodCount : DefaultTask() {
@Classpath
lateinit var jarFile: File
@Optional
@Input
var ownPackages: List<String>? = null
@get:Optional
@get:Input
abstract val ownPackages: ListProperty<String>
@Internal
var artifactName: String? = null
private val projectName = project.name
@get:Input
val artifactOrArchiveName: String
get() = artifactName ?: project.name
get() = artifactName ?: projectName
fun from(jar: Jar) {
jarFile = jar.archiveFile.get().asFile
@@ -45,8 +50,9 @@ open class DexMethodCount : DefaultTask() {
lateinit var counts: Counts
@get:OutputFile
val detailOutputFile: File
get() = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
val detailOutputFile: File by lazy {
project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
}
@TaskAction
fun invoke() {
@@ -59,9 +65,9 @@ open class DexMethodCount : DefaultTask() {
val byPackage = this.groupingBy { it.`package` }.eachCount()
val byClass = this.groupingBy { it.declaringType }.eachCount()
val ownPackages = ownPackages?.map { "$it." }
val byOwnPackages = if (ownPackages != null) {
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) } }.let {
val ownPackages = ownPackages.map { list -> list.map { "$it." } }
val byOwnPackages = if (ownPackages.isPresent) {
this.partition { method -> ownPackages.get().any { method.declaringType.startsWith(it) } }.let {
it.first.size to it.second.size
}
} else (null to null)
@@ -78,7 +84,7 @@ open class DexMethodCount : DefaultTask() {
private fun outputDetails(counts: Counts) {
detailOutputFile.printWriter().use { writer ->
writer.println("${counts.total.padRight()}\tTotal methods")
ownPackages?.let { packages ->
ownPackages.orNull?.let { packages ->
writer.println("${counts.totalOwnPackages?.padRight()}\tTotal methods from packages ${packages.joinToString { "$it.*" }}")
writer.println("${counts.totalOtherPackages?.padRight()}\tTotal methods from other packages")
}
@@ -96,23 +102,24 @@ open class DexMethodCount : DefaultTask() {
}
}
open class DexMethodCountStats : DefaultTask() {
@Internal
lateinit var from: TaskProvider<DexMethodCount>
abstract class DexMethodCountStats : DefaultTask() {
@get:InputFile
internal val inputFile
get() = from.get().detailOutputFile
internal abstract val inputFile: RegularFileProperty
@get:Input
internal abstract val artifactOrArchiveName: Property<String>
@get:Input
@get:Optional
internal abstract val ownPackages: ListProperty<String>
@TaskAction
private fun printStats() {
val artifactOrArchiveName = from.get().artifactOrArchiveName
inputFile.reader().useLines { lines ->
val artifactOrArchiveName = artifactOrArchiveName.get()
inputFile.get().asFile.reader().useLines { lines ->
fun String.getStatValue() = substringBefore("\t").trim()
val ownPackages = from.get().ownPackages
val statsLineCount = if (ownPackages == null) 1 else 3
val statsLineCount = if (!ownPackages.isPresent) 1 else 3
val stats = lines.take(statsLineCount).map { it.getStatValue() }.toList()
val total = stats[0]
@@ -122,7 +129,7 @@ open class DexMethodCountStats : DefaultTask() {
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='$total']")
}
ownPackages?.let { packages ->
ownPackages.map { packages ->
val totalOwnPackages = stats[1]
val totalOtherPackages = stats[2]
@@ -141,7 +148,9 @@ open class DexMethodCountStats : DefaultTask() {
fun Project.printStats(dexMethodCount: TaskProvider<DexMethodCount>) {
val dexMethodCountStats = tasks.register("dexMethodCountStats", DexMethodCountStats::class.java) {
dependsOn(dexMethodCount)
from = dexMethodCount
inputFile.set(dexMethodCount.flatMap { objects.fileProperty().apply { set(it.detailOutputFile) } })
artifactOrArchiveName.set(dexMethodCount.map { it.artifactOrArchiveName })
ownPackages.set(dexMethodCount.flatMap { it.ownPackages })
}
dexMethodCount.configure {

View File

@@ -5,6 +5,7 @@
package plugins
import PublishToMavenLocalSerializable
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.attributes.Usage
@@ -13,10 +14,10 @@ import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.publish.maven.tasks.PublishToMavenLocal
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import java.util.*
@@ -27,7 +28,6 @@ class KotlinBuildPublishingPlugin @Inject constructor(
) : Plugin<Project> {
override fun apply(target: Project): Unit = with(target) {
apply<MavenPublishPlugin>()
apply<SigningPlugin>()
val publishedRuntime = configurations.maybeCreate(RUNTIME_CONFIGURATION).apply {
isCanBeConsumed = false
@@ -132,32 +132,40 @@ fun Project.configureDefaultPublishing() {
}
}
configureSigning()
val signingRequired = project.providers.gradleProperty("signingRequired").forUseAtConfigurationTime().orNull?.toBoolean()
?: project.providers.gradleProperty("isSonatypeRelease").forUseAtConfigurationTime().orNull?.toBoolean() ?: false
if (signingRequired) {
apply<SigningPlugin>()
configureSigning()
}
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
// workaround for Gradle configuration cache
// TODO: remove it when https://github.com/gradle/gradle/pull/16945 merged into used in build Gradle version
tasks.withType(PublishToMavenLocal::class.java) {
val originalTask = this
val serializablePublishTask =
tasks.register(originalTask.name + "Serializable", PublishToMavenLocalSerializable::class.java) {
publication = originalTask.publication
}
originalTask.onlyIf { false }
originalTask.dependsOn(serializablePublishTask)
}
tasks.withType<PublishToMavenRepository>()
.matching { it.name.endsWith("PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository") }
.all { configureRepository() }
}
private fun Project.configureSigning() {
val signingRequired = provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
}
configure<SigningExtension> {
setRequired(signingRequired)
sign(extensions.getByType<PublishingExtension>().publications) // all publications
useGpgCmd()
}
tasks.withType<Sign>().configureEach {
setOnlyIf { signingRequired.get() }
}
}
fun TaskProvider<PublishToMavenRepository>.configureRepository() =
@@ -181,4 +189,4 @@ private fun PublishToMavenRepository.configureRepository() {
}
}
}
}
}

View File

@@ -7,13 +7,25 @@
// usages in build scripts are not tracked properly
@file:Suppress("unused")
import org.gradle.api.InvalidUserDataException
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter
import org.gradle.api.publish.internal.PublishOperation
import org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal
import org.gradle.api.publish.maven.internal.publisher.MavenNormalizedPublication
import org.gradle.api.publish.maven.internal.publisher.MavenPublisher
import org.gradle.api.publish.maven.internal.publisher.ValidatingMavenPublisher
import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.testing.Test
import org.gradle.internal.serialization.Cached
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import org.gradle.kotlin.dsl.support.serviceOf
import java.io.File
import java.lang.Character.isLowerCase
import java.lang.Character.isUpperCase
@@ -25,6 +37,7 @@ val kotlinGradlePluginAndItsRequired = arrayOf(
":kotlin-noarg",
":kotlin-sam-with-receiver",
":kotlin-android-extensions",
":kotlin-android-extensions-runtime",
":kotlin-parcelize-compiler",
":kotlin-build-common",
":kotlin-compiler-embeddable",
@@ -34,15 +47,18 @@ val kotlinGradlePluginAndItsRequired = arrayOf(
":kotlin-compiler-runner",
":kotlin-daemon-embeddable",
":kotlin-daemon-client",
":kotlin-project-model",
":kotlin-gradle-plugin-api",
":kotlin-gradle-plugin",
":kotlin-gradle-plugin-model",
":kotlin-tooling-metadata",
":kotlin-reflect",
":kotlin-annotation-processing-gradle",
":kotlin-test",
":kotlin-gradle-subplugin-example",
":kotlin-stdlib-common",
":kotlin-stdlib",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-stdlib-js",
":examples:annotation-processor-example",
@@ -51,9 +67,11 @@ val kotlinGradlePluginAndItsRequired = arrayOf(
":kotlin-scripting-jvm",
":kotlin-scripting-compiler-embeddable",
":kotlin-scripting-compiler-impl-embeddable",
":kotlin-serialization",
":kotlin-test-js-runner",
":native:kotlin-klib-commonizer-embeddable",
":native:kotlin-klib-commonizer-api"
":native:kotlin-klib-commonizer-api",
":native:kotlin-native-utils"
)
fun Task.dependsOnKotlinGradlePluginInstall() {
@@ -80,129 +98,141 @@ fun Project.projectTest(
shortenTempRootName: Boolean = false,
jUnit5Enabled: Boolean = false,
body: Test.() -> Unit = {}
): TaskProvider<Test> = getOrCreateTask(taskName) {
doFirst {
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
val patterns = filter.includePatterns + commandLineIncludePatterns
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
patterns.forEach { pattern ->
var isClassPattern = false
val maybeMethodName = pattern.substringAfterLast('.')
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
pattern.substringBeforeLast('.')
} else {
isClassPattern = true
pattern
}
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
return@forEach
}
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
val classFileName = "$classFileNameWithoutExtension.class"
if (isClassPattern) {
val innerClassPattern = "$pattern$*"
if (pattern in commandLineIncludePatterns) {
commandLineIncludePatterns.add(innerClassPattern)
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
} else {
filter.includePatterns.add(innerClassPattern)
}
}
val parentNames = if (jUnit5Enabled) {
/*
* If we run test from inner test class with junit 5 we need
* to include all containing classes of our class
*/
val nestedNames = classFileNameWithoutExtension.split("$")
mutableListOf(nestedNames.first()).also {
for (s in nestedNames.subList(1, nestedNames.size)) {
it += "${it.last()}\$$s"
}
}
} else emptyList()
include { treeElement ->
val path = treeElement.path
if (treeElement.isDirectory) {
classFileNameWithoutExtension.startsWith(path)
} else {
if (jUnit5Enabled) {
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
} else {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
}
}
}
): TaskProvider<Test> {
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
.forUseAtConfigurationTime().orNull?.toBoolean() != true
if (shouldInstrument) {
evaluationDependsOn(":test-instrumenter")
}
if (project.findProperty("kotlin.test.instrumentation.disable")?.toString()?.toBoolean() != true) {
return getOrCreateTask<Test>(taskName) {
doFirst {
val agent = tasks.findByPath(":test-instrumenter:jar")!!.outputs.files.singleFile
val args = project.findProperty("kotlin.test.instrumentation.args")?.let { "=$it" }.orEmpty()
jvmArgs("-javaagent:$agent$args")
}
dependsOn(":test-instrumenter:jar")
}
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
val patterns = filter.includePatterns + commandLineIncludePatterns
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
patterns.forEach { pattern ->
var isClassPattern = false
val maybeMethodName = pattern.substringAfterLast('.')
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
pattern.substringBeforeLast('.')
} else {
isClassPattern = true
pattern
}
jvmArgs(
"-ea",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:+UseCodeCacheFlushing",
"-XX:ReservedCodeCacheSize=256m",
"-Djna.nosys=true"
)
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
return@forEach
}
maxHeapSize = "1600m"
systemProperty("idea.is.unit.test", "true")
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
systemProperty("java.awt.headless", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
environment("PROJECT_CLASSES_DIRS", testSourceSet.output.classesDirs.asPath)
environment("PROJECT_BUILD_DIR", buildDir)
systemProperty("jps.kotlin.home", rootProject.extra["distKotlinHomeDir"]!!)
systemProperty("kotlin.ni", if (rootProject.hasProperty("newInferenceTests")) "true" else "false")
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (rootProject.hasProperty("skipMutedTests")) "true" else "false")
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
val classFileName = "$classFileNameWithoutExtension.class"
if (Platform[202].orHigher()) {
systemProperty("idea.ignore.disabled.plugins", "true")
}
if (isClassPattern) {
val innerClassPattern = "$pattern$*"
if (pattern in commandLineIncludePatterns) {
commandLineIncludePatterns.add(innerClassPattern)
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
} else {
filter.includePatterns.add(innerClassPattern)
}
}
var subProjectTempRoot: Path? = null
doFirst {
val teamcity = rootProject.findProperty("teamcity") as? Map<*, *>
val systemTempRoot =
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
// Should be fixed soon on Teamcity side
(teamcity?.get("teamcity.build.tempDir") as? String)
?: System.getProperty("java.io.tmpdir")
systemTempRoot.let {
val prefix = (project.name + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
}
}
val parentNames = if (jUnit5Enabled) {
/*
* If we run test from inner test class with junit 5 we need
* to include all containing classes of our class
*/
val nestedNames = classFileNameWithoutExtension.split("$")
mutableListOf(nestedNames.first()).also {
for (s in nestedNames.subList(1, nestedNames.size)) {
it += "${it.last()}\$$s"
}
}
} else emptyList()
doLast {
subProjectTempRoot?.let {
try {
delete(it)
} catch (e: Exception) {
project.logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
include { treeElement ->
val path = treeElement.path
if (treeElement.isDirectory) {
classFileNameWithoutExtension.startsWith(path)
} else {
if (jUnit5Enabled) {
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
} else {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
}
}
}
}
}
if (parallel && !jUnit5Enabled) {
maxParallelForks =
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
}
body()
if (shouldInstrument) {
val instrumentationArgsProperty = project.providers.gradleProperty("kotlin.test.instrumentation.args")
val testInstrumenterOutputs = project.tasks.findByPath(":test-instrumenter:jar")!!.outputs.files
doFirst {
val agent = testInstrumenterOutputs.singleFile
val args = instrumentationArgsProperty.orNull?.let { "=$it" }.orEmpty()
jvmArgs("-javaagent:$agent$args")
}
dependsOn(":test-instrumenter:jar")
}
jvmArgs(
"-ea",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:+UseCodeCacheFlushing",
"-XX:ReservedCodeCacheSize=256m",
"-Djna.nosys=true"
)
maxHeapSize = "1600m"
systemProperty("idea.is.unit.test", "true")
systemProperty("idea.home.path", project.intellijRootDir().canonicalPath)
systemProperty("java.awt.headless", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
environment("PROJECT_CLASSES_DIRS", project.testSourceSet.output.classesDirs.asPath)
environment("PROJECT_BUILD_DIR", project.buildDir)
systemProperty("jps.kotlin.home", project.rootProject.extra["distKotlinHomeDir"]!!)
systemProperty("kotlin.ni", if (project.rootProject.hasProperty("newInferenceTests")) "true" else "false")
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (project.rootProject.hasProperty("skipMutedTests")) "true" else "false")
if (Platform[202].orHigher()) {
systemProperty("idea.ignore.disabled.plugins", "true")
}
var subProjectTempRoot: Path? = null
val projectName = project.name
val teamcity = project.rootProject.findProperty("teamcity") as? Map<*, *>
doFirst {
val systemTempRoot =
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
// Should be fixed soon on Teamcity side
(teamcity?.get("teamcity.build.tempDir") as? String)
?: System.getProperty("java.io.tmpdir")
systemTempRoot.let {
val prefix = (projectName + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
}
}
val fs = project.serviceOf<FileSystemOperations>()
doLast {
subProjectTempRoot?.let {
try {
fs.delete {
delete(it)
}
} catch (e: Exception) {
logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
}
}
}
if (parallel && !jUnit5Enabled) {
maxParallelForks =
project.providers.gradleProperty("kotlin.test.maxParallelForks").forUseAtConfigurationTime().orNull?.toInt()
?: (Runtime.getRuntime().availableProcessors() / if (project.kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
}
}.apply { configure(body) }
}
private inline fun String.isFirstChar(f: (Char) -> Boolean) = isNotEmpty() && f(first())
@@ -229,18 +259,25 @@ private fun Task.useAndroidConfiguration(systemPropertyName: String, configName:
val configuration = with(project) {
configurations.getOrCreate(configName)
.also {
dependencies.add(
configName,
dependencies.project(":dependencies:android-sdk", configuration = configName)
)
if (it.allDependencies.matching { dep ->
dep is ProjectDependency &&
dep.targetConfiguration == configName &&
dep.dependencyProject.path == ":dependencies:android-sdk"
}.count() == 0) {
dependencies.add(
configName,
dependencies.project(":dependencies:android-sdk", configuration = configName)
)
}
}
}
dependsOn(configuration)
if (this is Test) {
val androidFilePath = configuration.singleFile.canonicalPath
doFirst {
systemProperty(systemPropertyName, configuration.singleFile.canonicalPath)
systemProperty(systemPropertyName, androidFilePath)
}
}
}
@@ -252,3 +289,30 @@ fun Task.useAndroidSdk() {
fun Task.useAndroidJar() {
TaskUtils.useAndroidJar(this)
}
// Workaround to make PublishToMavenLocal compatible with Gradle configuration cache
// TODO: remove it when https://github.com/gradle/gradle/pull/16945 merged into used in build Gradle version
abstract class PublishToMavenLocalSerializable : AbstractPublishToMaven() {
private val normalizedPublication = Cached.of { this.computeNormalizedPublication() }
private fun computeNormalizedPublication(): MavenNormalizedPublication {
val publicationInternal: MavenPublicationInternal = publicationInternal
?: throw InvalidUserDataException("The 'publication' property is required")
duplicatePublicationTracker.checkCanPublishToMavenLocal(publicationInternal)
return publicationInternal.asNormalisedPublication()
}
@TaskAction
open fun publish() {
val normalizedPublication = normalizedPublication.get()
object : PublishOperation(normalizedPublication.name, "mavenLocal") {
override fun publish() {
val localPublisher = mavenPublishers.getLocalPublisher(
temporaryDirFactory
)
val validatingPublisher: MavenPublisher = ValidatingMavenPublisher(localPublisher)
validatingPublisher.publish(normalizedPublication, null)
}
}.run()
}
}

View File

@@ -9,13 +9,13 @@ import org.gradle.internal.os.OperatingSystem
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
if (extensions.findByType(TestDistributionExtension::class.java) == null) return
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
val testDistributionEnabled = project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean()
?: isTeamcityBuild
useJUnitPlatform()
extensions.configure(TestDistributionExtension::class.java) {
enabled.set(testDistributionEnabled)
enabled.set(true)
maxRemoteExecutors.set(20)
if (isTeamcityBuild) {
requirements.set(setOf("os=${OperatingSystem.current().familyName}"))

View File

@@ -262,7 +262,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
private fun getFlavorUnitTestFolder(flavourName: String): String {
return pathManager.srcFolderInAndroidTmpFolder +
"/androidTest${flavourName.capitalize()}/java/" +
"/androidTest${flavourName.replaceFirstChar(Char::uppercaseChar)}/java/" +
testClassPackage.replace(".", "/") + "/"
}
@@ -379,7 +379,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
configure(backend)
testInfo = KotlinTestInfo(
"org.jetbrains.kotlin.android.tests.AndroidRunner",
"test${testDataFile.nameWithoutExtension.capitalize()}",
"test${testDataFile.nameWithoutExtension.replaceFirstChar(Char::uppercaseChar)}",
emptySet()
)
}.build(testDataFile.path)

View File

@@ -27,7 +27,7 @@ class UnitTestFileWriter(
}
fun generate() {
FileWriter(File(flavourFolder, flavourName.capitalize() + ".java").also { it.parentFile.mkdirs() }).use { suite ->
FileWriter(File(flavourFolder, flavourName.replaceFirstChar(Char::uppercaseChar) + ".java").also { it.parentFile.mkdirs() }).use { suite ->
val p = Printer(suite)
p.println(
"""package ${CodegenTestsOnAndroidGenerator.testClassPackage};
@@ -35,7 +35,7 @@ class UnitTestFileWriter(
|import ${CodegenTestsOnAndroidGenerator.baseTestClassPackage}.${CodegenTestsOnAndroidGenerator.baseTestClassName};
|
|/* This class is generated by ${CodegenTestsOnAndroidGenerator.generatorName}. DO NOT MODIFY MANUALLY */
|public class ${flavourName.capitalize()} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|public class ${flavourName.replaceFirstChar(Char::uppercaseChar)} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
""".trimMargin()
)

View File

@@ -0,0 +1,90 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.resolve.sam.getAbstractMembers
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithNothing
class SamType constructor(val type: KotlinType) {
val classDescriptor: ClassDescriptor
get() = type.constructor.declarationDescriptor as? ClassDescriptor ?: error("Sam/Fun interface not a class descriptor: $type")
val kotlinFunctionType: KotlinType
get() = classDescriptor.defaultFunctionTypeForSamInterface!!
val originalAbstractMethod: SimpleFunctionDescriptor
get() = getAbstractMembers(classDescriptor)[0] as SimpleFunctionDescriptor
override fun equals(other: Any?): Boolean {
return other is SamType && type == other.type
}
override fun hashCode(): Int {
return type.hashCode()
}
override fun toString(): String {
return "SamType($type)"
}
}
open class SamTypeFactory {
fun createByValueParameter(valueParameter: ValueParameterDescriptor): SamType? {
val singleArgumentType: KotlinType
val originalSingleArgumentType: KotlinType?
val varargElementType = valueParameter.varargElementType
if (varargElementType != null) {
singleArgumentType = varargElementType
originalSingleArgumentType = valueParameter.original.varargElementType
assert(originalSingleArgumentType != null) {
"Value parameter and original value parameter have inconsistent varargs: " +
valueParameter + "; " + valueParameter.original
}
} else {
singleArgumentType = valueParameter.type
originalSingleArgumentType = valueParameter.original.type
}
if (singleArgumentType.isError || originalSingleArgumentType!!.isError) {
return null
}
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
// (see testData genericSamProjectedOut.kt for details)
// In such a case we can't have a proper supertype since wildcards are not allowed there,
// so we use Nothing arguments instead that leads to a raw type used for a SAM wrapper.
// See org.jetbrains.kotlin.codegen.state.KotlinTypeMapper#writeGenericType to understand how
// raw types and Nothing arguments relate.
val originalTypeToUse =
if (KotlinBuiltIns.isNothing(singleArgumentType))
originalSingleArgumentType.replaceArgumentsWithNothing()
else singleArgumentType
return create(originalTypeToUse.removeExternalProjections())
}
open fun isSamType(type: KotlinType): Boolean {
val descriptor = type.constructor.declarationDescriptor
return descriptor is ClassDescriptor && descriptor.isFun
}
fun create(originalType: KotlinType): SamType? {
return if (isSamType(originalType)) SamType(originalType) else null
}
private fun KotlinType.removeExternalProjections(): KotlinType {
val newArguments = arguments.map { TypeProjectionImpl(Variance.INVARIANT, it.type) }
return replace(newArguments)
}
companion object {
val INSTANCE = SamTypeFactory()
}
}

View File

@@ -18,7 +18,7 @@ fun mangleNameIfNeeded(name: String): String {
if (c.isValidCharacter()) {
append(c)
} else {
val hexString = Integer.toHexString(c.toInt())
val hexString = Integer.toHexString(c.code)
assert(hexString.length <= 4)
append("_u").append(hexString)
}

View File

@@ -1,13 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen
import org.jetbrains.org.objectweb.asm.Opcodes
// This object should help compiling against different ASM versions from different bunch versions
object VersionIndependentOpcodes {
const val ACC_RECORD = 0
}

View File

@@ -116,6 +116,12 @@ object AbstractTypeMapper {
return asmType
}
typeConstructor.isScript() -> {
val asmType = AsmTypes.JAVA_CLASS_TYPE
with(context) { sw?.writeGenericType(type, asmType, mode) }
return asmType
}
typeConstructor.isTypeParameter() -> {
val typeParameter = typeConstructor as TypeParameterMarker
return mapType(context, typeParameter.representativeUpperBound(), mode, null).also { asmType ->

View File

@@ -1,158 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.codegen;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.FileMapping;
import org.jetbrains.kotlin.codegen.inline.SMAPBuilder;
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.*;
import java.util.List;
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP;
public abstract class AbstractClassBuilder implements ClassBuilder {
protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {};
protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {};
private String thisName;
private final JvmSerializationBindings serializationBindings = new JvmSerializationBindings();
private String sourceName;
private String debugInfo;
public static class Concrete extends AbstractClassBuilder {
private final ClassVisitor v;
public Concrete(@NotNull ClassVisitor v) {
this.v = v;
}
@Override
@NotNull
public ClassVisitor getVisitor() {
return v;
}
}
@Override
@NotNull
public FieldVisitor newField(
@NotNull JvmDeclarationOrigin origin,
int access,
@NotNull String name,
@NotNull String desc,
@Nullable String signature,
@Nullable Object value
) {
FieldVisitor visitor = getVisitor().visitField(access, name, desc, signature, value);
if (visitor == null) {
return EMPTY_FIELD_VISITOR;
}
return visitor;
}
@Override
@NotNull
public MethodVisitor newMethod(
@NotNull JvmDeclarationOrigin origin,
int access,
@NotNull String name,
@NotNull String desc,
@Nullable String signature,
@Nullable String[] exceptions
) {
MethodVisitor visitor = getVisitor().visitMethod(access, name, desc, signature, exceptions);
if (visitor == null) {
return EMPTY_METHOD_VISITOR;
}
return visitor;
}
@Override
@NotNull
public JvmSerializationBindings getSerializationBindings() {
return serializationBindings;
}
@Override
@NotNull
public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) {
return getVisitor().visitAnnotation(desc, visible);
}
@Override
public void done() {
getVisitor().visitSource(sourceName, debugInfo);
getVisitor().visitEnd();
}
@Override
public void defineClass(
@Nullable PsiElement origin,
int version,
int access,
@NotNull String name,
@Nullable String signature,
@NotNull String superName,
@NotNull String[] interfaces
) {
thisName = name;
getVisitor().visit(version, access, name, signature, superName, interfaces);
}
@Override
public void visitSource(@NotNull String name, @Nullable String debug) {
assert sourceName == null || sourceName.equals(name) : "inconsistent file name: " + sourceName + " vs " + name;
sourceName = name;
debugInfo = debug;
}
@Override
public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) {
if (!GENERATE_SMAP) return;
List<FileMapping> fileMappings = smap.getResultMappings();
if (fileMappings.isEmpty()) return;
visitSource(fileMappings.get(0).getName(), SMAPBuilder.INSTANCE.build(fileMappings, backwardsCompatibleSyntax));
}
@Override
public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) {
getVisitor().visitOuterClass(owner, name, desc);
}
@Override
public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) {
getVisitor().visitInnerClass(name, outerName, innerName, access);
}
@Override
@NotNull
public String getThisName() {
assert thisName != null : "This name isn't set";
return thisName;
}
}

View File

@@ -51,7 +51,6 @@ interface BaseExpressionCodegen {
fun consumeReifiedOperationMarker(typeParameter: TypeParameterMarker)
@JvmDefault
fun putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind) {
with(typeSystem) {
val (typeParameter, second) = extractReificationArgument(type) ?: return

View File

@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.codegen.state.StaticTypeMapperForOldBackend
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
@@ -51,7 +52,7 @@ class CallableMethod(
override fun genInvokeInstruction(v: InstructionAdapter) {
if (boxInlineClassBeforeInvoke) {
StackValue.boxInlineClass(dispatchReceiverKotlinType!!, v)
StackValue.boxInlineClass(dispatchReceiverKotlinType!!, v, StaticTypeMapperForOldBackend)
}
v.visitMethodInsn(
invokeOpcode,

View File

@@ -1,79 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.codegen;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.*;
public interface ClassBuilder {
@NotNull
FieldVisitor newField(
@NotNull JvmDeclarationOrigin origin,
int access,
@NotNull String name,
@NotNull String desc,
@Nullable String signature,
@Nullable Object value
);
@NotNull
MethodVisitor newMethod(
@NotNull JvmDeclarationOrigin origin,
int access,
@NotNull String name,
@NotNull String desc,
@Nullable String signature,
@Nullable String[] exceptions
);
@NotNull
JvmSerializationBindings getSerializationBindings();
@NotNull
AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible);
void done();
@NotNull
ClassVisitor getVisitor();
void defineClass(
@Nullable PsiElement origin,
int version,
int access,
@NotNull String name,
@Nullable String signature,
@NotNull String superName,
@NotNull String[] interfaces
);
void visitSource(@NotNull String name, @Nullable String debug);
void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax);
void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc);
void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access);
@NotNull
String getThisName();
}

View File

@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen
@Suppress("UNUSED_PARAMETER", "unused")
fun ClassBuilder.addRecordComponent(name: String, desc: String, signature: String?) {
// newRecordComponent(name, desc, signature)
}

View File

@@ -52,13 +52,14 @@ import org.jetbrains.org.objectweb.asm.Type;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.getMappingFileName;
public class ClassFileFactory implements OutputFileCollection {
private final GenerationState state;
private final ClassBuilderFactory builderFactory;
private final Map<String, OutAndSourceFileList> generators = new LinkedHashMap<>();
private final Map<String, OutAndSourceFileList> generators = Collections.synchronizedMap(new LinkedHashMap<>());
private boolean isDone = false;
@@ -346,7 +347,9 @@ public class ClassFileFactory implements OutputFileCollection {
@Override
public byte[] asBytes(ClassBuilderFactory factory) {
return factory.asBytes(classBuilder);
synchronized(this) {
return factory.asBytes(classBuilder);
}
}
@Override

View File

@@ -40,6 +40,7 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.SimpleType;
import org.jetbrains.kotlin.backend.common.SamType;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
import org.jetbrains.kotlin.util.OperatorNameConventions;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
@@ -157,7 +158,14 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
for (int i = 0; i < superInterfaceTypes.size(); i++) {
KotlinType superInterfaceType = superInterfaceTypes.get(i);
sw.writeInterface();
superInterfaceAsmTypes[i] = typeMapper.mapSupertype(superInterfaceType, sw).getInternalName();
Type superInterfaceAsmType;
if (samType != null && superInterfaceType.getConstructor() == samType.getType().getConstructor()) {
superInterfaceAsmType = typeMapper.mapSupertype(superInterfaceType, null);
sw.writeAsmType(superInterfaceAsmType);
} else {
superInterfaceAsmType = typeMapper.mapSupertype(superInterfaceType, sw);
}
superInterfaceAsmTypes[i] = superInterfaceAsmType.getInternalName();
sw.writeInterfaceEnd();
}

View File

@@ -1,118 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.codegen;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.*;
public abstract class DelegatingClassBuilder implements ClassBuilder {
@NotNull
protected abstract ClassBuilder getDelegate();
@NotNull
@Override
public FieldVisitor newField(
@NotNull JvmDeclarationOrigin origin,
int access,
@NotNull String name,
@NotNull String desc,
@Nullable String signature,
@Nullable Object value
) {
return getDelegate().newField(origin, access, name, desc, signature, value);
}
@NotNull
@Override
public MethodVisitor newMethod(
@NotNull JvmDeclarationOrigin origin,
int access,
@NotNull String name,
@NotNull String desc,
@Nullable String signature,
@Nullable String[] exceptions
) {
return getDelegate().newMethod(origin, access, name, desc, signature, exceptions);
}
@NotNull
@Override
public JvmSerializationBindings getSerializationBindings() {
return getDelegate().getSerializationBindings();
}
@NotNull
@Override
public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) {
return getDelegate().newAnnotation(desc, visible);
}
@Override
public void done() {
getDelegate().done();
}
@NotNull
@Override
public ClassVisitor getVisitor() {
return getDelegate().getVisitor();
}
@Override
public void defineClass(
@Nullable PsiElement origin,
int version,
int access,
@NotNull String name,
@Nullable String signature,
@NotNull String superName,
@NotNull String[] interfaces
) {
getDelegate().defineClass(origin, version, access, name, signature, superName, interfaces);
}
@Override
public void visitSource(@NotNull String name, @Nullable String debug) {
getDelegate().visitSource(name, debug);
}
@Override
public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) {
getDelegate().visitSMAP(smap, backwardsCompatibleSyntax);
}
@Override
public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) {
getDelegate().visitOuterClass(owner, name, desc);
}
@Override
public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) {
getDelegate().visitInnerClass(name, outerName, innerName, access);
}
@NotNull
@Override
public String getThisName() {
return getDelegate().getThisName();
}
}

View File

@@ -88,9 +88,11 @@ import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.ClassicTypeSystemContextImpl;
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS;
import org.jetbrains.kotlin.types.model.KotlinTypeMarker;
import org.jetbrains.kotlin.types.model.TypeParameterMarker;
import org.jetbrains.kotlin.types.typesApproximation.CapturedTypeApproximationKt;
import org.jetbrains.kotlin.util.OperatorNameConventions;
import org.jetbrains.kotlin.backend.common.SamType;
import org.jetbrains.org.objectweb.asm.Label;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
import org.jetbrains.org.objectweb.asm.Opcodes;
@@ -3007,7 +3009,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
@NotNull
private KotlinType approximateCapturedType(@NotNull KotlinType type) {
if (state.getLanguageVersionSettings().supportsFeature(LanguageFeature.NewInference)) {
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns());
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns(), state.getLanguageVersionSettings());
KotlinType approximatedType =
TypeUtils.contains(type, (containedType) -> CapturedTypeConstructorKt.isCaptured(containedType)) ?
@@ -5532,4 +5534,11 @@ The "returned" value of try expression with no finally is either the last expres
parentCodegen.getReifiedTypeParametersUsages().addUsedReifiedParameter(typeParameterDescriptor.getName().asString());
}
}
@Override
public void putReifiedOperationMarkerIfTypeIsReifiedParameter(
@NotNull KotlinTypeMarker type, @NotNull ReifiedTypeInliner.OperationKind operationKind
) {
BaseExpressionCodegen.DefaultImpls.putReifiedOperationMarkerIfTypeIsReifiedParameter(this, type, operationKind);
}
}

View File

@@ -34,7 +34,8 @@ import org.jetbrains.org.objectweb.asm.commons.Method;
import java.util.List;
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
import static org.jetbrains.kotlin.codegen.AsmUtil.correctElementType;
import static org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive;
import static org.jetbrains.kotlin.codegen.DescriptorAsmUtil.*;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.JAVA_STRING_TYPE;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
@@ -306,7 +307,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
iv.load(secondParameterIndex, OBJECT_TYPE);
iv.checkcast(wrapperType);
StackValue.unboxInlineClass(wrapperType, wrapperKotlinType, iv);
StackValue.unboxInlineClass(wrapperType, wrapperKotlinType, iv, typeMapper);
iv.store(unboxedValueIndex, underlyingType.getType());
return unboxedValueIndex;

View File

@@ -188,6 +188,12 @@ class JvmRuntimeTypes(
else -> if (isMutable) mutablePropertyReferences else propertyReferences
}
return classes[arity].defaultType
return if (arity >= 0) {
classes[arity].defaultType
} else {
//in case of ErrorUtils.ERROR_PROPERTY there would be no dispatchReceiverParameter and arity becomes negative
//so we just take zero argument reference class (because it is incorrect anyway)
classes[0].defaultType
}
}
}

View File

@@ -0,0 +1,14 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.backend.common.SamTypeFactory
object JvmSamTypeFactory : SamTypeFactory() {
override fun isSamType(type: KotlinType) = JavaSingleAbstractMethodUtils.isSamType(type)
}

View File

@@ -34,9 +34,13 @@ import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtTypeAlias
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.MemberComparator
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_SYNTHETIC_ANNOTATION_FQ_NAME
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
@@ -125,8 +129,19 @@ class MultifileClassCodegenImpl(
val superClassForFacade = if (shouldGeneratePartHierarchy) partInternalNamesSorted.last() else J_L_OBJECT
state.factory.newVisitor(MultifileClass(files.firstOrNull(), actualPackageFragment), facadeClassType, files).apply {
var attributes = FACADE_CLASS_ATTRIBUTES
val nonJvmSyntheticParts = files.filterNot { it.isJvmSynthetic() }
if (nonJvmSyntheticParts.isEmpty()) {
attributes = attributes or Opcodes.ACC_SYNTHETIC
} else if (nonJvmSyntheticParts.size < files.size) {
for (part in nonJvmSyntheticParts) {
state.diagnostics.report(ErrorsJvm.NOT_ALL_MULTIFILE_CLASS_PARTS_ARE_JVM_SYNTHETIC.on(part.packageDirective ?: part))
}
}
defineClass(
singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
singleSourceFile, state.classFileVersion, attributes,
facadeClassType.internalName, null, superClassForFacade, emptyArray()
)
if (singleSourceFile != null) {
@@ -146,6 +161,13 @@ class MultifileClassCodegenImpl(
}
}
private fun KtFile.isJvmSynthetic(): Boolean {
return annotationEntries.any { entry ->
val descriptor = state.bindingContext[BindingContext.ANNOTATION, entry]
descriptor?.annotationClass?.let(DescriptorUtils::getFqNameSafe) == JVM_SYNTHETIC_ANNOTATION_FQ_NAME
}
}
override fun generate() {
assert(delegateGenerationTasks.isEmpty()) { "generate() is called twice for facade class $facadeFqName" }

View File

@@ -1,117 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.codegen.state.TypeMapperUtilsKt;
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor;
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils;
import org.jetbrains.kotlin.resolve.sam.SamConversionResolverImplKt;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.KotlinTypeKt;
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
public class SamType {
@Nullable
public static SamType createByValueParameter(@NotNull ValueParameterDescriptor valueParameter) {
KotlinType singleArgumentType;
KotlinType originalSingleArgumentType;
KotlinType varargElementType = valueParameter.getVarargElementType();
if (varargElementType != null) {
singleArgumentType = varargElementType;
originalSingleArgumentType = valueParameter.getOriginal().getVarargElementType();
assert originalSingleArgumentType != null :
"Value parameter and original value parameter have inconsistent varargs: " +
valueParameter + "; " + valueParameter.getOriginal();
} else {
singleArgumentType = valueParameter.getType();
originalSingleArgumentType = valueParameter.getOriginal().getType();
}
if (KotlinTypeKt.isError(singleArgumentType) || KotlinTypeKt.isError(originalSingleArgumentType)) {
return null;
}
KotlinType originalTypeToUse =
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
// (see testData genericSamProjectedOut.kt for details)
KotlinBuiltIns.isNothing(singleArgumentType)
// In such a case we can't have a proper supertype since wildcards are not allowed there,
// so we use Nothing arguments instead that leads to a raw type used for a SAM wrapper.
// See org.jetbrains.kotlin.codegen.state.KotlinTypeMapper#writeGenericType to understand how
// raw types and Nothing arguments relate.
? TypeUtilsKt.replaceArgumentsWithNothing(originalSingleArgumentType)
: singleArgumentType;
return create(TypeMapperUtilsKt.removeExternalProjections(originalTypeToUse));
}
public static SamType create(@NotNull KotlinType originalType) {
if (!JavaSingleAbstractMethodUtils.isSamType(originalType)) return null;
return new SamType(originalType);
}
private final KotlinType type;
private SamType(@NotNull KotlinType type) {
this.type = type;
}
@NotNull
public KotlinType getType() {
return type;
}
@NotNull
public ClassDescriptor getClassDescriptor() {
ClassifierDescriptor classifier = type.getConstructor().getDeclarationDescriptor();
assert classifier instanceof ClassDescriptor : "Sam/Fun interface not a class descriptor: " + classifier;
return (ClassDescriptor) classifier;
}
@NotNull
public KotlinType getKotlinFunctionType() {
ClassDescriptor descriptor = getClassDescriptor();
//noinspection ConstantConditions
return descriptor.getDefaultFunctionTypeForSamInterface();
}
@NotNull
public SimpleFunctionDescriptor getOriginalAbstractMethod() {
return (SimpleFunctionDescriptor) SamConversionResolverImplKt.getAbstractMembers(getClassDescriptor()).get(0);
}
@Override
public boolean equals(Object o) {
return o instanceof SamType && type.equals(((SamType) o).type);
}
@Override
public int hashCode() {
return type.hashCode();
}
@Override
public String toString() {
return "SamType(" + type + ")";
}
}

View File

@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.inline.InlineUtil
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.kotlin.backend.common.SamType
class SamWrapperClasses(private val state: GenerationState) {

View File

@@ -38,6 +38,7 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.backend.common.SamType;
import org.jetbrains.kotlin.util.OperatorNameConventions;
import org.jetbrains.org.objectweb.asm.Label;
import org.jetbrains.org.objectweb.asm.MethodVisitor;

View File

@@ -20,11 +20,14 @@ import org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenUtilKt;
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods;
import org.jetbrains.kotlin.codegen.pseudoInsns.PseudoInsnsKt;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapperBase;
import org.jetbrains.kotlin.codegen.state.StaticTypeMapperForOldBackend;
import org.jetbrains.kotlin.config.LanguageFeature;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor;
import org.jetbrains.kotlin.load.java.DescriptorsJvmAbiUtil;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.KtExpression;
import org.jetbrains.kotlin.psi.ValueArgument;
@@ -43,6 +46,7 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.SimpleType;
import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.kotlin.types.model.KotlinTypeMarker;
import org.jetbrains.org.objectweb.asm.Label;
import org.jetbrains.org.objectweb.asm.Opcodes;
import org.jetbrains.org.objectweb.asm.Type;
@@ -452,11 +456,13 @@ public abstract class StackValue {
v.invokevirtual(methodOwner.getInternalName(), type.getClassName() + "Value", "()" + type.getDescriptor(), false);
}
public static void boxInlineClass(@NotNull KotlinType kotlinType, @NotNull InstructionAdapter v) {
Type boxedType = KotlinTypeMapper.mapInlineClassTypeAsDeclaration(kotlinType);
Type underlyingType = KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(kotlinType);
public static void boxInlineClass(
@NotNull KotlinTypeMarker kotlinType, @NotNull InstructionAdapter v, @NotNull KotlinTypeMapperBase typeMapper
) {
Type boxedType = typeMapper.mapTypeCommon(kotlinType, TypeMappingMode.CLASS_DECLARATION);
Type underlyingType = KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(kotlinType, typeMapper);
if (TypeUtils.isNullableType(kotlinType) && !isPrimitive(underlyingType)) {
if (typeMapper.getTypeSystem().isNullableType(kotlinType) && !isPrimitive(underlyingType)) {
boxOrUnboxWithNullCheck(v, vv -> invokeBoxMethod(vv, boxedType, underlyingType));
}
else {
@@ -477,14 +483,19 @@ public abstract class StackValue {
);
}
public static void unboxInlineClass(@NotNull Type type, @NotNull KotlinType targetInlineClassType, @NotNull InstructionAdapter v) {
Type owner = KotlinTypeMapper.mapInlineClassTypeAsDeclaration(targetInlineClassType);
public static void unboxInlineClass(
@NotNull Type type,
@NotNull KotlinTypeMarker targetInlineClassType,
@NotNull InstructionAdapter v,
@NotNull KotlinTypeMapperBase typeMapper
) {
Type owner = typeMapper.mapTypeCommon(targetInlineClassType, TypeMappingMode.CLASS_DECLARATION);
coerce(type, owner, v);
Type resultType = KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(targetInlineClassType);
Type resultType = KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(targetInlineClassType, typeMapper);
if (TypeUtils.isNullableType(targetInlineClassType) && !isPrimitive(resultType)) {
if (typeMapper.getTypeSystem().isNullableType(targetInlineClassType) && !isPrimitive(resultType)) {
boxOrUnboxWithNullCheck(v, vv -> invokeUnboxMethod(vv, owner, resultType));
}
else {
@@ -537,7 +548,7 @@ public abstract class StackValue {
@Nullable KotlinType toKotlinType,
@NotNull InstructionAdapter v
) {
if (coerceInlineClasses(fromType, fromKotlinType, toType, toKotlinType, v)) return;
if (coerceInlineClasses(fromType, fromKotlinType, toType, toKotlinType, v, StaticTypeMapperForOldBackend.INSTANCE)) return;
coerce(fromType, toType, v);
}
@@ -573,7 +584,8 @@ public abstract class StackValue {
@Nullable KotlinType fromKotlinType,
@NotNull Type toType,
@Nullable KotlinType toKotlinType,
@NotNull InstructionAdapter v
@NotNull InstructionAdapter v,
@NotNull KotlinTypeMapperBase typeMapper
) {
// NB see also requiresInlineClassBoxingOrUnboxing above
@@ -600,23 +612,23 @@ public abstract class StackValue {
boolean isFromTypeUnboxed = isUnboxedInlineClass(fromKotlinType, fromType);
boolean isToTypeUnboxed = isUnboxedInlineClass(toKotlinType, toType);
if (isFromTypeUnboxed && !isToTypeUnboxed) {
boxInlineClass(fromKotlinType, v);
boxInlineClass(fromKotlinType, v, typeMapper);
return true;
}
else if (!isFromTypeUnboxed && isToTypeUnboxed) {
unboxInlineClass(fromType, toKotlinType, v);
unboxInlineClass(fromType, toKotlinType, v, typeMapper);
return true;
}
}
else if (isFromTypeInlineClass) {
if (isUnboxedInlineClass(fromKotlinType, fromType)) {
boxInlineClass(fromKotlinType, v);
boxInlineClass(fromKotlinType, v, typeMapper);
return true;
}
}
else { // isToTypeInlineClass is `true`
if (isUnboxedInlineClass(toKotlinType, toType)) {
unboxInlineClass(fromType, toKotlinType, v);
unboxInlineClass(fromType, toKotlinType, v, typeMapper);
return true;
}
}
@@ -625,7 +637,7 @@ public abstract class StackValue {
}
public static boolean isUnboxedInlineClass(@NotNull KotlinType kotlinType, @NotNull Type actualType) {
return KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(kotlinType).equals(actualType);
return KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(kotlinType, StaticTypeMapperForOldBackend.INSTANCE).equals(actualType);
}
public static void coerce(@NotNull Type fromType, @NotNull Type toType, @NotNull InstructionAdapter v) {

View File

@@ -56,6 +56,7 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.backend.common.SamType;
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
import org.jetbrains.org.objectweb.asm.Type;
@@ -861,7 +862,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
if (valueArguments == null) return;
for (ValueParameterDescriptor valueParameter : valueParametersWithSAMConversion) {
SamType samType = SamType.createByValueParameter(valueParameter);
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(valueParameter);
if (samType == null) continue;
ResolvedValueArgument resolvedValueArgument = valueArguments.get(valueParameter.getIndex());
@@ -873,7 +874,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
}
private void recordSamTypeOnArgumentExpression(ValueParameterDescriptor valueParameter, ValueArgument valueArgument) {
SamType samType = SamType.createByValueParameter(valueParameter);
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(valueParameter);
if (samType == null) return;
recordSamTypeOnArgumentExpression(samType, valueArgument);
@@ -955,7 +956,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
bindingTrace.record(SAM_CONSTRUCTOR_TO_ARGUMENT, expression, argumentExpression);
//noinspection ConstantConditions
SamType samType = SamType.create(callableDescriptor.getReturnType());
SamType samType = JvmSamTypeFactory.INSTANCE.create(callableDescriptor.getReturnType());
bindingTrace.record(SAM_VALUE, argumentExpression, samType);
}
@@ -972,7 +973,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
FunctionDescriptor original = SamCodegenUtil.getOriginalIfSamAdapter((FunctionDescriptor) operationDescriptor);
if (original == null) return;
SamType samType = SamType.createByValueParameter(original.getValueParameters().get(0));
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(original.getValueParameters().get(0));
if (samType == null) return;
IElementType token = expression.getOperationToken();
@@ -1001,7 +1002,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
List<KtExpression> indexExpressions = expression.getIndexExpressions();
List<ValueParameterDescriptor> parameters = original.getValueParameters();
for (ValueParameterDescriptor valueParameter : parameters) {
SamType samType = SamType.createByValueParameter(valueParameter);
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(valueParameter);
if (samType == null) continue;
if (isSetter && valueParameter.getIndex() == parameters.size() - 1) {

View File

@@ -12,7 +12,7 @@ import kotlin.collections.CollectionsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.JvmCodegenUtil;
import org.jetbrains.kotlin.codegen.SamType;
import org.jetbrains.kotlin.backend.common.SamType;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.when.WhenByEnumsMapping;
import org.jetbrains.kotlin.descriptors.*;

View File

@@ -28,7 +28,7 @@ object ChangeBoxingMethodTransformer : MethodTransformer() {
val map = hashMapOf<String, String>()
for (primitiveType in JvmPrimitiveType.values()) {
val name = primitiveType.wrapperFqName.topLevelClassInternalName()
map[name] = "box${primitiveType.javaKeywordName.capitalize(Locale.US)}"
map[name] = "box${primitiveType.javaKeywordName.replaceFirstChar(Char::uppercaseChar)}"
}
wrapperToInternalBoxing = map
}

View File

@@ -450,7 +450,7 @@ class CoroutineCodegenForLambda private constructor(
if (parameter.type.isInlineClassType()) {
load(cloneIndex, fieldInfoForCoroutineLambdaParameter.ownerType)
load(index, AsmTypes.OBJECT_TYPE)
StackValue.unboxInlineClass(AsmTypes.OBJECT_TYPE, parameter.type, this)
StackValue.unboxInlineClass(AsmTypes.OBJECT_TYPE, parameter.type, this, typeMapper)
putfield(
fieldInfoForCoroutineLambdaParameter.ownerInternalName,
fieldInfoForCoroutineLambdaParameter.fieldName,
@@ -756,7 +756,7 @@ class CoroutineCodegenForNamedFunction private constructor(
generateCoroutineSuspendedCheck(languageVersionSettings)
// Now we box the inline class
StackValue.coerce(AsmTypes.OBJECT_TYPE, typeMapper.mapType(inlineClassToBoxInInvokeSuspend), this)
StackValue.boxInlineClass(inlineClassToBoxInInvokeSuspend, this)
StackValue.boxInlineClass(inlineClassToBoxInInvokeSuspend, this, typeMapper)
}
}
@@ -860,4 +860,4 @@ fun reportSuspensionPointInsideMonitor(element: KtElement, state: GenerationStat
}
private fun FunctionDescriptor.allValueParameterTypes(): List<KotlinType> =
(listOfNotNull(extensionReceiverParameter?.type)) + valueParameters.map { it.type }
(listOfNotNull(extensionReceiverParameter?.type)) + valueParameters.map { it.type }

View File

@@ -201,20 +201,38 @@ class CoroutineTransformerMethodVisitor(
// When suspension point is inlined, it is in range of fake inliner variables.
// Path from TABLESWITCH into unspilling goes to latter part of the range.
// In this case the variables are uninitialized, initialize them
// In this case the variables are uninitialized, initialize them, and split the local variable
// range so that the local variable is only defined when initialized.
private fun initializeFakeInlinerVariables(methodNode: MethodNode, stateLabels: List<LabelNode>) {
for (stateLabel in stateLabels) {
val newRecords = mutableListOf<LocalVariableNode>()
for (record in methodNode.localVariables) {
if (isFakeLocalVariableForInline(record.name) &&
methodNode.instructions.indexOf(record.start) < methodNode.instructions.indexOf(stateLabel) &&
methodNode.instructions.indexOf(stateLabel) < methodNode.instructions.indexOf(record.end)
) {
val newEnd = record.end
val newStart = LabelNode()
record.end = stateLabel
methodNode.instructions.insert(stateLabel, withInstructionAdapter {
iconst(0)
store(record.index, Type.INT_TYPE)
}.also {
it.add(newStart)
})
newRecords.add(
LocalVariableNode(
record.name,
record.desc,
record.signature,
newStart,
newEnd,
record.index
)
)
}
}
methodNode.localVariables.addAll(newRecords)
}
}
@@ -981,7 +999,7 @@ class CoroutineTransformerMethodVisitor(
else -> next = next.next
}
}
return next
return null
}
// It's necessary to preserve some sensible invariants like there should be no jump in the middle of try-catch-block
@@ -1311,7 +1329,7 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
variable.desc,
variable.signature,
variable.start,
nextSuspensionPointStartLabel(variable.start),
min(variable.end, nextSuspensionPointStartLabel(variable.start)),
variable.index
)
)

View File

@@ -9,15 +9,16 @@ import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.utils.threadLocal
import java.util.*
class GlobalInlineContext(private val diagnostics: DiagnosticSink) {
// Ordered set of declarations and inline calls being generated right now.
// No call in it should point to a declaration that's before it in the stack.
private val inlineCallsAndDeclarations = LinkedList<Any? /* CallableDescriptor | PsiElement? */>()
private val inlineDeclarationSet = mutableSetOf<CallableDescriptor>()
private val inlineCallsAndDeclarations by threadLocal { LinkedList<Any? /* CallableDescriptor | PsiElement? */>() }
private val inlineDeclarationSet by threadLocal { mutableSetOf<CallableDescriptor>() }
private val typesUsedInInlineFunctions = LinkedList<MutableSet<String>>()
private val typesUsedInInlineFunctions by threadLocal { LinkedList<MutableSet<String>>() }
fun enterDeclaration(descriptor: CallableDescriptor) {
assert(descriptor.original !in inlineDeclarationSet) { "entered inlining cycle on $descriptor" }

View File

@@ -28,12 +28,14 @@ class InlineCache {
}
inline fun <K, V : Any> SLRUMap<K, V>.getOrPut(key: K, defaultValue: () -> V): V {
val value = get(key)
return if (value == null) {
val answer = defaultValue()
put(key, answer)
answer
} else {
value
synchronized(this) {
val value = get(key)
return if (value == null) {
val answer = defaultValue()
put(key, answer)
answer
} else {
value
}
}
}

View File

@@ -6,7 +6,6 @@
package org.jetbrains.kotlin.codegen.inline
import com.intellij.psi.PsiElement
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive
@@ -108,11 +107,9 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
)
}
protected fun generateStub(resolvedCall: ResolvedCall<*>?, codegen: BaseExpressionCodegen) {
protected fun generateStub(text: String, codegen: BaseExpressionCodegen) {
leaveTemps()
assert(resolvedCall != null)
val message = "Call is part of inline cycle: " + resolvedCall!!.call.callElement.text
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", message)
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", "Call is part of inline cycle: $text")
}
protected fun endCall(result: InlineResult, registerLineNumberAfterwards: Boolean) {
@@ -483,7 +480,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
assert(constantValue is Int) { "Mask should be of Integer type, but " + constantValue }
maskValues.add(constantValue as Int)
if (maskStartIndex == -1) {
maskStartIndex = invocationParamBuilder.listAllParams().sumBy {
maskStartIndex = invocationParamBuilder.listAllParams().sumOf {
if (it is CapturedParamInfo) 0 else it.type.size
}
}
@@ -601,14 +598,6 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
return (directMember as? ImportedFromObjectCallableDescriptor<*>)?.callableFromObject ?: directMember
}
private fun cloneMethodNode(methodNode: MethodNode): MethodNode {
methodNode.instructions.resetLabels()
return MethodNode(
Opcodes.API_VERSION, methodNode.access, methodNode.name, methodNode.desc, methodNode.signature,
ArrayUtil.toStringArray(methodNode.exceptions)
).also(methodNode::accept)
}
private fun doCreateMethodNodeFromCompiled(
callableDescriptor: CallableMemberDescriptor,
state: GenerationState,

View File

@@ -1086,7 +1086,7 @@ class MethodInliner(
"Number of expected and actual parameters should be equal, but ${actualParams.size} != ${directOrder.size}!"
}
var currentShift = shift + directOrder.sumBy { it.size }
var currentShift = shift + directOrder.sumOf { it.size }
val safeToUseArgumentKotlinType =
directOrder.size == directOrderOfArguments.size && directOrderOfArguments.size == directOrderOfInvokeParameters.size

View File

@@ -24,13 +24,13 @@ class Parameters(val parameters: List<ParameterInfo>) : Iterable<ParameterInfo>
private val actualDeclShifts: Array<ParameterInfo?>
private val paramToDeclByteCodeIndex: HashMap<ParameterInfo, Int> = hashMapOf()
val argsSizeOnStack = parameters.sumBy { it.type.size }
val argsSizeOnStack = parameters.sumOf { it.type.size }
val realParametersSizeOnStack: Int
get() = argsSizeOnStack - capturedParametersSizeOnStack
val capturedParametersSizeOnStack by lazy {
captured.sumBy { it.type.size }
captured.sumOf { it.type.size }
}
val captured by lazy {

View File

@@ -60,8 +60,8 @@ class PsiInlineCodegen(
callDefault: Boolean,
codegen: ExpressionCodegen
) {
if (!state.globalInlineContext.enterIntoInlining(resolvedCall?.resultingDescriptor, resolvedCall?.call?.callElement)) {
generateStub(resolvedCall, codegen)
if (!state.globalInlineContext.enterIntoInlining(functionDescriptor, resolvedCall?.call?.callElement)) {
generateStub(resolvedCall?.call?.callElement?.text ?: "<no source>", codegen)
return
}
try {

View File

@@ -7,8 +7,11 @@ package org.jetbrains.kotlin.codegen.inline
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.ASSERTIONS_DISABLED_FIELD_NAME
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.BaseExpressionCodegen
import org.jetbrains.kotlin.codegen.SamWrapperCodegen.SAM_WRAPPER_SUFFIX
import org.jetbrains.kotlin.codegen.StackValue
import org.jetbrains.kotlin.codegen.`when`.WhenByEnumsMapping
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
import org.jetbrains.kotlin.codegen.context.CodegenContext
@@ -22,6 +25,7 @@ import org.jetbrains.kotlin.codegen.optimization.common.asSequence
import org.jetbrains.kotlin.codegen.optimization.common.intConstant
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapperBase
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
import org.jetbrains.kotlin.load.java.JvmAbi
@@ -32,9 +36,9 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeProjectionImpl
import org.jetbrains.kotlin.types.TypeSubstitutor
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
import org.jetbrains.kotlin.util.OperatorNameConventions
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import org.jetbrains.org.objectweb.asm.*
@@ -415,13 +419,13 @@ fun addInlineMarker(v: InstructionAdapter, isStartNotEnd: Boolean) {
internal fun addUnboxInlineClassMarkersIfNeeded(v: InstructionAdapter, descriptor: CallableDescriptor, typeMapper: KotlinTypeMapper) {
val inlineClass = (descriptor as? FunctionDescriptor)?.originalReturnTypeOfSuspendFunctionReturningUnboxedInlineClass(typeMapper)
if (inlineClass != null) {
generateResumePathUnboxing(v, inlineClass)
generateResumePathUnboxing(v, inlineClass, typeMapper)
}
}
fun generateResumePathUnboxing(v: InstructionAdapter, inlineClass: KotlinType) {
fun generateResumePathUnboxing(v: InstructionAdapter, inlineClass: KotlinTypeMarker, typeMapper: KotlinTypeMapperBase) {
addBeforeUnboxInlineClassMarker(v)
StackValue.unboxInlineClass(AsmTypes.OBJECT_TYPE, inlineClass, v)
StackValue.unboxInlineClass(AsmTypes.OBJECT_TYPE, inlineClass, v, typeMapper)
// Suspend functions always returns Any?, but the unboxing disrupts type analysis of the bytecode.
// For example, if the underlying type is String, CHECKCAST String is removed.
// However, the unboxing is moved to the resume path, the direct path still has Any?, but now, without the CHECKCAST.
@@ -625,3 +629,13 @@ fun MethodNode.preprocessSuspendMarkers(forInline: Boolean, keepFakeContinuation
}
}
}
fun cloneMethodNode(methodNode: MethodNode): MethodNode {
synchronized(methodNode) {
methodNode.instructions.resetLabels()
return MethodNode(
Opcodes.API_VERSION, methodNode.access, methodNode.name, methodNode.desc, methodNode.signature,
methodNode.exceptions.toTypedArray()
).also(methodNode::accept)
}
}

View File

@@ -57,6 +57,8 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
override fun onUseAsTainted() {
hazard = true
}
fun canRewrite() = !hazard && initCallInsn != null
}
private class Transformer(private val internalClassName: String, private val methodNode: MethodNode) {
@@ -72,7 +74,7 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
assignLocalVars(frames)
for (refValue in refValues) {
if (!refValue.hazard) {
if (refValue.canRewrite()) {
rewriteRefValue(refValue)
}
}

View File

@@ -39,7 +39,7 @@ class RedundantBoxingMethodTransformer(private val generationState: GenerationSt
override fun transform(internalClassName: String, node: MethodNode) {
val interpreter = RedundantBoxingInterpreter(node.instructions, generationState)
val frames = MethodTransformer.analyze(internalClassName, node, interpreter)
val frames = analyze(internalClassName, node, interpreter)
interpretPopInstructionsForBoxedValues(interpreter, node, frames)
@@ -168,7 +168,8 @@ class RedundantBoxingMethodTransformer(private val generationState: GenerationSt
val frame = frames[i] ?: continue
val insn = insnList[i]
if ((insn.opcode == Opcodes.ASTORE || insn.opcode == Opcodes.ALOAD) &&
(insn as VarInsnNode).`var` == localVariableNode.index) {
(insn as VarInsnNode).`var` == localVariableNode.index
) {
if (insn.getOpcode() == Opcodes.ASTORE) {
values.add(frame.top()!!)
} else {

View File

@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.optimization.common
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
typealias TypeAnnotatedFrames = Array<Frame<BasicValue>?>

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.codegen.optimization.transformer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import org.jetbrains.org.objectweb.asm.tree.MethodNode;
import org.jetbrains.org.objectweb.asm.tree.analysis.*;
@@ -31,7 +32,7 @@ public abstract class MethodTransformer {
return analyzer.analyze(internalClassName, node);
}
catch (AnalyzerException e) {
throw new RuntimeException(e);
throw ExceptionUtilsKt.rethrow(e);
}
}

View File

@@ -131,7 +131,7 @@ abstract class PrimitiveNumberRangeIntrinsicRangeValue(
if (isProhibitedCharConstEndValue(step, endCharValue))
null
else
createConstBoundedIntForLoopGenerator(codegen, forExpression, startValue, endCharValue.toInt(), step, isStartInclusive)
createConstBoundedIntForLoopGenerator(codegen, forExpression, startValue, endCharValue.code, step, isStartInclusive)
}
is LongValue -> {

View File

@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import java.util.concurrent.ConcurrentHashMap
class BuilderFactoryForDuplicateClassNameDiagnostics(
@@ -29,7 +30,7 @@ class BuilderFactoryForDuplicateClassNameDiagnostics(
private val diagnostics: DiagnosticSink
) : ClassNameCollectionClassBuilderFactory(builderFactory) {
private val className = hashMapOf<String, JvmDeclarationOrigin> ()
private val className = ConcurrentHashMap<String, JvmDeclarationOrigin>()
override fun handleClashingNames(internalName: String, origin: JvmDeclarationOrigin) {
val another = className.getOrPut(internalName, { origin })

View File

@@ -27,19 +27,19 @@ import org.jetbrains.org.objectweb.asm.commons.Method
import java.util.*
private val EXTERNAL_SOURCES_KINDS = arrayOf(
JvmDeclarationOriginKind.CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL,
JvmDeclarationOriginKind.DEFAULT_IMPL_DELEGATION_TO_SUPERINTERFACE_DEFAULT_IMPL,
JvmDeclarationOriginKind.DELEGATION,
JvmDeclarationOriginKind.BRIDGE
JvmDeclarationOriginKind.CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL,
JvmDeclarationOriginKind.DEFAULT_IMPL_DELEGATION_TO_SUPERINTERFACE_DEFAULT_IMPL,
JvmDeclarationOriginKind.DELEGATION,
JvmDeclarationOriginKind.BRIDGE
)
private val PREDEFINED_SIGNATURES = listOf(
"getClass()Ljava/lang/Class;",
"notify()V",
"notifyAll()V",
"wait()V",
"wait(J)V",
"wait(JI)V"
"getClass()Ljava/lang/Class;",
"notify()V",
"notifyAll()V",
"wait()V",
"wait(J)V",
"wait(JI)V"
).map { signature ->
RawSignature(signature.substringBefore('('), signature.substring(signature.indexOf('(')), MemberKind.METHOD)
}
@@ -77,8 +77,7 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
val elements = LinkedHashSet<PsiElement>()
if (noOwnImplementations) {
elements.addIfNotNull(data.classOrigin.element)
}
else {
} else {
for (origin in data.signatureOrigins) {
var element = origin.element
@@ -96,9 +95,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
}
override fun onClassDone(
classOrigin: JvmDeclarationOrigin,
classInternalName: String,
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
classOrigin: JvmDeclarationOrigin,
classInternalName: String,
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
) {
reportDiagnosticsTasks.add {
reportClashingWithPredefinedSignatures(classOrigin, classInternalName, signatures)
@@ -107,9 +106,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
}
private fun reportClashingWithPredefinedSignatures(
classOrigin: JvmDeclarationOrigin,
classInternalName: String,
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
classOrigin: JvmDeclarationOrigin,
classInternalName: String,
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
) {
for (predefinedSignature in PREDEFINED_SIGNATURES) {
if (!signatures.containsKey(predefinedSignature)) continue
@@ -122,9 +121,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
}
private fun reportClashingSignaturesInHierarchy(
classOrigin: JvmDeclarationOrigin,
classInternalName: String,
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
classOrigin: JvmDeclarationOrigin,
classInternalName: String,
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
) {
val descriptor = classOrigin.descriptor
if (descriptor !is ClassDescriptor) return
@@ -141,9 +140,7 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
for ((rawSignature, origins) in groupedBySignature.entrySet()) {
if (origins.size <= 1) continue
val diagnostic = computeDiagnosticToReport(classOrigin, classInternalName, rawSignature, origins)
when (diagnostic) {
when (val diagnostic = computeDiagnosticToReport(classOrigin, classInternalName, rawSignature, origins)) {
is ConflictingDeclarationError.AccidentalOverride -> {
diagnostics.report(ErrorsJvm.ACCIDENTAL_OVERRIDE.on(diagnostic.element, diagnostic.data))
}
@@ -156,16 +153,17 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
private sealed class ConflictingDeclarationError(val element: PsiElement, val data: ConflictingJvmDeclarationsData) {
class AccidentalOverride(element: PsiElement, data: ConflictingJvmDeclarationsData) :
ConflictingDeclarationError(element, data)
ConflictingDeclarationError(element, data)
class ConflictingInheritedJvmDeclarations(element: PsiElement, data: ConflictingJvmDeclarationsData) :
ConflictingDeclarationError(element, data)
ConflictingDeclarationError(element, data)
}
private fun computeDiagnosticToReport(
classOrigin: JvmDeclarationOrigin,
classInternalName: String,
rawSignature: RawSignature,
origins: Collection<JvmDeclarationOrigin>
classOrigin: JvmDeclarationOrigin,
classInternalName: String,
rawSignature: RawSignature,
origins: Collection<JvmDeclarationOrigin>
): ConflictingDeclarationError? {
var memberElement: PsiElement? = null
var ownNonFakeCount = 0
@@ -211,19 +209,17 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
if (member is PropertyDescriptor) {
processMember(member.getter)
processMember(member.setter)
}
else if (member is FunctionDescriptor) {
} else if (member is FunctionDescriptor) {
val signatures =
if (member.kind == FAKE_OVERRIDE)
member.overriddenTreeUniqueAsSequence(useOriginal = true)
// drop the root (itself)
.drop(1)
.mapTo(HashSet()) { it.asRawSignature() }
else
setOf(member.asRawSignature())
if (member.kind == FAKE_OVERRIDE)
member.overriddenTreeUniqueAsSequence(useOriginal = true)
// drop the root (itself)
.drop(1)
.mapTo(HashSet()) { it.asRawSignature() }
else
setOf(member.asRawSignature())
signatures.forEach {
rawSignature ->
signatures.forEach { rawSignature ->
groupedBySignature.putValue(rawSignature, OtherOrigin(member))
}
}
@@ -232,10 +228,10 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
descriptor.defaultType.memberScope.getContributedDescriptors().forEach(::processMember)
descriptor.getParentJavaStaticClassScope()?.run {
getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)
.filter {
it is FunctionDescriptor && DescriptorVisibilities.isVisibleIgnoringReceiver(it, descriptor)
}
.forEach(::processMember)
.filter {
it is FunctionDescriptor && DescriptorVisibilities.isVisibleIgnoringReceiver(it, descriptor)
}
.forEach(::processMember)
}
return groupedBySignature

View File

@@ -213,13 +213,13 @@ class GenerationState private constructor(
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS)
if (fromConfig != null && target >= fromConfig.minJvmTarget)
fromConfig
else {
// TODO wait for KT-44844 (properly support 'invokedynamic' in JPS incremental compilation)
// Use JvmClosureGenerationScheme.INDY if
// JVM target is at least JVM_1_8 &&
// SamWrapperClassesAreSynthetic language feature is supported
else if (
target >= JvmClosureGenerationScheme.INDY.minJvmTarget &&
languageVersionSettings.supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic)
)
JvmClosureGenerationScheme.INDY
else
JvmClosureGenerationScheme.CLASS
}
}
val lambdasScheme = run {
@@ -330,7 +330,7 @@ class GenerationState private constructor(
val typeApproximator: TypeApproximator? =
if (languageVersionSettings.supportsFeature(LanguageFeature.NewInference))
TypeApproximator(module.builtIns)
TypeApproximator(module.builtIns, languageVersionSettings)
else
null

View File

@@ -1,8 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.state
typealias JvmMethodExceptionTypes = Array<out String>?

View File

@@ -100,6 +100,9 @@ class KotlinTypeMapper @JvmOverloads constructor(
field = value
}
override val typeSystem: TypeSystemCommonBackendContext
get() = SimpleClassicTypeSystemContext
private val typeMappingConfiguration = object : TypeMappingConfiguration<Type> {
override fun commonSupertype(types: Collection<KotlinType>): KotlinType {
return CommonSupertypes.commonSupertype(types)
@@ -215,7 +218,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
return mapType(returnType, sw, typeMappingModeFromAnnotation)
}
val mappingMode = TypeMappingMode.getOptimalModeForReturnType(returnType, isAnnotationMethod)
val mappingMode = typeSystem.getOptimalModeForReturnType(returnType, isAnnotationMethod)
return mapType(returnType, sw, mappingMode)
}
@@ -232,6 +235,10 @@ class KotlinTypeMapper @JvmOverloads constructor(
return mapType(classifier.defaultType, null, TypeMappingMode.CLASS_DECLARATION)
}
override fun mapTypeCommon(type: KotlinTypeMarker, mode: TypeMappingMode): Type {
return mapType(type as KotlinType, null, mode)
}
fun mapTypeAsDeclaration(kotlinType: KotlinType): Type {
return mapType(kotlinType, null, TypeMappingMode.CLASS_DECLARATION)
}
@@ -1077,7 +1084,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
?: if (callableDescriptor.isMethodWithDeclarationSiteWildcards && type.arguments.isNotEmpty()) {
TypeMappingMode.GENERIC_ARGUMENT // Render all wildcards
} else {
TypeMappingMode.getOptimalModeForValueParameter(type)
typeSystem.getOptimalModeForValueParameter(type)
}
mapType(type, sw, typeMappingMode)
@@ -1271,29 +1278,6 @@ class KotlinTypeMapper @JvmOverloads constructor(
}
companion object {
private val staticTypeMappingConfiguration = object : TypeMappingConfiguration<Type> {
override fun commonSupertype(types: Collection<KotlinType>): KotlinType {
return CommonSupertypes.commonSupertype(types)
}
override fun getPredefinedTypeForClass(classDescriptor: ClassDescriptor): Type? {
return null
}
override fun getPredefinedInternalNameForClass(classDescriptor: ClassDescriptor): String? {
return null
}
override fun processErrorType(kotlinType: KotlinType, descriptor: ClassDescriptor) {
throw IllegalStateException(generateErrorMessageForErrorType(kotlinType, descriptor))
}
override fun preprocessType(kotlinType: KotlinType): KotlinType? {
return null
}
}
/**
* Use proper LanguageVersionSettings where possible.
*/
@@ -1411,30 +1395,15 @@ class KotlinTypeMapper @JvmOverloads constructor(
return ContainingClassesInfo.forPackageMember(facadeName, implClassName)
}
// Make sure this method is called only from back-end
// It uses staticTypeMappingConfiguration that throws exception on error types
@JvmStatic
fun mapInlineClassTypeAsDeclaration(kotlinType: KotlinType): Type {
return mapInlineClassType(kotlinType, TypeMappingMode.CLASS_DECLARATION, staticTypeMappingConfiguration)
fun mapUnderlyingTypeOfInlineClassType(kotlinType: KotlinTypeMarker, typeMapper: KotlinTypeMapperBase): Type {
val underlyingType = with(typeMapper.typeSystem) {
kotlinType.getUnsubstitutedUnderlyingType()
} ?: throw IllegalStateException("There should be underlying type for inline class type: $kotlinType")
return typeMapper.mapTypeCommon(underlyingType, TypeMappingMode.DEFAULT)
}
// Make sure this method is called only from back-end
// It uses staticTypeMappingConfiguration that throws exception on error types
@JvmStatic
fun mapUnderlyingTypeOfInlineClassType(kotlinType: KotlinType): Type {
val underlyingType = kotlinType.unsubstitutedUnderlyingType()
?: throw IllegalStateException("There should be underlying type for inline class type: $kotlinType")
return mapInlineClassType(underlyingType, TypeMappingMode.DEFAULT, staticTypeMappingConfiguration)
}
private fun mapInlineClassType(
kotlinType: KotlinType,
mode: TypeMappingMode,
configuration: TypeMappingConfiguration<Type>
): Type =
mapType(kotlinType, AsmTypeFactory, mode, configuration, null)
private fun generateErrorMessageForErrorType(type: KotlinType, descriptor: DeclarationDescriptor): String {
internal fun generateErrorMessageForErrorType(type: KotlinType, descriptor: DeclarationDescriptor): String {
val declarationElement = DescriptorToSourceUtils.descriptorToDeclaration(descriptor)
?: return "Error type encountered: $type (${type.javaClass.simpleName})."

View File

@@ -8,11 +8,18 @@ package org.jetbrains.kotlin.codegen.state
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
import org.jetbrains.kotlin.types.TypeSystemCommonBackendContext
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
import org.jetbrains.org.objectweb.asm.Type
abstract class KotlinTypeMapperBase {
abstract val typeSystem: TypeSystemCommonBackendContext
abstract fun mapClass(classifier: ClassifierDescriptor): Type
abstract fun mapTypeCommon(type: KotlinTypeMarker, mode: TypeMappingMode): Type
fun mapDefaultImpls(descriptor: ClassDescriptor): Type =
Type.getObjectType(mapClass(descriptor).internalName + JvmAbi.DEFAULT_IMPLS_SUFFIX)
}

View File

@@ -140,8 +140,8 @@ private fun jsonEscape(value: String): String = buildString {
'\r' -> append("\\r")
'\"' -> append("\\\"")
'\\' -> append("\\\\")
else -> if (ch.toInt() < 32) {
append("\\u" + Integer.toHexString(ch.toInt()).padStart(4, '0'))
else -> if (ch.code < 32) {
append("\\u" + Integer.toHexString(ch.code).padStart(4, '0'))
}
else {
append(ch)

View File

@@ -0,0 +1,54 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.state
import org.jetbrains.kotlin.codegen.signature.AsmTypeFactory
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
import org.jetbrains.kotlin.load.kotlin.TypeMappingConfiguration
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
import org.jetbrains.kotlin.load.kotlin.mapType
import org.jetbrains.kotlin.types.CommonSupertypes
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeSystemCommonBackendContext
import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
import org.jetbrains.org.objectweb.asm.Type
// This class exists only because it's used to box/unbox inline classes in the static method StackValue.coerce in the old backend, which
// has no access to the correct type mapper instance, yet has a lot of call sites across the old backend, refactoring which would be costly.
object StaticTypeMapperForOldBackend : KotlinTypeMapperBase() {
override val typeSystem: TypeSystemCommonBackendContext
get() = SimpleClassicTypeSystemContext
private val staticTypeMappingConfiguration = object : TypeMappingConfiguration<Type> {
override fun commonSupertype(types: Collection<KotlinType>): KotlinType {
return CommonSupertypes.commonSupertype(types)
}
override fun getPredefinedTypeForClass(classDescriptor: ClassDescriptor): Type? {
return null
}
override fun getPredefinedInternalNameForClass(classDescriptor: ClassDescriptor): String? {
return null
}
override fun processErrorType(kotlinType: KotlinType, descriptor: ClassDescriptor) {
throw IllegalStateException(KotlinTypeMapper.generateErrorMessageForErrorType(kotlinType, descriptor))
}
override fun preprocessType(kotlinType: KotlinType): KotlinType? {
return null
}
}
override fun mapClass(classifier: ClassifierDescriptor): Type = TODO("Should not be called")
override fun mapTypeCommon(type: KotlinTypeMarker, mode: TypeMappingMode): Type {
return mapType(type as KotlinType, AsmTypeFactory, mode, staticTypeMappingConfiguration, null)
}
}

View File

@@ -87,11 +87,6 @@ fun CallableMemberDescriptor.createTypeParameterWithNewName(
return newDescriptor
}
fun KotlinType.removeExternalProjections(): KotlinType {
val newArguments = arguments.map { TypeProjectionImpl(Variance.INVARIANT, it.type) }
return replace(newArguments)
}
fun isInlineClassConstructorAccessor(descriptor: FunctionDescriptor): Boolean =
descriptor is AccessorForConstructorDescriptor &&
descriptor.calleeDescriptor.constructedClass.isInlineClass()

View File

@@ -49,7 +49,6 @@ dependencies {
testCompile(projectTests(":compiler:fir:raw-fir:light-tree2fir"))
testCompile(projectTests(":compiler:fir:fir2ir"))
testCompile(projectTests(":compiler:fir:analysis-tests:legacy-fir-tests"))
testCompile(projectTests(":compiler:visualizer"))
testCompile(projectTests(":generators:test-generator"))
testCompile(project(":compiler:ir.ir2cfg"))
testCompile(project(":compiler:ir.tree")) // used for deepCopyWithSymbols call that is removed by proguard from the compiler TODO: make it more straightforward
@@ -103,8 +102,11 @@ projectTest(parallel = true) {
workingDir = rootDir
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
val antLauncherJarPathProvider = project.provider {
antLauncherJar.asPath
}
doFirst {
systemProperty("kotlin.ant.classpath", antLauncherJar.asPath)
systemProperty("kotlin.ant.classpath", antLauncherJarPathProvider.get())
systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
}
}

View File

@@ -42,6 +42,8 @@ found top-level declarations to <destination dir> (*.kotlin_builtins files)"""
assert(missing.isEmpty()) { "These source directories are missing: $missing" }
BuiltInsSerializer(dependOnOldBuiltIns = false).serialize(destDir, srcDirs, listOf()) { totalSize, totalFiles ->
println("Total bytes written: $totalSize to $totalFiles files")
if (System.getProperty("kotlin.builtins.serializer.log") == "true") {
println("Total bytes written: $totalSize to $totalFiles files")
}
}
}

View File

@@ -16,10 +16,10 @@
package org.jetbrains.kotlin.cli.common
import com.intellij.util.LineSeparator
import java.util.*
enum class CompilerSystemProperties(val property: String) {
/**
* @param alwaysDirectAccess Gradle has a list of properties that can be read without declaring, see https://github.com/gradle/gradle/blob/f191a61cec61afe308f2b45184cb303d32706a6f/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/SystemPropertyAccessListener.kt#L32
*/
enum class CompilerSystemProperties(val property: String, val alwaysDirectAccess: Boolean = false) {
COMPILE_DAEMON_ENABLED_PROPERTY("kotlin.daemon.enabled"),
COMPILE_DAEMON_JVM_OPTIONS_PROPERTY("kotlin.daemon.jvm.options"),
COMPILE_DAEMON_OPTIONS_PROPERTY("kotlin.daemon.options"),
@@ -36,36 +36,45 @@ enum class CompilerSystemProperties(val property: String) {
KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY("kotlin.environment.keepalive"),
COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS("kotlin.daemon.custom.run.files.path.for.tests"),
KOTLIN_COLORS_ENABLED_PROPERTY("kotlin.colors.enabled"),
OS_NAME("os.name")
OS_NAME("os.name", alwaysDirectAccess = true),
TMP_DIR("java.io.tmpdir"),
USER_HOME("user.home", alwaysDirectAccess = true),
JAVA_VERSION("java.specification.version", alwaysDirectAccess = true),
JAVA_HOME("java.home", alwaysDirectAccess = true),
JAVA_CLASS_PATH("java.class.path", alwaysDirectAccess = true),
;
var value
get() = systemPropertyGetter(property)
private fun <T> getProperFunction(custom: T?, default: T): T {
if (alwaysDirectAccess) return default
return custom ?: default
}
var value: String?
get() {
return getProperFunction(systemPropertyGetter, System::getProperty)(property)
}
set(value) {
systemPropertySetter(property, value!!)
getProperFunction(systemPropertySetter, System::setProperty)(property, value!!)
}
fun clear(): String? = systemPropertyCleaner(property)
val safeValue
get() = value ?: error("No value for $property system property")
fun clear(): String? = getProperFunction(systemPropertyCleaner, System::clearProperty)(property)
companion object {
var systemPropertyGetter: (String) -> String? = {
System.getProperty(it)
}
var systemPropertyGetter: ((String) -> String?)? = null
var systemPropertySetter: (String, String) -> String? = { key, value ->
System.setProperty(key, value)
}
var systemPropertySetter: ((String, String) -> String?)? = null
var systemPropertyCleaner: (String) -> String? = { key ->
System.clearProperty(key)
}
var systemPropertyCleaner: ((String) -> String?)? = null
}
}
val isWindows: Boolean
get() = CompilerSystemProperties.OS_NAME.value!!.toLowerCase(Locale.ENGLISH).startsWith("windows")
get() = CompilerSystemProperties.OS_NAME.value!!.lowercase().startsWith("windows")
fun String?.toBooleanLenient(): Boolean? = when (this?.toLowerCase()) {
fun String?.toBooleanLenient(): Boolean? = when (this?.lowercase()) {
null -> false
in listOf("", "yes", "true", "on", "y") -> true
in listOf("no", "false", "off", "n") -> false

View File

@@ -304,6 +304,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var checkStickyPhaseConditions: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@Argument(
value = "-Xuse-fir",
description = "Compile using Front-end IR. Warning: this feature is far from being production-ready"

View File

@@ -74,7 +74,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(
value = "-jvm-target",
valueDescription = "<version>",
description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.8"
description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14, 15 or 16), default is 1.8"
)
var jvmTarget: String? by NullableStringFreezableVar(JvmTarget.DEFAULT.description)
@@ -84,8 +84,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
// Advanced options
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.WARNING)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@Argument(value = "-Xuse-ir", description = "Use the IR backend")
@Argument(
value = "-Xuse-ir",
description = "Use the IR backend. This option has no effect unless the language version less than 1.5 is used"
)
var useIR: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@@ -373,7 +377,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise"""
)
var stringConcat: String? by NullableStringFreezableVar(JvmStringConcat.INLINE.description)
var stringConcat: String? by NullableStringFreezableVar(null)
@Argument(
value = "-Xsam-conversions",
@@ -467,6 +471,14 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
)
var suppressDeprecatedJvmTargetWarning: Boolean by FreezableVar(false)
@Argument(
value = "-Xtype-enhancement-improvements-strict-mode",
description = "Enable strict mode for some improvements in the type enhancement for loaded Java types based on nullability annotations," +
"including freshly supported reading of the type use annotations from class files. " +
"See KT-45671 for more details"
)
var typeEnhancementImprovementsInStrictMode: Boolean by FreezableVar(false)
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
val result = super.configureAnalysisFlags(collector)
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics
@@ -489,6 +501,7 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
result[JvmAnalysisFlags.useIR] = !useOldBackend
return result
}
@@ -497,6 +510,9 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
if (strictJavaNullabilityAssertions) {
result[LanguageFeature.StrictJavaNullabilityAssertions] = LanguageFeature.State.ENABLED
}
if (typeEnhancementImprovementsInStrictMode) {
result[LanguageFeature.TypeEnhancementImprovementsInStrictMode] = LanguageFeature.State.ENABLED
}
return result
}

View File

@@ -1,20 +0,0 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
compile(project(":compiler:cli"))
compile(project(":compiler:ir.serialization.js"))
compileOnly(project(":compiler:ir.tree.persistent"))
runtimeOnly(project(":kotlin-reflect"))
if (Platform[193].orLower()) {
compile(intellijDep()) { includeJars("picocontainer", rootProject = rootProject) }
}
compile(intellijDep()) { includeJars("trove4j", "guava", "jdom", rootProject = rootProject) }
compile(intellijCoreDep()) { includeJars("intellij-core") }
}
sourceSets {
"main" { projectDefault() }
}

View File

@@ -1,153 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
// Internal CLI for building JS IR libraries
package org.jetbrains.kotlin.ir.backend.js
import com.intellij.openapi.Disposable
import com.intellij.openapi.vfs.StandardFileSystems
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiManager
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.*
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrFactory
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
import org.jetbrains.kotlin.library.resolver.KotlinLibraryResolveResult
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.multiplatform.isCommonSource
import org.jetbrains.kotlin.serialization.js.ModuleKind
import org.jetbrains.kotlin.util.Logger
import java.io.File
fun buildConfiguration(environment: KotlinCoreEnvironment, moduleName: String): CompilerConfiguration {
val runtimeConfiguration = environment.configuration.copy()
runtimeConfiguration.put(CommonConfigurationKeys.MODULE_NAME, moduleName)
runtimeConfiguration.put(JSConfigurationKeys.MODULE_KIND, ModuleKind.PLAIN)
runtimeConfiguration.put(
CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY,
PrintingMessageCollector(System.err, MessageRenderer.PLAIN_RELATIVE_PATHS, false)
)
runtimeConfiguration.languageVersionSettings = LanguageVersionSettingsImpl(
LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE,
specificFeatures = mapOf(
LanguageFeature.AllowContractsForCustomFunctions to LanguageFeature.State.ENABLED,
LanguageFeature.MultiPlatformProjects to LanguageFeature.State.ENABLED
),
analysisFlags = mapOf(
AnalysisFlags.useExperimental to listOf(
"kotlin.RequiresOptIn",
"kotlin.contracts.ExperimentalContracts",
"kotlin.ExperimentalMultiplatform",
),
AnalysisFlags.allowResultReturnType to true
)
)
return runtimeConfiguration
}
@Suppress("RedundantSamConstructor")
private val environment =
KotlinCoreEnvironment.createForProduction(Disposable { }, CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES)
fun createPsiFile(fileName: String): KtFile {
val psiManager = PsiManager.getInstance(environment.project)
val fileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL)
val file = fileSystem.findFileByPath(fileName) ?: error("File not found: $fileName")
return psiManager.findFile(file) as KtFile
}
fun buildKLib(
moduleName: String,
sources: List<String>,
outputPath: String,
allDependencies: KotlinLibraryResolveResult,
commonSources: List<String>
) {
val configuration = buildConfiguration(environment, moduleName)
generateKLib(
project = environment.project,
files = sources.map { source ->
val file = createPsiFile(source)
if (source in commonSources) {
file.isCommonSource = true
}
file
},
analyzer = AnalyzerWithCompilerReport(configuration),
configuration = configuration,
allDependencies = allDependencies,
friendDependencies = emptyList(),
irFactory = PersistentIrFactory(), // TODO: IrFactoryImpl?
outputKlibPath = outputPath,
nopack = true
)
}
private fun listOfKtFilesFrom(paths: List<String>): List<String> {
val currentDir = File("")
return paths.flatMap { path ->
File(path)
.walkTopDown()
.filter { it.extension == "kt" }
.map { it.relativeToOrSelf(currentDir).path }
.asIterable()
}.distinct()
}
fun main(args: Array<String>) {
val inputFiles = mutableListOf<String>()
var outputPath: String? = null
val dependencies = mutableListOf<String>()
val commonSources = mutableListOf<String>()
var moduleName: String? = null
var index = 0
while (index < args.size) {
val arg = args[index++]
when (arg) {
"-n" -> moduleName = args[index++]
"-o" -> outputPath = args[index++]
"-d" -> dependencies += args[index++]
"-c" -> commonSources += args[index++]
else -> inputFiles += arg
}
}
if (outputPath == null) {
error("Please set path to .klm file: `-o some/dir/module-name.klm`")
}
if (moduleName == null) {
error("Please set module name: `-n module-name`")
}
val resolvedLibraries = jsResolveLibraries(
dependencies, emptyList(), messageCollectorLogger(MessageCollector.NONE)
)
buildKLib(moduleName, listOfKtFilesFrom(inputFiles), outputPath, resolvedLibraries, listOfKtFilesFrom(commonSources))
}
// Copied here from `K2JsIrCompiler` instead of reusing in order to avoid circular dependencies between Gradle tasks
private fun messageCollectorLogger(collector: MessageCollector) = object : Logger {
override fun warning(message: String)= collector.report(CompilerMessageSeverity.STRONG_WARNING, message)
override fun error(message: String) = collector.report(CompilerMessageSeverity.ERROR, message)
override fun log(message: String) = collector.report(CompilerMessageSeverity.LOGGING, message)
override fun fatal(message: String): Nothing {
collector.report(CompilerMessageSeverity.ERROR, message)
(collector as? GroupingMessageCollector)?.flush()
kotlin.error(message)
}
}

View File

@@ -11,6 +11,7 @@ dependencies {
compile(project(":compiler:backend-common"))
compile(project(":compiler:ir.backend.common"))
compile(project(":compiler:ir.serialization.js"))
compile(project(":compiler:ir.tree.impl"))
compile(project(":compiler:backend.js"))
compile(project(":compiler:backend.wasm"))
compile(project(":js:js.translator"))

View File

@@ -252,17 +252,28 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
return COMPILATION_ERROR;
}
AnalyzerWithCompilerReport analyzerWithCompilerReport = new AnalyzerWithCompilerReport(
messageCollector, CommonConfigurationKeysKt.getLanguageVersionSettings(configuration)
);
analyzerWithCompilerReport.analyzeAndReport(sourcesFiles, () -> TopDownAnalyzerFacadeForJS.analyzeFiles(sourcesFiles, config));
if (analyzerWithCompilerReport.hasErrors()) {
return COMPILATION_ERROR;
}
AnalysisResult analysisResult;
do {
AnalyzerWithCompilerReport analyzerWithCompilerReport = new AnalyzerWithCompilerReport(
messageCollector, CommonConfigurationKeysKt.getLanguageVersionSettings(configuration)
);
List<KtFile> sources = environmentForJS.getSourceFiles();
analyzerWithCompilerReport.analyzeAndReport(sourcesFiles, () -> TopDownAnalyzerFacadeForJS.analyzeFiles(sources, config));
if (analyzerWithCompilerReport.hasErrors()) {
return COMPILATION_ERROR;
}
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
analysisResult = analyzerWithCompilerReport.getAnalysisResult();
if (analysisResult instanceof JsAnalysisResult.RetryWithAdditionalRoots) {
environmentForJS.addKotlinSourceRoots(((JsAnalysisResult.RetryWithAdditionalRoots) analysisResult).getAdditionalKotlinRoots());
}
} while(analysisResult instanceof JsAnalysisResult.RetryWithAdditionalRoots);
if (!analysisResult.getShouldGenerateCode())
return OK;
AnalysisResult analysisResult = analyzerWithCompilerReport.getAnalysisResult();
assert analysisResult instanceof JsAnalysisResult : "analysisResult should be instance of JsAnalysisResult, but " + analysisResult;
JsAnalysisResult jsAnalysisResult = (JsAnalysisResult) analysisResult;

Some files were not shown because too many files have changed in this diff Show More