Compare commits

..

3968 Commits

Author SHA1 Message Date
Ilya Gorbunov
646362c458 fixup: stdlib 2021-03-02 21:29:25 +03:00
Ilya Gorbunov
b862610d01 fixes in test code 2021-03-02 21:22:12 +03:00
Ilya Gorbunov
782e9a6617 idea plugin fixes 2021-03-02 21:11:28 +03:00
Ilya Gorbunov
4607ad3b04 Prototype minimalistic ListBuilder interface 2021-03-02 20:54:55 +03:00
Alexander Likhachev
9d140cacc0 [Gradle, K/N] Create compiler download temp dir inside target dir
Motivation is to make directory moving more likely atomic
Relates to KT-39016
2021-02-26 16:11:19 +03:00
Alexander Likhachev
172b5f9621 [Gradle, K/N] Unpack compiler into temp directory then move to proper place
#KT-39016 Fixed
2021-02-26 16:11:14 +03:00
Yahor Berdnikau
45d423e78c Fix test is failing to run on CI.
Remove mistakenly added 'wait for debugger' flag.
2021-02-26 15:55:57 +03:00
Ilya Goncharov
80a0545ac2 [Gradle, JS] Fix ProcessedFilesCache.kt according to configuration cache 2021-02-26 14:32:51 +03:00
Mikhail Glukhikh
b138b166e3 FIR: use EQUALS & TO_STRING from OperatorNameConventions 2021-02-26 13:50:26 +03:00
Jinseong Jeon
e6cfd5d06f FIR: move data class synthetic members' names 2021-02-26 13:50:25 +03:00
Jinseong Jeon
856838f82c FIR: refactor delegate unwrapping
Not implemented override checker will use those to pretend to make
delegeted members (before checking similarly pretended fake overrides)
2021-02-26 13:50:24 +03:00
Alexander Likhachev
ef890464d8 [Gradle] Rework KotlinTestReport to be compatible with configuration cache
Minimal supported version is effectively changed to 6.1 due to usage of Gradle build services
Relates to #KT-43605
2021-02-26 13:49:01 +03:00
Alexander Likhachev
3e09bb3d3f [Gradle] Bump gradle-download-task version to 4.1.1 to support configuration cache
Relates to #KT-44611
2021-02-26 13:49:00 +03:00
Alexander Likhachev
67632a495b [Gradle, MPP] Rework build finished listener into build service
Registering build finished listeners is not supported by configuration cache
Relates to #KT-44611
#KT-44900 Fixed
2021-02-26 13:48:59 +03:00
Dmitry Savvinov
42345b9c49 Minor: use more clear and specific naming for LazyClassContext.typeChecker (relevant for MPP with type refinement) 2021-02-26 12:37:02 +03:00
Dmitry Savvinov
168c692a27 Use overriding util with proper typechecker for overriding in LazyClassMemberScope
Note that LazyClassMemberScope actually has a separate field for
KotlinTypeRefiner, and it might be actually different from the one in
c.kotlinTypeChecker.

The one in c.kotlinTypeChecker is the refiner of *owner* module, i.e. a
module in which the class has been declared. If we have a class Foo :
Expect in common, then the refiner will be from common, and thus it
won't be able to refine supertypes to their platform-dependent values.

The one passed in constructor is actual refiner of dependant-module.
Say, if we're looking at Foo from the point of view of jvmMain, then
we'll create a (view-dependent) LCMS for that, and it will contain
refiner for jvmMain.

It is important to use proper refiner, otherwise the idea of having
"module-dependent view" breaks, and we might suddenly mismatch some
overrides with expect-classes in their signatures.

^KT-44898 Fixed
2021-02-26 12:37:01 +03:00
Dmitry Savvinov
9616eb94fd Add test on KT-44898 (MPP + type refinement + complex inheritance)
The current behaviour is undesired (ABSTRACT_MEMEBER_NOT_IMPLEMENTED
reported on class Concrete), will be fixed in the next commit
2021-02-26 12:37:01 +03:00
Dmitry Savvinov
e3d4c440b5 Minor: rename createMemberScope -> createScopesHolderForClass 2021-02-26 12:37:01 +03:00
Mikhail Glukhikh
2bf3abcb29 FIR: cache accessor symbols in JavaClassUseSiteMemberScope 2021-02-26 12:27:07 +03:00
Mikhail Glukhikh
750a39a053 JavaClassUseSiteMemberScope: optimize createOverridePropertyIfExists
Avoid calculating getter & setter twice
2021-02-26 12:27:01 +03:00
Aleksei.Cherepanov
07d11508a7 Generate JvmMultifileClass tests for Gradle 2021-02-26 11:31:17 +03:00
Denis.Zharkov
e6b61ecc22 Fix incorrectly generated tests 2021-02-26 10:46:54 +03:00
Mikhael Bogdanov
82f1b8159c Remove deprecated "-XX:-FailOverToOldVerifier" as it breaks JDK on TC 2021-02-26 07:48:20 +01:00
Tianyu Geng
2484729bd7 FIR IDE: fix redundant
Apparently there is a race condition when collecting the `fromPhase`.
This causes the same resolver to run multiple times on FIR.

^KT-45121 Fixed
2021-02-25 23:31:37 +01:00
Alexander Udalov
acc2256de9 IR: support smart cast values in RangeContainsLowering
#KT-44878 Fixed
2021-02-25 21:00:09 +01:00
Alexander Udalov
820762ca16 IR: add isUnsignedType/getUnsignedType 2021-02-25 21:00:09 +01:00
Alexander Udalov
0ebdf7c3c4 IR: add getPrimitiveType, optimize some usages of isInt/isByte/... 2021-02-25 21:00:09 +01:00
Alexander Udalov
17ee10a0d8 Minor, fix compilation warning in DurationUnit.kt 2021-02-25 21:00:09 +01:00
Victor Petukhov
94e6ec7dfd Fix test after 27846f4532 2021-02-25 22:29:45 +03:00
Yahor Berdnikau
6b56b7cca6 Fix tests are using slightly different test file names from actual. 2021-02-25 20:11:43 +01:00
Denis.Zharkov
4fffe7b9c8 FIR: Fix VerifyError caused by private delegates
^KT-45048 Fixed
2021-02-25 19:30:15 +03:00
Denis.Zharkov
ace66b7179 FIR: Prettify visibility resolution for private constructors 2021-02-25 19:30:15 +03:00
Denis.Zharkov
9d7e40ad99 Minor. Reformat FirStatusResolveTransformer.kt 2021-02-25 19:30:15 +03:00
Ilmir Usmanov
2523ea1ef4 Do not add @JvmInline annotation on JS and Native 2021-02-25 16:07:00 +01:00
Ilmir Usmanov
2df049fc03 Minor. Remove outdated test and update maven test 2021-02-25 16:06:58 +01:00
Ilmir Usmanov
8c31fcb615 Add inline class -> @JvmInline value class intention 2021-02-25 16:06:54 +01:00
Ilmir Usmanov
d67e4f0c48 Rename inline class -> @JvmInline value class in stdlib and compiler 2021-02-25 16:06:51 +01:00
Ilmir Usmanov
62123d72e2 IC: Add inline class -> @JvmInline value class warning 2021-02-25 16:06:47 +01:00
Alexander Udalov
b417786fd4 JVM IR: do not hide constructor with inline class in anonymous object
#KT-45131 Fixed
2021-02-25 14:44:16 +01:00
Alexander Udalov
b026de768d Do not ever run JVM test handlers after previous errors
If there's a frontend error in a test, or bytecode generation crashed
with an exception, it makes no sense to run JVM test handlers such as
lambda inlining checker or D8 checker.
2021-02-25 14:44:16 +01:00
Victor Petukhov
27846f4532 Add tests for obsolete issues (KT-42722, KT-39880) 2021-02-25 15:30:29 +03:00
Mark Punzalan
9492e75d38 FIR checker: Split checkProperty util function. 2021-02-25 13:06:53 +01:00
Mark Punzalan
aad86c3892 Skip directories with lowercase "testdata" in FIR total Kotlin tests.
"idea/idea-frontend-fir/idea-fir-low-level-api/testdata" is the
affected directory.
2021-02-25 13:06:53 +01:00
Mark Punzalan
1c94372b6c FIR checker/IDE: Add checker and quickfix for VAL_WITH_SETTER. 2021-02-25 13:06:53 +01:00
Dmitriy Novozhilov
99c47a0487 Fix non-exhaustive when in common stdlib 2021-02-25 14:56:08 +03:00
Dmitriy Novozhilov
4222bb9af2 [FE] Make whens on expect sealed classes and enums not exhaustive 2021-02-25 14:56:08 +03:00
Simon Ogorodnik
1cf73203c7 [FIR-Test] Disable pre-release check in modularized tests 2021-02-25 14:03:30 +03:00
Simon Ogorodnik
2ea0e69a56 [FIR-Test] Fix incorrect file count 2021-02-25 14:03:29 +03:00
Simon Ogorodnik
0086ebe6f2 [FIR-Test] Increase code cache size 2021-02-25 14:03:28 +03:00
Simon Ogorodnik
1e73f7a5b2 [FIR-Test] Force min heap size 2021-02-25 14:03:27 +03:00
Simon Ogorodnik
b6fb3c9799 [FIR] Isolate benchmark thread, add jit log format events for passes
Add special output for pass events to match with LogCompilation
2021-02-25 14:03:26 +03:00
Andrei Klunnyi
618de5fa32 KT-45074 [Sealed Interfaces]: when exhaustiveness after gradle reimport
Module descriptor names in the form of 'stableName' depend on a build
system. See JvmCodegenUtil#getModuleName(). For JPS we get
<module-name.main> or <module-name.test> whereas for Gradle we get top
level <module-name>.
This commit changes approach: ModuleDescriptor-to-Module conversion is
no longer made by name. ModuleInfo is utilized instead.

^KT-45074 fixed
2021-02-25 10:34:45 +00:00
Dmitriy Novozhilov
a9c6c115be [Test] Disable gradle test parallelization if JUnit 5 is enabled 2021-02-25 10:38:45 +03:00
Dmitriy Novozhilov
2a7a20dd99 [Test] Add ability to set maximum of working threads for parallel JUnit 5 tests 2021-02-25 10:38:45 +03:00
Ilya Gorbunov
ca6ce151a2 Unify test package names in kotlin-stdlib tests
This makes 'test.' an implicit package prefix, thus fixing the inspection
"Package directive doesn't match file location" positive in almost all
test files.
2021-02-25 09:58:14 +03:00
Alexander Udalov
a6d8bf8127 Fix compilation of idea-fir-low-level-api 2021-02-24 21:31:19 +01:00
Alexander Udalov
aeb0906f2d Build: suppress warnings for kotlin-stdlib-wasm 2021-02-24 20:48:26 +01:00
Ilya Kirillov
9ce4decb73 FIR IDE: use WhenMissingCase in NoElseInWhen diagnostic 2021-02-24 20:13:45 +01:00
Ilya Kirillov
f19a9af7b3 Unify WhenMissingCase from FIR and FE1.0 2021-02-24 20:13:43 +01:00
Ilya Kirillov
f4371c670e Move WhenMissingCase from fir module to compiler.common to use in IDE 2021-02-24 20:13:42 +01:00
Ilya Kirillov
83f8650e80 Move CallableId from fir module to compiler.common to use in IDE 2021-02-24 20:13:41 +01:00
Alexander Udalov
7e149a3a44 IR: remove unneeded dependencies on psi2ir 2021-02-24 19:07:38 +01:00
Alexander Udalov
e69cc183a4 IR: remove dependency of 'ir.tree' on 'frontend' 2021-02-24 19:07:38 +01:00
Alexander Udalov
addabae8d2 IR: move frontend-dependent code into implementations in psi2ir 2021-02-24 19:07:38 +01:00
Alexander Udalov
d991a3e40f IR: simplify initialization cycle of TypeTranslator/ConstantValueGenerator 2021-02-24 19:07:38 +01:00
Alexander Udalov
5ea3d32b98 IR: remove TranslationPluginContext.bindingContext
This removes another dependency of 'ir.tree' on 'frontend', and among
other things, makes it possible to implement TranslationPluginContext
for FIR in the future.
2021-02-24 19:07:38 +01:00
Alexander Udalov
274e0ad136 IR: remove unused dependency on BindingContext 2021-02-24 19:07:37 +01:00
Alexander Udalov
837eb739ea IR: move CompilationErrorException to frontend.common 2021-02-24 19:07:37 +01:00
Alexander Udalov
1ae46b529f IR: move ExpectDeclarationRemover to ir.backend.common 2021-02-24 19:07:37 +01:00
Victor Petukhov
26a96a1c19 Don't throw an exception while loading type use annotations on implicit bounds of a wildcard
^KT-45067 Fixed
2021-02-24 21:06:32 +03:00
Pavel Semyonov
7669d8ff26 Add README.md for the kotlin-parcelize plugin 2021-02-25 02:59:50 +09:00
Alexander Udalov
2e2caae05c Extract control flow analysis to separate module
Extract a service interface out of ControlFlowInformationProviderImpl
and register its implementation in two "leaf" modules: 'cli',
'idea-core'.

This improves parallel build, since a lot of modules depend on
'frontend' but only these two modules reference the implementation and
thus depend on the full CFA implementation now.
2021-02-24 17:17:04 +01:00
Alexander Udalov
c744515832 Minor, pass CliSealedClassInheritorsProvider explicitly in some places
Do not use default parameter value for functions with only 1 or 2 call
sites, since it doesn't add much value but provides a dangerous
possibility to forget to pass the real implementation.
2021-02-24 17:17:03 +01:00
Alexander Udalov
ca5a35b4b3 Move CompilerEnvironment from 'frontend' to 'cli'
This is needed in order to have a single convenient place where to
register frontend services implemented _outside_ of the 'frontend'
module, such as the control flow analysis, extracted to a separate
module in a subsequent commit.
2021-02-24 17:17:03 +01:00
Alexander Udalov
3efbca85ea Minor, rename file ControlFlowInformationProvider{ -> Impl}.kt 2021-02-24 17:17:03 +01:00
Alexander Udalov
5ad0033d42 Extract some cfg utilities into separate files
These utilties are used not only within CFG, but from the frontend and
idea as well. Therefore upon extraction of CFG into another module,
these two new files will remain in 'frontend'.
2021-02-24 17:17:03 +01:00
Mikhail Glukhikh
a9b9cced15 IrInterpret: remove thread creation / joining (performance fix) 2021-02-24 18:56:06 +03:00
Anton Bannykh
df62b5e311 JS IR: special origins for declaration created during lowerings
Otherwise the lazy properties lowering may try to process them
2021-02-24 18:32:56 +03:00
Tianyu Geng
aec498a4ea Add quickfixes for NON_FINAL_MEMBER_IN_FINAL_CLASS 2021-02-24 15:56:35 +01:00
Nikita Katkov
e1b3cd32f3 IDEA-253605 jvmClassPathUtil: preserve old behaviour 2021-02-24 11:48:32 +00:00
Nikita Katkov
738c6d3119 IDEA-253605 jvmClassPathUtil: correct collection of parent classloaders 2021-02-24 11:48:32 +00:00
Vladimir Dolzhenko
81efdab4e4 Do not swallow any exceptions apart FNFE
Relates to #KT-39776
2021-02-24 11:06:49 +00:00
Mikhail Glukhikh
cf830887ec FIR2IR: optimize override binding for Fir2IrLazySimpleFunction 2021-02-24 13:50:47 +03:00
Tianyu Geng
5bdea9652b FIR: fix position and reporting of PRIVATE_SETTER_*
Previously `FirPropertyAccessor.source` references the `KtProperty` if
the user code contains a setter or getter that doesn't contain a body.
For example, with the following

```
val i: Int = 1
  private set
```

The `FirPropertyAccessor` would reference the `KtProperty` as the
source.

This change makes `FirPropertyAccessor` reference `KtPropertyAccessor`
as the source if possible, regardless of whether the body is present or
not.
2021-02-24 13:50:46 +03:00
Tianyu Geng
bdeecfc188 FIR: check multiple vararg param and forbidden vararg type 2021-02-24 13:50:46 +03:00
Jinseong Jeon
0e9474342d Simplify FirMethodOfAnyImplementedInInterfaceChecker
* Override CallableId and operator tag parts only,
  not entire function representation

* Even more lazyness for inspector creation
2021-02-24 13:50:46 +03:00
Jinseong Jeon
338595703c FIR: delegate to abstract override members of Any 2021-02-24 13:50:46 +03:00
Jinseong Jeon
0defdc9e70 FIR checker: fix typos in diagnostics list 2021-02-24 13:50:45 +03:00
Jinseong Jeon
c4af92a86a FIR: don't raise an internal error for sealed members in intersection scope 2021-02-24 13:50:45 +03:00
Jinseong Jeon
4fba5891c7 FIR2IR: compute class localness before a loop 2021-02-24 13:50:45 +03:00
Yaroslav Chernyshev
c571c5c441 Refactor and apply optimization to KaptModelBuilderService logic 2021-02-24 11:38:13 +03:00
Andrey Uskov
7ef136d142 Improve performance of import of pure kotlin project: do not force all tasks creation
#KT-34401 Fixed
2021-02-24 11:38:12 +03:00
Igor Chevdar
9d8abca195 [box-tests] Disabled a test for K/N 2021-02-24 11:00:27 +05:00
Stefan Wolf
d88ef64288 Remove references to validateTaskProperties
The task is now called `validatePlugins`.
2021-02-23 23:26:41 +03:00
Stefan Wolf
200ef832d2 Add PathSensitive annotation to all input file properties
So new validation which will be added in Gradle 7.1
won't cause warnings during the build.
2021-02-23 23:26:39 +03:00
Stefan Wolf
8b01df6772 Enable stricker Kotlin Gradle Plugin validation 2021-02-23 23:26:35 +03:00
Mads Ager
8852323a76 [PSI2IR] Do not generate property reference setter if inaccessible.
Fixes KT-45064.
2021-02-23 19:33:49 +01:00
Ilmir Usmanov
d44799fa78 JVM IR: Use INVOKESPECIAL instead of INVOKEVIRTUAL for default private
suspend functions.

 #KT-26592
2021-02-23 18:49:10 +01:00
Ilmir Usmanov
3ee62cb1b2 JVM IR: Do not generate private suspend functions as synthetic package-private
#KT-26592
2021-02-23 18:49:06 +01:00
Alexander Udalov
48fb085bf6 Deprecate kotlin.Metadata.bytecodeVersion
#KT-41758 Fixed
2021-02-23 12:45:41 +01:00
Alexander Udalov
f63ffc51ae Remove JvmBytecodeBinaryVersion from the compiler code
Move it to build-common where it's still used in incremental compilation
caches, and simplify a bit. In the future, it'll make sense to remove it
completely and to avoid writing it to caches. In this commit, I don't do
that to prevent the IC cache version to be updated, causing rebuilds for
all JPS projects.

 #KT-41758
2021-02-23 12:45:41 +01:00
Alexander Udalov
d300e05be9 Remove obsolete code in inliner for experimental coroutines 2021-02-23 12:45:41 +01:00
Alexander Udalov
448c6c2f0d kotlinx-metadata-jvm: deprecate KotlinClassHeader.bytecodeVersion
#KT-41758
2021-02-23 12:45:40 +01:00
Alexander Udalov
c6f5ce6837 Do not write bytecode version to class file
#KT-41758
2021-02-23 12:45:40 +01:00
Alexander Udalov
862a9143da Do not report errors about bytecode version
#KT-41758
2021-02-23 12:45:40 +01:00
Dmitriy Dolovov
fa2b2c8735 [Commonizer] Make CirProperty.compileTimeInitializer non-nullable
There is effectively no difference between null and CirConstantValue.NullValue recorded in compileTimeInitializer.
2021-02-22 21:06:49 +03:00
Dmitriy Dolovov
b3e68d3704 [Commonizer] Make CirProperty.[backing|delegate]FieldAnnotations non-nullable
There is effectively no difference between missing field and a field with no annotations.
2021-02-22 21:06:41 +03:00
Dmitriy Dolovov
215dd8515b Minor. Remove compilation warning 2021-02-22 21:06:34 +03:00
Toshiaki Kameyama
ee406f1622 Lift assignment out: if last statement is lambda, enclose it in parentheses if necessary
#KT-38155 Fixed
2021-02-22 17:40:06 +01:00
Alexander Udalov
e6476c39ca JVM IR: fix isMarkedNullable for nullability-flexible types
Since nullability-flexible types in IR are represented by an annotation
on an IrSimpleType, not a special instance, the common implementation of
`KotlinTypeMarker.isMarkedNullable` in `TypeSystemContext` doesn't work.

This method is used for example to generate `typeOf` in JVM IR, in
`TypeSystemCommonBackendContext.generateTypeOf`, and this issue led to a
difference in behavior of `typeOf` for nullability-flexible types.

 #KT-44726 Fixed
2021-02-22 12:52:48 +01:00
Aleksandr Liublinskii
08cf78fafd MI-141 Fix 'Empty Library' entry in module dependencies 2021-02-22 12:25:47 +01:00
Alexander Udalov
eec98314c8 Revert "Change order of WITH_RUNTIME and FILE. Wrong order brakes module pattern."
This reverts commit 073a500370.
2021-02-22 10:14:32 +01:00
Pavel Punegov
073a500370 Change order of WITH_RUNTIME and FILE. Wrong order brakes module pattern. 2021-02-21 11:12:33 +03:00
Pavel Punegov
95a8c60a9c Ignore test in Native backend. Test overrides kotlin.Result 2021-02-21 11:11:46 +03:00
Pavel Punegov
4643f12a5f Ignore JVM test in Native backend 2021-02-21 11:11:46 +03:00
Ilya Goncharov
d9be59ea97 [JS IR] JS code in init block only for js ir backend test 2021-02-20 21:06:28 +03:00
Dmitriy Novozhilov
13dfa5a886 [FIR2IR] Add handling exceptions from Fir2Ir and reporting declaration where converter failed 2021-02-20 18:27:45 +03:00
Dmitriy Novozhilov
ea2783eace [FIR] Fix generating this reference in delegated accessors
There was a problem with delegated extension property with dispatch
  receiver that `this` in `getValue` call was set to dispatch receiver
  instead of extension one
2021-02-20 18:27:43 +03:00
Victor Petukhov
4e5647090e Approximate captured types in contravariant positions properly
^KT-43802 Fixed
2021-02-20 16:57:07 +03:00
Dmitry Petrov
387d84f826 JVM_IR indy-SAM: KT-45069 box lambda 'Unit' return type if needed 2021-02-20 15:07:24 +03:00
Ilya Goncharov
187d4998fa [JS IR] Not cast to declaration parent in JsCodeOutlineLowering, use parent otherwise
^KT-45057 fixed
2021-02-20 13:08:45 +03:00
Ilya Goncharov
bd2601f289 [JS IR] Extract adding of function call to another function
[JS IR] Add option for dce mode

[JS IR] Add logging to non useful declarations if appropriate dce mode

[JS IR] Add mode with throwing exception

[JS IR] unreachableDeclaration method is in rootDeclarations

[JS IR] Add js extra help arg with dce mode and include debug.kt to compile unreachableMethod

[JS IR] unreachableDeclaration as internal to not reproduce stdlib api

[JS IR] Fix description of dce mode argument

- Use console.error instead of console.log
- Use JsError instead Kotlin exception for lightweight

[JS IR] Remove body for throwing exception

[JS IR] Remove default parameter in unreachableDeclaration

[JS IR] Process without removing fields and declaration containers

[JS IR] Rename dce mode on dce runtime diagnostic

[JS IR] Use console.trace instead of console.error

[JS IR] Extract JsError

- Fix naming in prependFunctionCall
- Fix description on runtime diagnostic argument
- Using message collector instead of throwing exception

[JS IR] Distinguish unreachableMethods for log and exception

[JS IR] Extract checking of Kotlin packages of IrField

^KT-45059 fixed
2021-02-20 12:05:06 +03:00
Mikhail Glukhikh
5568ceef68 Add test for KT-37056 (already fixed) 2021-02-20 11:37:34 +03:00
Mikhail Glukhikh
6e46b0a1c4 Add test for KT-41917 (already fixed) 2021-02-20 11:37:33 +03:00
Denis.Zharkov
1fe0a1f160 FIR: Fix interface delegation case via type alias 2021-02-20 10:59:23 +03:00
Denis.Zharkov
e4c851e3ce FIR2IR: Fix case of @JvmOverloads with subclass
Avoid generating synthetic overrides in subclass
It has been already working for PSI2IR because fake overrides there don't
inherit default values for parameters, while they do it in FIR
2021-02-20 10:59:22 +03:00
Denis.Zharkov
377a0aa237 FIR2IR: Adjust test data for updated overridden structure 2021-02-20 10:59:22 +03:00
Denis.Zharkov
a750d9466e FIR2IR: Rework resulted overridden-relation structure
The difference is how we deal with intermediate fake overrides
E.g., in case

interface A { /* $1 */ fun foo() }
interface B : A {
     /* $2 */ fake_override fun foo()
}
interface C : B {
   /* $3 */ override fun foo()
}

We've got FIR declarations only for $1 and $3, but we've got
a fake override for $2 in IR.

Previously, override $3 had $1 as its overridden IR symbol, just because
FIR declaration of $3 doesn't know anything about $2.

Now, when generating IR for $2, we save the necessary information
and using it for $3, so it has $2 as overridden.

So, it's consistent with the overridden structure of FE 1.0 and this
structure is necessary prerequisite for proper building of bridges
for special built-ins.
2021-02-20 10:59:22 +03:00
Denis.Zharkov
fd146e3eed FIR2IR: Copy annotations from original declarations to fake overrides 2021-02-20 10:59:22 +03:00
Denis.Zharkov
a883833941 FIR2IR: Use IrDeclarationOrigin.FAKE_OVERRIDE for non-source classes 2021-02-20 10:59:21 +03:00
Denis.Zharkov
d339096ac3 FIR2IR: Introduce and use declarationStorage.getOrCreateIrConstructor
It's necessary because constructors of LazyIrClass annotations may be
referenced before members are processed
2021-02-20 10:59:21 +03:00
Denis.Zharkov
fb8314f6e7 FIR: Fix enhancement of property overrides accessors in Java 2021-02-20 10:59:21 +03:00
Denis.Zharkov
45018ea468 FIR: Rework loading overrides of special built-in methods from Java
Some of the changed data is correct, but some diagnostics are incorrect
Corner cases like having both contains(Object) and contains(String)
within implementation of Collection<String> is not supported
2021-02-20 10:59:21 +03:00
Denis.Zharkov
4b0aeb7105 FIR2IR: Support initialSignatureDescriptor
It will be used for overrides of renamed special built-ins during signature mapping
to obtain initial signature
2021-02-20 10:59:21 +03:00
Denis.Zharkov
23705a269f FIR: Fix supertype scopes for local classes
Do not use ClassId as it can't be a key for local classes
2021-02-20 10:59:21 +03:00
Denis.Zharkov
3e420ca4e3 FIR: Introduce FirDeclarationOrigin.BuiltIns 2021-02-20 10:59:21 +03:00
Denis.Zharkov
893b1045ba Move some common parts from BuiltinMethodsWithDifferentJvmName to SpecialGenericSignatures 2021-02-20 10:59:21 +03:00
Denis.Zharkov
5d5228cfc5 FIR: Require FirJavaClass in JavaScopeProvider 2021-02-20 10:59:20 +03:00
Denis.Zharkov
04f53d6a23 FIR: Simplify JavaScopeProvider
::wrapScopeWithJvmMapped is only needed for built-in classes defined in Kotlin
2021-02-20 10:59:20 +03:00
Denis.Zharkov
6766c8fe47 FIR: Simplify supertypes scopes computation 2021-02-20 10:59:20 +03:00
Denis.Zharkov
31b9be2d01 FIR: Extract ConeKotlinType::scopeForSupertype 2021-02-20 10:59:20 +03:00
Mikhail Glukhikh
1a0be3ee40 Fix FirAnnotationArgumentChecker (String + ... case) #KT-44995 Fixed 2021-02-20 10:31:26 +03:00
Dmitriy Novozhilov
cd8f597e2f [FIR] Fix building callable reference adaptation against flexible types
#KT-45052 Fixed
2021-02-20 10:23:34 +03:00
Dmitriy Novozhilov
469252f6b4 [FIR] Don't create smartcast node if smartcasted type is equal to original type 2021-02-20 10:23:33 +03:00
Dmitriy Novozhilov
1c0d862e40 [FIR] Don't smartcast variables to invisible types
#KT-44802 Fixed
2021-02-20 10:23:33 +03:00
Dmitriy Novozhilov
026efca49f [Test] Add helpers file with functions for inference testing 2021-02-20 10:23:33 +03:00
Aleksei.Cherepanov
d0eeb0535d Add synchronization to MultiClassFiles maps 2021-02-19 23:54:55 +03:00
Aleksei.Cherepanov
aa683d3b2a JPS: Fix JvmMultifileClass processing for IR backend
#KT-44644 Fixed
2021-02-19 23:54:53 +03:00
Ilya Kirillov
ca4ec997ee FIR IDE: split KtAnalysisSession into mixins 2021-02-19 19:52:46 +01:00
Ilya Kirillov
141b6b0e55 FIR IDE: use different .after testdata for AbstractHLIntentionTest.kt 2021-02-19 16:44:50 +01:00
Ilya Kirillov
42103b7363 FIR IDE: use correct denotable type approximator 2021-02-19 16:44:48 +01:00
Ilya Kirillov
af4d300686 Use nullability from approximated local type in AbstractTypeApproximator 2021-02-19 16:44:47 +01:00
Mikhail Glukhikh
3571074da4 Update FIR-IDE diagnostic components 2021-02-19 18:24:49 +03:00
Mikhail Glukhikh
7c080395f2 FIR: minor test data fixes 2021-02-19 18:24:49 +03:00
Mikhail Glukhikh
7fdc1c7b21 Fix RawFirBuilderTotalKotlinTestCase.testPsiConsistency 2021-02-19 18:24:47 +03:00
Mikhail Glukhikh
54139b83ce FIR: fix EXPRESSION_REQUIRED positioning 2021-02-19 18:24:47 +03:00
Mikhail Glukhikh
588b1354f6 FIR IDE: fix reference shortening regarding new qualified sources 2021-02-19 18:24:47 +03:00
Mikhail Glukhikh
5066a90f6f FIR2IR: fix offsets for qualified expressions 2021-02-19 18:24:47 +03:00
Mikhail Glukhikh
239a44b30c FIR: forbid reporting inapplicable-likes on implicit constructors 2021-02-19 18:24:46 +03:00
Mikhail Glukhikh
34c90aab3b FIR: introduce & use REFERENCE_BY_QUALIFIER positioning strategy 2021-02-19 18:24:46 +03:00
Mikhail Glukhikh
0accaf0f30 FIR: report resolve-time errors on qualified access instead of reference 2021-02-19 18:24:46 +03:00
Mikhail Glukhikh
5ffa72f1fa FIR: change DOT_BY_SELECTOR to DOT_BY_QUALIFIED strategy 2021-02-19 18:24:46 +03:00
Mikhail Glukhikh
04caa5c612 Fix DEBUG_INFO_CALL positioning in FIR 2021-02-19 18:24:45 +03:00
Mikhail Glukhikh
5ca3ce9e37 FIR: introduce & use SELECTOR_BY_QUALIFIED positioning strategy 2021-02-19 18:24:45 +03:00
Mikhail Glukhikh
5892646a27 Change FirQualifiedAccess source to KtQualifiedExpression (if any) 2021-02-19 18:24:45 +03:00
Mikhail Glukhikh
742f1e0069 FIR: add replaceSource to all FIR tree nodes 2021-02-19 18:24:45 +03:00
Vladimir Dolzhenko
b8d1bbdd0d Do not swallow PCE
#KT-39776 Fixed
2021-02-19 15:04:45 +00:00
Dmitriy Novozhilov
d40777c28f [FIR] Fix calculating arguments of bare type with intersection type as base 2021-02-19 16:23:24 +03:00
Alexander Udalov
56f9e3360f JVM IR: do not generate invokeinterface hashCode if smart cast is present
#KT-45008 Fixed
2021-02-19 14:21:54 +01:00
Tianyu Geng
56854a8b1a FIR IDE: register quickfix for the following
1. NON_ABSTRACT_FUNCTION_WITH_NO_BODY
  2. ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS
  3. ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS
2021-02-19 13:16:42 +01:00
Dmitriy Novozhilov
88c43e7f7b [FE] Assume that effective visibility of sealed class constructor is internal
#KT-45033 Fixed
#KT-45043
2021-02-19 14:06:49 +03:00
Ilya Kirillov
b08eb6cf4c FIR IDE: specify behaviour of HL API getOverriddenSymbols
- Split it into two functions getAllOverriddenSymbols and getDirectlyOverriddenSymbols
- Implement tests for getOverriddenSymbols
- temporary mute inheritance.kt light classes test
2021-02-19 11:49:57 +01:00
Ilya Kirillov
804df1aec2 FIR IDE: introduce base class for multifile tests 2021-02-19 11:49:56 +01:00
Dmitriy Novozhilov
3626008ed2 [Inference] Add ability to approximate local types in AbstractTypeApproximator 2021-02-19 12:47:27 +03:00
Mikhail Glukhikh
73616107b4 Unmute passing FIR BB test 2021-02-19 12:19:42 +03:00
Dmitry Petrov
c629ba5a3c JVM_IR indy-SAM: function reference to Java interface 2021-02-19 12:04:30 +03:00
Mikhail Glukhikh
357a7907a3 FIR: fix type approximation by visibility 2021-02-19 10:39:57 +03:00
Roman Golyshev
74bdb2398e FIR: Get rid of PSI dependency in the :fir:resolve module 2021-02-19 07:20:06 +00:00
Tianyu Geng
6b453d9b23 FIR: implement checker for open members
Specifically,

1. NON_FINAL_MEMBER_IN_FINAL_CLASS
2. NON_FINAL_MEMBER_IN_OBJECT
2021-02-19 10:17:18 +03:00
Mikhail Glukhikh
3e9ff3ecda FIR: report SUPERTYPE_NOT_A_CLASS_OR_INTERFACE on type parameters 2021-02-19 10:17:17 +03:00
Jinseong Jeon
e67eb0c123 FIR checker: typed declaration's return type should be resolved
except for those in function contracts
2021-02-19 10:17:17 +03:00
Jinseong Jeon
5f9357eb41 FIR: transform implicit type ref in anonymous function arguments & body
^KT-45010 Fixed
2021-02-19 10:17:16 +03:00
Jinseong Jeon
a841a0bbca FIR: transform other parts of function call even though callee is an error 2021-02-19 10:17:16 +03:00
Jinseong Jeon
27c942a0ff FIR: enforce the return type of function literals without body
Its return type should be Unit, so do not use the expected type from,
e.g., parameter type.
2021-02-19 10:17:16 +03:00
Jinseong Jeon
9aaa952b39 FIR: regard implicit type for value parameter after body resolve as an error type 2021-02-19 10:17:16 +03:00
Jinseong Jeon
fbb19e3b50 FIR: ensure type ref transformed by type resolve transformer is resolved 2021-02-19 10:17:15 +03:00
Jinseong Jeon
52ea7fdb72 FIR: ensure type ref after supertype resolve transformer is resolved 2021-02-19 10:17:15 +03:00
Vladimir Dolzhenko
8783ebc352 Report highlight errors to WolfTheProblemSolver
Relates to #KT-37702
#KTIJ-1246 Fixed

Original commit: bd222a5255c2fd6f4abfce3115f81733ef9a39f3
2021-02-19 05:46:04 +00:00
tgeng
afe71f5d59 FIR: Add runConfig to generate FIR boilerplate (#4130)
* FIR: Add runConfig to generate FIR boilerplate

* FIR: Add runConfig to generate FIR boilerplate
2021-02-18 23:26:10 +01:00
Tianyu Geng
51da54ce66 FIR IDE: Simplify registerPsiQuickFixes
This change makes it possible to register multiple fixes for a
diagnostic. Also, the previous registerPsiQuickFix that relies compiler
to infer the KtFirDiagnostic type parameter is dangerous since it
can silently register fixes on interface `KtDiagnosticWithPsi` if caller
doesn't specify it explicitly.
2021-02-18 19:37:37 +01:00
Ilmir Usmanov
cacd84390e Use erased upper bound instead of checking for inline type 2021-02-18 18:31:50 +01:00
Ilmir Usmanov
741c1a864f JVM_IR: IC: Unbox inline class argument of callable reference
if it is unbound and the underlying type is reference type.
If the underlying type is primitive, it is boxed and unboxed
correctly, otherwise, it is simply casted and not unboxed.
Additionally, generate functions for inliner with inline classes
in signature, so unboxing works.
The unboxing is removed after inlining.
 #KT-44722 Fixed
2021-02-18 18:31:48 +01:00
Dmitry Petrov
744a0fcd25 PSI2IR KT-45022 object in LHS of compound assignment 2021-02-18 20:24:16 +03:00
Dmitriy Dolovov
05447ce0c8 [Commonizer] Print true time for resolving of libraries to be commonized 2021-02-18 18:47:38 +03:00
Dmitriy Dolovov
0b26a281de [Commonizer] Print pretty target name in console output 2021-02-18 18:47:33 +03:00
Dmitriy Dolovov
fb51105a5d [Commonizer] Log time in commonizer result consumers 2021-02-18 18:47:28 +03:00
Dmitriy Dolovov
496aad3c4a [Commonizer] Log commonization only for really present targets 2021-02-18 18:47:19 +03:00
Dmitriy Dolovov
3ad7b60747 [Commonizer] Prefer using CommonizerTarget instead of KonanTarget 2021-02-18 18:47:14 +03:00
Dmitriy Dolovov
1895c230ef [Commonizer] K/N dist: Process targets in alphabetical order 2021-02-18 18:47:10 +03:00
Dmitriy Dolovov
f473b88e47 [Commonizer] Nicer API for CirProvidedClassifiers 2021-02-18 18:47:05 +03:00
Dmitriy Dolovov
84ce9c612c [Commonizer] Keep only "common" dependencies in CirKnownClassifiers 2021-02-18 18:47:00 +03:00
Dmitriy Dolovov
2581b67cda [Commonizer] Rename: CirCommonizedClassifiers -> CirCommonizedClassifierNodes 2021-02-18 18:46:55 +03:00
Dmitriy Dolovov
43ad0ed907 [Commonizer] Optimized implementation of CirProvidedClassifiers
Read classifiers directly from metadata, don't use descriptors.
2021-02-18 18:46:49 +03:00
Dmitriy Dolovov
79e3ce022f [Commonizer] Fix: Keep fwd declarations under real names in CirForwardDeclarations cache 2021-02-18 18:46:45 +03:00
Anton Bannykh
bc9a791809 Refactor klib serializer/deserializer 2021-02-18 18:03:41 +03:00
Victor Petukhov
ad9fd7ecf3 KotlinBinaryClassCache: clean-up request caches for all threads
^KT-44550 Fixed
2021-02-18 17:05:59 +03:00
Alexander Dudinsky
5cbbbc3b83 Fix artifacts needed for the kotlin-gradle-plugin 2021-02-18 16:50:52 +03:00
Alexander Dudinsky
33313ae4b4 Fix artifacts needed for the kotlin-gradle-plugin 2021-02-18 16:47:22 +03:00
Sergey Shanshin
8c20c655fe Updated bytecode of serialization for IR
`shouldEncodeElementDefault` now checked before evaluating default value
2021-02-18 15:03:35 +03:00
Dmitriy Novozhilov
7b7b8fbea7 [Test] Filter dependent modules by source kind in creating FirModuleInfo 2021-02-18 14:44:44 +03:00
Alexander Udalov
8c95b78346 Update JVM metadata version to 1.5.0
Improve the test which checks that we use correct metadata version if
`-language-version` is passed by checking all supported language
versions.

The change in libraries/reflect/build.gradle.kts is needed because
kotlinx-metadata-jvm of version 0.1.0 is based on pre-1.4 Kotlin, which
doesn't support the new module file metadata generated with metadata
version 1.4 and later, and module files need to be readable there to be
able to transform them for the shadow plugin.

Similarly override dependency on kotlinx-metadata-jvm in the
binary-compatibility-validator module.
2021-02-18 12:42:23 +01:00
Alexander Udalov
dbadd5846a Add test for script flag in kotlin.Metadata
It passes at the moment because the test uses old backend, but the
required behavior is not yet supported in JVM IR, and it'll need to be
fixed.
2021-02-18 12:36:54 +01:00
Alexander Udalov
1d6b198915 Build: suppress version and JVM target warnings
To further reduce the output on each build.
2021-02-18 12:17:17 +01:00
Alexander Udalov
49fc1b9e3e Build: enable -Werror for several modules 2021-02-18 12:14:09 +01:00
Hyojae Kim
82ac482143 Fix typo (#4051)
Fix typo
2021-02-18 12:28:19 +03:00
Alexander Dudinsky
a3fa6c6d13 Publish artifacts needed for the kotlin-gradle-plugin in kotlin-ide repository 2021-02-18 11:51:32 +03:00
Dmitriy Novozhilov
9b4949a3c5 [FIR] Fix taking symbol of expression with smartcast inside DFA 2021-02-18 10:10:38 +03:00
Alexander Udalov
adb05ab076 JVM IR: write inherited multifile parts flag to kotlin.Metadata
This flag is unused at the moment, but might be used one day to support
proper incremental compilation for multifile classes.
2021-02-17 21:56:18 +01:00
sebastian.sellmair
35008df969 [Commonizer] Rename NativeDistributionCommonizer to LibraryCommonizer 2021-02-17 19:24:54 +00:00
sebastian.sellmair
4500b6ce74 [Commonizer] Implement :native:kotlin-klib-commonizer:api with support for library commonization
- Implement new Gradle module ':native:kotlin-klib-commonizer'
- Implement new NativeKlibCommonize task
- Implement CommonizerTarget.identityString
2021-02-17 19:24:54 +00:00
Dmitry Petrov
6d019d9544 JVM_IR indy-SAM on functional expression 2021-02-17 22:18:06 +03:00
Mikhael Bogdanov
134fda8bad Support Unit/V types in string-concat indy calls
unitComponent.kt test fails with JVM target 9+
2021-02-17 18:43:24 +01:00
Mikhael Bogdanov
e3e7e6b740 Make indy-with-constants default for -jvm-target 9+
#KT-42522 Fixed
2021-02-17 18:43:23 +01:00
Mikhael Bogdanov
3d8e8dd3ba Fail on compilation errors in AbstractBytecodeTextTest 2021-02-17 18:43:23 +01:00
Mikhael Bogdanov
61fce74b76 Support new targets in KotlinBytecodeToolWindow
#KT-30222 Fixed
2021-02-17 18:43:23 +01:00
Sergey Shanshin
91f1cb88c1 Support serialization of java enum classes in IR
Fixes Kotlin/kotlinx.serialization#1334
2021-02-17 20:24:31 +03:00
Tianyu Geng
652207dcac FIR IDE: add AddModifierFix 2021-02-17 18:19:27 +01:00
Tianyu Geng
5793f77ece FIR IDE: AddModifierFix -> AddModifierFixMpp 2021-02-17 18:19:27 +01:00
Sergey Shanshin
de06a69b12 Added external serializers in serialization plugin for IR backend
- added fallback support of external serializers in IR
- implemented calculations of properties default values in IR
- swapped check of shouldEncodeElementDefault and comparing the property with default value in IR. Now default value calculated only of shouldEncodeElementDefault returns false
2021-02-17 20:16:34 +03:00
Tianyu Geng
66f00a2eb5 FIR IDE: move AddFunctionBodyFix to fe-independent 2021-02-17 18:14:10 +01:00
Alexander Udalov
67e91b7ebd Minor, add workaround for KT-45008 2021-02-17 16:39:19 +01:00
Alexander Udalov
4d9cffccf2 Support structural equals/hashCode for type constructors of type parameters
Use the same logic as for type constructors of classes, based on the
fully-qualified name of the classifier, with special cases for error
types and local declarations, with an additional check that the type
constructors' declaration descriptors are structurally equal via
`DescriptorEquivalenceForOverrides`. The latter is required because type
parameters of overloaded functions must be different, even though their
full FQ name is the same.

This (hopefully) has no effect for the compiler, but is useful for
kotlin-reflect where `KType.equals` runs the type checker on the
underlying `KotlinType` instances, which eventually ends up comparing
type constructors. Descriptors and types in kotlin-reflect are cached on
soft references, so they may be suddenly garbage-collected and
recomputed, and we want copies of the same type parameter to be equal to
each other.

This fixes flaky codegen tests which started to fail after migration to
the new test infrastructure, where tests are now run in parallel in the
same process, thus with higher memory pressure and more soft references
being GC'd:

* `codegen/box/reflection/types/createType/typeParameter.kt`
* `codegen/box/reflection/supertypes/genericSubstitution.kt`

Also, add a new test to check that we do the instanceof check in
overrides of `AbstractTypeConstructor.isSameClassifier`.

 #KT-44850 Fixed
2021-02-17 14:41:07 +01:00
Alexander Udalov
aaecb87d1b Tests: compute runtime classpath for JVM box tests manually
Taking just the `jvmClasspathRoots` is not correct because it also
contains stuff needed for resolve to work correctly, such as JDK (full
or mock), stdlib (full or mock), reflect. JDK is obviously not needed in
the classpath, and stdlib/reflect are available via the parent class
loader, which is specifically reused across all tests to make them run
faster.

Also, don't try to create class loader for Java-only modules in
`JvmBoxRunner.processModule`. This happens, for example, for all tests
which were moved from `boxAgainstJava`.
2021-02-17 14:41:07 +01:00
Dmitriy Novozhilov
df42868874 [Inference] Fix subtyping on classes with same FQN but with different number of arguments
Such situations may appear if there are multiple classes with same
  names from different modules in dependencies
2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov
0b22c30ab1 [FIR] Fix dispatch receiver type for members of builtin functional types 2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov
e5ab684127 [FIR] Support methods of cone type contexts with annotation markers 2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov
57d29009ee [FIR] Fix TODOs and cleanup ConeTypeContext and ConeInferenceContext 2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov
373bc578fb [FIR] Implement capturing of cone types same as for kotlin types 2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov
5ce36a528e [FE] Prohibit sealed fun interfaces
#KT-44947 Fixed
2021-02-17 13:54:10 +03:00
Dmitriy Novozhilov
cdf7de5524 [FE] Change message for sealed interfaces with language target < 1.5 2021-02-17 13:51:14 +03:00
Dmitriy Novozhilov
8521d844e2 Advance bootstrap to 1.5.20-dev-814 2021-02-17 12:01:06 +03:00
Georgy Bronnikov
83343f3a7a IR: get rid of some type checks in JvmBackendContext 2021-02-17 11:05:22 +03:00
Georgy Bronnikov
68cabba698 IR: preserve signatures when copying IrFiles in performByIrFile 2021-02-17 11:05:22 +03:00
Georgy Bronnikov
db18ffc764 IR: only worry about threads in JvmIrSignatureDescriptor
General IdSignatureDescriptor is used from other backends, which have no
multi-threaded backend for now and do not need to carry the associated
runtime costs.

So IdSignatureDescriptor keeps the thread-unsafe caching of signature
builder.
2021-02-17 11:05:22 +03:00
Georgy Bronnikov
cacfe53065 IR: move performByIrFile to a separate .kt 2021-02-17 11:05:22 +03:00
Georgy Bronnikov
4c701cf44c IR: make extractedLocalClasses a JS-only field 2021-02-17 11:05:22 +03:00
Georgy Bronnikov
445f6eac3d IR: IrBasedDescriptor fix 2021-02-17 11:05:21 +03:00
Georgy Bronnikov
c081bc8d7e Fir concurrent maps 2021-02-17 11:05:21 +03:00
Georgy Bronnikov
9cdad272de Fir threadLocal 2021-02-17 11:05:21 +03:00
Georgy Bronnikov
ec2dc9c0fa IR: synchronize on SymbolTable operations 2021-02-17 11:05:21 +03:00
Georgy Bronnikov
c9d0448fd1 IR: use threadLocal 2021-02-17 11:05:21 +03:00
Georgy Bronnikov
56a26113cd IR: threadLocal
To be used for per-file state in global structures during parallel
lowering.
2021-02-17 11:05:20 +03:00
Georgy Bronnikov
57167922e2 IR: make lazyVar synchronized 2021-02-17 11:05:20 +03:00
Georgy Bronnikov
4e9bedc2fc JVM_IR: use ConcurrentHashMap
Replace mutable maps and sets accessed from by-file lowerings with
ConcurrentHashMap, so that lowerings can operate on them in parallel.
2021-02-17 11:03:27 +03:00
Georgy Bronnikov
23da2bde67 IR: fixes for IR by-file copying 2021-02-17 11:03:27 +03:00
Georgy Bronnikov
54a76977db IR: fix fake override computation
Due to IR copying in performByIrFile, we need to only distinguish
overrides up to their fqName.
2021-02-17 11:03:27 +03:00
Georgy Bronnikov
d154c8d8e6 IR: copy each file before lowering.
Avoid inter-file dependencies while lowering.
2021-02-17 11:03:27 +03:00
Georgy Bronnikov
103f82c95c IR: an option to automatically select the number of lowering threads 2021-02-17 11:03:27 +03:00
Georgy Bronnikov
52b3cb362b IR: thread pool in PerformByIrFilePhase 2021-02-17 11:03:27 +03:00
Georgy Bronnikov
eae416d739 IR: Handle exceptions from by-file lowering thread 2021-02-17 11:03:27 +03:00
Georgy Bronnikov
bea5d955d4 JVM_IR: perform file lowerings in parallel
Selected by -Xir-run-lowerings-in-paralled compiler flag.
2021-02-17 11:03:26 +03:00
Anton Bannykh
c06b345f3c Hide stageController into the IrFactory 2021-02-17 10:42:50 +03:00
Anton Bannykh
97080c49fc Persistent IR generator
Goal:
- avoid hand-writing the boilerplate
- easier PIR evolution

Output is reasonably close the hand-writtern version
2021-02-17 10:42:50 +03:00
Anton Bannykh
8a0ce20d43 PIR: minor restructuring 2021-02-17 10:42:50 +03:00
pyos
1310a65f0c JVM: rename this$0 when regenerating nested objects too
In the old backend, this was unnecessary because nested objects would
reference their lambdas' captures through the original this$0. On
JVM_IR, using loose capture fields means a name/descriptor clash can
occur on any level of nesting, not just the top.
2021-02-17 07:56:03 +01:00
Nikolay Krasko
ec89cb2313 Ignore hanging KotlinAndroid36GradleIT.testAndroidMppSourceSets()
Ignore till the proper investigation.
Probably caused in b262d09a81...5c7aadece9.
2021-02-17 00:26:19 +03:00
Ilmir Usmanov
ec569a4c89 Minor. Suppress errors in tests 2021-02-16 20:59:25 +01:00
Ilmir Usmanov
bad197e075 Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error 2021-02-16 20:59:21 +01:00
Dmitry Petrov
56a104dda9 JVM_IR KT-44974 fix SAM-converted capturing extension lambda 2021-02-16 19:51:59 +03:00
Dmitriy Novozhilov
83ed67546b [Test] Support WITH_STDLIB directive in js box tests 2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov
dfcff132fd [FIR] Fix false-positive smartcast on receiver in rhs of elvis
#KT-44942 Fixed
2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov
2b39282682 [FIR] Render original type before smartcasted type in DEBUG_INFO_EXPRESSION_TYPE
This is made for keep consistency with same renderer in FE 1.0
2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov
d4c26cca52 [FIR] Use type without smartcast for local variable with smartcasted initializer 2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov
40e286b354 [FIR] Increase level of sequential when branches
Level of CFGNode is used to determine which call is a common one for
  creating node with union of arguments (to merge flow from multiple
  in-place lambdas). Before this change calls in different when branches
  may have same node level, which entail passing smartcasts from moddle of
  one branch to another

```
val x: Any = ...
when {
    ... -> run { x as String } // (1)
    ... -> {
        run {
            x.foo()
        } // (2)
        "hello"
    }
}
```

Call `(1)` was assumed as argument of call `(2)` which is incorrect

#KT-44814 Fixed
2021-02-16 17:51:31 +03:00
Dmitriy Novozhilov
92271527cb [Test] Add CFG and IR dump handlers to FirBlackBoxTests 2021-02-16 17:51:31 +03:00
Dmitriy Novozhilov
b5619dbf37 [FIR] Add ability to render node levels in CFG graph dumper 2021-02-16 17:51:31 +03:00
Ilya Kirillov
3e22011626 Fix compilation of HLRedundantVisibilityModifierInspection 2021-02-16 15:47:08 +01:00
Ilya Kirillov
e8f3ebdd19 FIR IDE: introduce HLRedundantVisibilityModifierInspection by extended checker 2021-02-16 15:23:18 +01:00
Ilya Kirillov
6d97841f38 FIR IDE: introduce HLLocalInspectionTest 2021-02-16 15:23:18 +01:00
Ilya Kirillov
7fb6c22889 FIR IDE: allow creating inspections by extended checkers 2021-02-16 15:23:17 +01:00
Ilya Kirillov
b9a4613e44 FIR IDE: remove getMessage from HLPresentation as it duplicates HLApplicator.getActionName 2021-02-16 15:23:17 +01:00
Ilya Kirillov
c13889c2ea FIR: add ability to specify checkers list for checker components 2021-02-16 15:23:17 +01:00
Ilya Kirillov
ca4a07f73f Unify message bundles used in IDEA FIR into KotlinBundle 2021-02-16 15:23:17 +01:00
Vladimir Dolzhenko
6352814d45 Fix NPE
#KTIJ-898 Fixed

Original commit: 12d8e88b846f29598ca3904b49996bd6a9891ccd
2021-02-16 14:21:40 +00:00
Vladimir Dolzhenko
98ba379e07 Fixed NPE on StandaloneScriptRootsCache instantiation
Relates to ^EA-218043
#KTIJ-1137 Fixed

Original commit: 1d63a1b48d480b958ff44676c42b698a8ca5f64a
2021-02-16 14:21:39 +00:00
Dmitriy Dolovov
45b17120ad [Commonizer] Minor. Rename: 'dependee' -> 'dependency' 2021-02-16 17:19:49 +03:00
Dmitriy Dolovov
ec7e411d80 [Commonizer] Remove classifierId from CIR class/TA nodes 2021-02-16 17:19:43 +03:00
Dmitriy Dolovov
ef931d5561 [Commonizer] Don't keep kotlin/Any as the single supertype in CirClass 2021-02-16 17:19:38 +03:00
Victor Petukhov
baeee8988e [all-open] Don't affect private declarations to change their modality to open 2021-02-16 17:18:08 +03:00
Victor Petukhov
ec41775d7e [all-open] Fix formatting 2021-02-16 17:18:07 +03:00
Mads Ager
05ff2b1292 [JVM_IR] Extend when to switch translation to deal with nested ors.
FIR translates:

```
when (x) {
  1, 2, 3 -> action
  else -> other_action
}
```

to an IR structure with nested ors:

```
if ((x == 1 || x == 2) || (x == 3)) action
else other_action
```

This change allows that to turn into switch instructions in the
JVM backend.
2021-02-16 03:20:07 -08:00
Ilya Kirillov
91581d6c1a Move KotlinBundle to frontend-independent module
to use from IDEA FIR
2021-02-16 12:16:17 +01:00
Mikhail Glukhikh
a8c23e1c3a FirDefaultStarImportingScope: filter INVISIBLE_CLASSES properly 2021-02-16 12:38:46 +03:00
Mikhail Glukhikh
940588a9bb FE: commonize throw-related annotation FQ names 2021-02-16 12:38:46 +03:00
pyos
2dc0404751 FIR: prioritize visible imported classes during type resolution
and produce an error on ambiguity.
2021-02-16 12:38:45 +03:00
pyos
291ed4a38a FIR: handle typealiases during conflict resolution 2021-02-16 12:38:45 +03:00
Hung Nguyen
592c285198 Kapt: Don't create KDocCommentKeeper when not needed
Previously, even if `keepKdocComments=false`, we would still create the
KDocCommentKeeper object unnecessarily.

This commit makes sure we create the object only if
`keepKdocComments=true`.

Bug: Clean-up after commit e252171 for KT-43593
Test: Existing tests
2021-02-16 11:53:49 +03:00
Ilya Kirillov
0a72e16451 FIR: transform DiagnosticBuilder DSL to an object
To make diagnostics visible in symbol search in IJ
2021-02-15 22:28:13 +01:00
SokolovaMaria
15aaf3a078 Copy typeParameters from original declaration to the exportedDefaultStubFun before substitution of type parameters 2021-02-15 23:17:11 +03:00
Mark Punzalan
706d3e5aa8 FIR IDE: Add quickfix for VAR_ANNOTATION_PARAMETER. 2021-02-15 21:07:32 +01:00
Mark Punzalan
2f450549ab FIR IDE: Update FIR diagnostic test data for
INAPPLICABLE_LATEINIT_MODIFIER.
2021-02-15 19:37:14 +01:00
Mark Punzalan
4e44804c77 FIR IDE: Add quickfix for INAPPLICABLE_LATEINIT_MODIFIER.
Also changed FE1.0 checker and all related fix factories to report error
on the declaration instead of the lateinit modifier. This is consistent
with the direction of all checkers in FIR (no reporting on modifiers).
2021-02-15 19:37:14 +01:00
Dmitry Petrov
b1ab64e854 JVM_IR KT-44483 argument adaptation is already done in PSI2IR 2021-02-15 19:41:39 +03:00
Alexander Udalov
f1b0e893ae Remove kotlin-annotations-android
#KT-44815 Fixed
2021-02-15 17:23:44 +01:00
Alexander Udalov
899f75466d Remove tests on kotlin-annotations-android
#KT-44815
2021-02-15 17:23:44 +01:00
Alexander Udalov
3432f581cb Remove compiler support for kotlin-annotations-android
#KT-44815
2021-02-15 17:23:44 +01:00
Jinseong Jeon
a884555171 FIR: bail out early for override check if base candidate is private 2021-02-15 19:16:36 +03:00
Jinseong Jeon
09640d9d63 FIR checker: apply override checker to anonymous objects
^KT-44695 Fixed
2021-02-15 19:16:35 +03:00
Jinseong Jeon
9370f918e9 FIR: use override checker when populating directOverriddenProperties 2021-02-15 19:16:35 +03:00
Victor Petukhov
fa1507fb91 Fix FIR test lambdaParameterTypeInElvis 2021-02-15 18:51:51 +03:00
Simon Ogorodnik
83836037f8 Add documentation on type checker context / type system context 2021-02-15 18:29:00 +03:00
Simon Ogorodnik
3909e3c54c Decouple TypeCheckerContext and TypeSystemContext 2021-02-15 18:28:58 +03:00
Andrei Klunnyi
53a7dc1126 KT-44839 [Sealed interfaces]: restore move-tests for lang-version < 15
This commit restores tests removed in 690fb47c.
2021-02-15 15:28:00 +00:00
Andrei Klunnyi
eb0c73fd5e KT-44839 [Sealed interfaces]: ability to specify compiler options in tests 2021-02-15 15:28:00 +00:00
Andrei Klunnyi
c63a9afa56 KT-44839 [Sealed interfaces]: move refactoring for language level < 1.5
This commit restores sealed-check-logic for language level < 1.5
mistakenly removed in 690fb47c.

^KT-44839 fixed
2021-02-15 15:27:59 +00:00
Yahor Berdnikau
5c7aadece9 Fix test founds more lines then expected.
Now Gradle additionally prints warning message regarding using debug
logs that wrapped in '####*' lines.
2021-02-15 15:35:23 +01:00
Yahor Berdnikau
224aea0953 Ignore test due to the bug in AGP on Gradle 6.8+.
It is not possible to make it work via reflection.
2021-02-15 15:35:23 +01:00
Yahor Berdnikau
9d9df0c4ff Expect new attributes compatibility error.
Since Gradle 6.4 error message was changed, when dependency does not
provide all required attributes.
2021-02-15 15:35:22 +01:00
Yahor Berdnikau
6c0ee2f9ea Update test to use new test xml output format.
This format was slightly changed starting Gradle 6.6. Adapted
tests to use new expected output when current Gradle runner is greater
then 6.5.
2021-02-15 15:35:22 +01:00
Yahor Berdnikau
6d2465d00c Update Gradle version for tests to 6.8.1. 2021-02-15 15:35:18 +01:00
Dmitry Petrov
b262d09a81 JVM_IR KT-44627 fix bridge signature for parameter with primitive bound 2021-02-15 17:19:33 +03:00
Mikhail Glukhikh
fa0f967c83 FIR2IR: support adapted references for constructors 2021-02-15 17:08:13 +03:00
Mikhail Glukhikh
8bab208322 FIR2IR: use information about callable reference adaptation from resolve 2021-02-15 17:08:08 +03:00
Victor Petukhov
dcad9c84fc Don't fix type variables into Nothing in priority way
^KT-44546 Fixed
2021-02-15 15:12:45 +03:00
Yahor Berdnikau
440fc8c4e4 Deprecated 'kotlin.useCompilerFallbackSearch' property.
This property was introduced in 2018 and no longer supported.
See https://discuss.kotlinlang.org/t/how-to-set-usefallbackcompilersearch/9039
for details why it was introduced.
2021-02-15 12:43:22 +01:00
Yahor Berdnikau
069941cdaf Provide compiler classpath as task input.
This ensures that compiler classpath is what is expected
by Kotlin Plugin and removes possibility of leaking wrong jars
from Gradle wrapper classpath.

For 'kotlin.useFallbackCompilerSearch' old behaviour is still present,
but this option should be marked as deprecated and removed in one
of the Kotlin releases.
2021-02-15 12:43:18 +01:00
Dmitriy Dolovov
0eaea655d0 [Commonization] Improvements in approx. keys
- Don't print upper bounds if it contains only kotlin/Any?
- Print variance in lowercase
2021-02-15 13:25:52 +03:00
Dmitriy Dolovov
3c6eb8f8f4 Minor. Formatted 2021-02-15 13:25:47 +03:00
Dmitriy Dolovov
0af31abb04 [Commonizer] Add tests for overloading purely by different upper bounds 2021-02-15 13:25:40 +03:00
Dmitriy Dolovov
90cdb9203f [Commonizer] Fix integration tests: wrong mismatches filter 2021-02-15 13:25:34 +03:00
Dmitriy Dolovov
8a17de38d0 [Commonizer] Fix integration tests: serialize only own module contents 2021-02-15 13:25:28 +03:00
Dmitriy Dolovov
7f8f1dc4f8 [Commonizer] Calculate hash code by pure name in approximation keys 2021-02-15 13:25:22 +03:00
Mikhael Bogdanov
6ff5704ef9 Delete obsolete test 2021-02-15 11:24:10 +01:00
Mikhael Bogdanov
f493766563 Add IR tests to Android codegen test 2021-02-15 11:24:10 +01:00
Victor Petukhov
c0759f96e9 Fix FIR test lambdaParameterTypeInElvis 2021-02-15 12:59:07 +03:00
Yaroslav Chernyshev
8acf3b1d76 [Cocoapods] Fail import if project's version wasn't specified
#Fixed KT-44000
2021-02-15 12:39:40 +03:00
Victor Petukhov
c158c64ee0 Reformat TypeWithEnhancement.kt 2021-02-15 12:13:57 +03:00
Victor Petukhov
0d40022d6d Add reporting of the warnings based on Java annotations for expanded type aliases
Before that, such warnings weren't reported as the corresponding errors were reported during type inference (only original types took part there)
2021-02-15 12:13:55 +03:00
Victor Petukhov
d783d99443 Use upper bound checker for typealias expansion 2021-02-15 12:13:53 +03:00
Victor Petukhov
edb8007d52 Add test for errors reporting of UPPER_BOUND_VIOLATED 2021-02-15 12:13:52 +03:00
Victor Petukhov
befe8599c4 Report warnings or errors for violated type parameter's upper bounds from Java annotated with nullability annotations
^KT-43262 Fixed
2021-02-15 12:13:50 +03:00
Dmitriy Novozhilov
cf4e61bebb [FIR] Add spec diagnostic tests to [JPS] Fast FIR tests run configuration 2021-02-15 11:37:40 +03:00
Dmitriy Novozhilov
5711a8d610 [FIR] Support PreliminaryLoopVisitor in FIR DFA 2021-02-15 11:37:39 +03:00
Dmitriy Novozhilov
0e46a961a3 [FIR] Implement util Multimap classes 2021-02-15 11:37:39 +03:00
Dmitriy Novozhilov
67ad4249c8 [Test] Add FirDumpHandler to AbstractFirBlackBoxCodegenTest
This is needed to add ability to enable `FIR_DUMP` directive which
  may be helpful in investigating bugs
2021-02-15 11:37:39 +03:00
Victor Petukhov
a94086224d Clear request cache properly during disposing component 2021-02-15 11:13:11 +03:00
Victor Petukhov
6f64fd2fec Propagate inference session into declaration analyzers
It prevents missing inference session for local declaration (local functions, local classes or objects)

^KT-44801 Fixed
2021-02-15 11:12:58 +03:00
Victor Petukhov
dae1f4c05d Remove redundant extension receiver substitution during lambda's completion 2021-02-15 11:12:56 +03:00
Alexander Likhachev
b463a0fa58 [Gradle] Use property provider for configuration time only if available 2021-02-15 09:58:51 +03:00
Alexander Likhachev
683bd0ed38 [Gradle, JVM] Don't create deprecated compile/runtime configurations
Gradle also removes these configurations in 7.0. See gradle/gradle@2cb45cdbd0
#KT-44462 Fixed
2021-02-15 09:35:54 +03:00
Alexander Likhachev
ef458b20e1 [Gradle] Replace deprecated dependencies configurations in buildscript 2021-02-15 09:21:44 +03:00
Alexander Likhachev
c7427a751a [Gradle, K/N] Add integration tests for framework artifacts
#KT-43556 Fixed
2021-02-15 09:21:44 +03:00
Alexander Likhachev
383b9834a1 [Gradle, K/N] Make BitcodeEmbeddingMode move backward compatible 2021-02-15 09:21:44 +03:00
Alexander Likhachev
cbeb031099 [Gradle, K/N] Move NativeBinaryTypes from kotlin-gradle-plugin to kotlin-gradle-plugin-api 2021-02-15 09:21:44 +03:00
Alexander Likhachev
a6cdfeafed [Gradle, K/N] Consumable frameworks review fixes 2021-02-15 09:21:43 +03:00
Alexander Likhachev
604dda839a [Gradle, K/N] Generate fat framework tasks and consumable configurations 2021-02-15 09:21:43 +03:00
Alexander Likhachev
d844296629 [Gradle, K/N] Add user-defined variant attributes to framework artifact 2021-02-15 09:21:43 +03:00
Alexander Likhachev
cbdcd8f2bc [Gradle, K/N] Add consumable configuration with K/N frameworks 2021-02-15 09:21:42 +03:00
Alexander Likhachev
ba969410c2 [Gradle, JS] Make MultiplePluginDeclarationDetector compatible w/ conf cache 2021-02-15 09:21:42 +03:00
Alexander Likhachev
1cceec3642 [Gradle, JS] Postpone TeamCity project property read using 'by lazy'
Replace direct Gradle property access to provider usage. See https://docs.gradle.org/6.8.2/userguide/configuration_cache.html#config_cache:requirements:undeclared_gradle_prop_read
2021-02-15 09:21:42 +03:00
Alexander Likhachev
240fdfa7a8 [Gradle] Support multiple failures in KotlinTestReport back again 2021-02-15 09:21:42 +03:00
Alexander Likhachev
2b0ad70242 [Gradle, JS] Add integration test for js plugin configuration cache
#KT-42911 Fixed
2021-02-15 09:21:41 +03:00
Alexander Likhachev
a6bf9bf51b [Gradle, JS] Remove workaround for configuration cache enabled builds
It's removed as those tasks now support Gradle configuration cache
2021-02-15 09:21:41 +03:00
Alexander Likhachev
432c6486d5 [Gradle] Make KotlinTest, KotlinTestReport partially cc-compatible 2021-02-15 09:21:41 +03:00
Alexander Likhachev
c7421e2bea [Gradle, JS] Use FileSystemOperations only when it's available
FileSystemOperations is available since Gradle 6.0. ArchiveOperations usage is also refactored. Integration tests Gradle version requirements are reverted.
2021-02-15 09:21:41 +03:00
Alexander Likhachev
0e29a9df6c [Gradle, JS] Use target disambiguation classifier for compilation name 2021-02-15 09:21:40 +03:00
Alexander Likhachev
6eac5e1907 [Gradle, JS] Tasks that uses ArchiveOperations compatible w/ Gradle < 6.6 2021-02-15 09:21:40 +03:00
Alexander Likhachev
15f6bb9506 [Gradle, JS] Make NodeJsSetup cc-compatible 2021-02-15 09:21:40 +03:00
Alexander Likhachev
daa9c81bcb [Gradle, JS] Make KotlinJsDce, Dukat, KotlinPackageJson cc-compatible 2021-02-15 09:21:39 +03:00
Alexander Likhachev
da80d53796 [Gradle, JS] Make KotlinWebpack cc-compatible 2021-02-15 09:21:39 +03:00
Alexander Likhachev
65faf20472 [Gradle, JS] Make PublicPackageJsonTask cc-compatible 2021-02-15 09:21:39 +03:00
Ilya Goncharov
521b722c09 [Gradle, JS] Compilation to compilationName 2021-02-15 09:21:39 +03:00
Ilya Goncharov
4566b7c6e5 [Gradle, JS] rootPackageJson and kotlinNpmInstall cache-friendly 2021-02-15 09:21:38 +03:00
Ilya Goncharov
8c79baa998 [Gradle, JS] Partially rootPackageJson and kotlinNpmInstall with conf cache 2021-02-15 09:21:38 +03:00
Ilya Goncharov
a41d3e5b04 [Gradle, JS] Webpack task with conf cache (w/o install of dependencies) 2021-02-15 09:21:38 +03:00
Ilya Goncharov
e6bfe9a702 [Gradle, JS] Npm dependencies as transient, and store only declarations 2021-02-15 09:21:38 +03:00
Ilya Goncharov
b9aa577f84 [Gradle, JS] KotlinPackageJson configuration cache works 2021-02-15 09:21:37 +03:00
Ilya Goncharov
cd0dfd6fa9 [Gradle, JS] Use transient for compilation npm resolver 2021-02-15 09:21:37 +03:00
Ilya Goncharov
60da9281a2 [Gradle, JS] Next step of configurstion cache 2021-02-15 09:21:37 +03:00
Ilya Goncharov
19e59fe770 [Gradle, JS] Experimenting with making everything transient in npm 2021-02-15 09:21:36 +03:00
Andrey Zinovyev
cc51869a2a [KAPT] Take function argument names from original descriptor
#KT-43804 Fixed
2021-02-14 10:45:00 +03:00
Andrey Zinovyev
4a0437a507 [KAPT] Fix field type correction for delegates (#4107)
#KT-37586 Fixes
2021-02-14 10:38:38 +03:00
Vladimir Dolzhenko
bf9fa4c9da Lightweight hashCode calc for LibraryInfo
#EA-6040509 Fixed
2021-02-13 21:25:46 +01:00
Tianyu Geng
6882cf820e FIR IDE: move RemoveModifierFix to ...
idea-frontend-independent
2021-02-12 17:56:57 +01:00
Vyacheslav Karpukhin
75f6780b90 AndroidDependencyResolver: Don't load android-related classes on class load 2021-02-12 16:00:13 +01:00
Ilya Kirillov
d42cc219bf FIR IDE: fix collecting diagnostics for raanalysable non-toplevel declarations 2021-02-12 15:25:14 +01:00
Dmitry Petrov
6ba57abb8f JVM don't use indy by default for SAM conversions (wait for KT-44844)
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:32 +03:00
Dmitry Petrov
5013344bc4 JVM_IR nullability assertions test for indy lambdas
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:32 +03:00
Dmitry Petrov
4ab242ed51 JVM_IR indy: minor: use toLowerCaseAsciiOnly for options
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:31 +03:00
Dmitry Petrov
afeb7e18cd JVM_IR indy: fix non-null assertions on indy lambda parameters
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:31 +03:00
Dmitry Petrov
43b1711010 JVM_IR indy: extract LambdaMetafactoryArguments code to separate file
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:31 +03:00
Dmitry Petrov
3438d19c22 JVM_IR indy: use 'CLASS' mode in SAM bytecode listing tests
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:31 +03:00
Dmitry Petrov
7564c9bb8c JVM SamWrapperClassesAreSynthetic language feature
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:31 +03:00
Dmitry Petrov
052f6929c9 JVM_IR indy SAM conversions: update tests
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:30 +03:00
Dmitry Petrov
3ebeca5852 JVM_IR: use indy SAM conversions in jvmTarget 1.8+, fix bridges
KT-44278 KT-26060 KT-42621
2021-02-12 16:52:30 +03:00
Anton Bannykh
6c6d43c29a JS: add missing reachable nodes data 2021-02-12 16:21:09 +03:00
Sergey Igushkin
a719656118 Fix extracted metadata for IDE erased when scopes conflict, KT-44845
The root cause was that extractors for different scopes used the same
base directory, and each erased its contents. Using different base dirs
fixes the issue.

Issue #KT-44845
2021-02-12 12:54:32 +00:00
Dmitriy Novozhilov
54636f1af7 Enable -Werror in :compiler:frontend module 2021-02-12 14:50:47 +03:00
Dmitriy Novozhilov
0c4bca4bde [FIR] Fix warnings in FIR modules and enable -Werror in them 2021-02-12 14:50:46 +03:00
Dmitriy Novozhilov
0e31551797 [FIR] Generate _ instead of value for unused setters in FIR builders 2021-02-12 14:50:45 +03:00
Dmitriy Novozhilov
d696a488b5 [FIR] Report list of conflicting symbols in REDECLARATION and CONFLICTING_OVERLOADS 2021-02-12 14:50:43 +03:00
Roman Golyshev
7a4625b70b FIR IDE: Enable passing completion test 2021-02-12 14:29:22 +03:00
Roman Golyshev
d615b6b682 FIR IDE: firSymbolProvider -> symbolProvider fix 2021-02-12 10:53:24 +00:00
Roman Golyshev
bc26230392 FIR IDE: Visit only the smallest acceptable declaration if possible 2021-02-12 10:53:23 +00:00
Roman Golyshev
c3831baba2 FIR IDE: Refactor ElementsToShortenCollector to be more value-oriented 2021-02-12 10:53:23 +00:00
Roman Golyshev
dee4f4345b FIR IDE: Add ElementToShorten sealed classes 2021-02-12 10:53:22 +00:00
Roman Golyshev
d202b0feb2 FIR IDE: Refactor addElementToShorten functions 2021-02-12 10:53:21 +00:00
Roman Golyshev
09ba927680 FIR IDE: Decouple ElementsToShortenCollector from KtFirReferenceShortener 2021-02-12 10:53:21 +00:00
Roman Golyshev
c89380fc36 FIR IDE: Refactor ElementsToShortenCollector 2021-02-12 10:53:20 +00:00
Roman Golyshev
9a464ae9c4 FIR IDE: Merge all collectors visitors to a single visitor 2021-02-12 10:53:19 +00:00
Roman Golyshev
7478b8d189 FIR IDE: Use single TextRange as selection instead of two ints 2021-02-12 10:53:19 +00:00
Roman Golyshev
798c4d2485 FIR IDE: Create FirResolvedImports without fake PSI 2021-02-12 10:53:18 +00:00
Roman Golyshev
c0a4301179 FIR IDE: Enhance check messages in KtFirReferenceShortener 2021-02-12 10:53:17 +00:00
Roman Golyshev
8020424b93 FIR IDE: Remove fake root prefix even when the element is not shortened 2021-02-12 10:53:17 +00:00
Roman Golyshev
ee98a76600 FIR IDE: Implement simple importing of the functions
This is not a complete algorithm, but it already works in many cases

Disable some tests that not yet work
2021-02-12 10:53:16 +00:00
Roman Golyshev
88e7d1e5ee FIR: Attach candidate symbol to the ErrorNamedReference
This allows to restore the referenced candidate in cases when there are
no ambiguity

Also, change rendering of named references to be more accurate, so the
diagnostics tests pass: if reference is FirErrorNamedReference, it is
more important than if it has a not-null `candidateSymbol`
2021-02-12 10:53:15 +00:00
Roman Golyshev
51c59e5634 FIR IDE: Check function call before trying to drop the receiver 2021-02-12 10:53:14 +00:00
Roman Golyshev
d88fd5bd73 FIR IDE: More strictly navigate to parent KtDotQualifiedExpression 2021-02-12 10:53:14 +00:00
Roman Golyshev
e265a78a33 FIR IDE: Implement shortening and import for type qualifiers 2021-02-12 10:53:13 +00:00
Roman Golyshev
0e271b72c7 FIR IDE: Do not try to shorten type without qualifier 2021-02-12 10:53:12 +00:00
Roman Golyshev
534f4a66ad FIR IDE: Add simple shortening for qualified calls and properties 2021-02-12 10:53:12 +00:00
Roman Golyshev
f03ca5ea57 FIR IDE: Add import in case when conflicting class comes from * import 2021-02-12 10:53:11 +00:00
Roman Golyshev
0b48416a1e FIR IDE: Unwrap nullable types 2021-02-12 10:53:10 +00:00
Roman Golyshev
08e271411f FIR IDE: Create fake scopes to avoid import duplicates 2021-02-12 10:53:09 +00:00
Roman Golyshev
e34370554d FIR IDE: Add simple types importing
Some tests are not passing
2021-02-12 10:53:09 +00:00
Roman Golyshev
0609aa1e2e FIR IDE: Refactor KtFirReferenceShortener 2021-02-12 10:53:08 +00:00
Roman Golyshev
8575ce32d4 FIR IDE: Add more tests for type conflicts 2021-02-12 10:53:07 +00:00
Roman Golyshev
e744084c15 FIR IDE: Enable types shortening for nested classes and nested types 2021-02-12 10:53:07 +00:00
Roman Golyshev
b9d074051f FIR IDE: Add separate tests for FIR reference shortening 2021-02-12 10:53:06 +00:00
Roman Golyshev
c1130f2010 FIR IDE: Add reference shortening service which works over FIR 2021-02-12 10:53:05 +00:00
Roman Golyshev
108395fcfe FIR: Fix bug with incorrect source element for qualifiers 2021-02-12 10:53:04 +00:00
Roman Golyshev
1479388bd5 FIR IDE: Refactor AbstractFirShortenRefsTest
- Use `FIR_COMPARISON` directive
- Move testing utils to `ideaFirTestUtils.kt`
- Ignore `TopLevelFunctionImportWithLotsOfFqName.kt` test for now (it
takes too long to execute)
2021-02-12 10:53:04 +00:00
Roman Golyshev
68b5f2736e FIR: Add fake root prefix for IDE resolution 2021-02-12 10:53:03 +00:00
Roman Golyshev
0de251e50d Add runTestInWriteCommand flag to AbstractImportTest 2021-02-12 10:53:02 +00:00
Dmitriy Novozhilov
2d5b685535 [FIR] Fix processing constructors of sealed classes
- Allow declaring protected constructors in sealed classes
- Make default visibility of sealed class constructor `protected`

KT-44861
KT-44865
2021-02-12 13:36:41 +03:00
Dmitriy Novozhilov
7c61ddc72b [FE] Allow declaring protected constructors in sealed classes
#KT-44865 Fixed
2021-02-12 13:36:39 +03:00
Dmitriy Novozhilov
f3a8fcaea6 [FE] Make constructors of sealed classes protected instead of internal 2021-02-12 13:36:38 +03:00
Mikhael Bogdanov
e795c2c407 Generate proper hashCode for fun interface wrappers
#KT-44875 Fixed
2021-02-12 11:28:17 +01:00
Vyacheslav Karpukhin
f33cad54c5 AndroidDependencyResolver: fixed AAR import on modern AGP plugins 2021-02-11 23:24:19 +01:00
Vyacheslav Karpukhin
7eb5fc7778 AndroidDependencyResolver: fixed NPE 2021-02-11 23:24:18 +01:00
Anton Bannykh
abc44fa658 Increase -Xmx for Ant tests 2021-02-11 18:39:34 +03:00
Jinseong Jeon
20f9787c70 FIR checker: report errors in contract description 2021-02-11 17:02:18 +03:00
Jinseong Jeon
3d635b6a94 FIR: unwrap smartcast expression when extracting effects of contract 2021-02-11 17:02:16 +03:00
Jinseong Jeon
70f462781a FIR-IDE: add mappings for backing field diagnostics 2021-02-11 17:02:15 +03:00
Alexander Udalov
510b9e6f2a Move around some codegen box tests
In tests merged from boxAgainstJava in 29b96aa1, some directories were
named slightly differently compared to box, e.g. "property" vs
"properties", "varargs" vs "vararg". This change renames these, moves
some of the tests to more fitting directories, and also renames
"visibility" to "javaVisibility" because it's about Java visibilities
specifically.
2021-02-11 13:50:09 +01:00
Alexander Udalov
2d60fa787d Remove codegen tests on old language and API versions 2021-02-11 13:50:09 +01:00
Alexander Udalov
401f0ac583 Use TARGET_BACKEND instead of DONT_TARGET_EXACT_BACKEND in box against Java tests
"// TARGET_BACKEND: JVM" more clearly says that the test is
JVM-specific, rather than DONT_TARGET_EXACT_BACKEND which excludes all
other backends.
2021-02-11 13:50:08 +01:00
Victor Petukhov
f797ee7803 Substitute captured types with inner intersection one (NewTypeSubstitutor)
^KT-44651 Fixed
2021-02-11 14:20:14 +03:00
Alexander Udalov
80daf120e6 Apply illegal-access=permit workaround for JDK 16+
Apparently, the openjdk commit that enabled JEP 396 (encapsulated JDK
defaults) is effective since jdk-16+28:

https://github.com/openjdk/jdk/commit/ed4c4ee7
2021-02-11 12:12:39 +01:00
Yaroslav Chernyshev
4b62b2de0c Use IDEA ASM in kotlin-gradle-plugin-integration-tests module 2021-02-11 13:25:48 +03:00
Mark Punzalan
c3c8991ab6 FIR IDE: Re-organize MainKtQuickFixRegistrar. 2021-02-11 11:11:00 +01:00
Mark Punzalan
a9f19c4a45 FIR IDE: Move ChangeVariableMutabilityFix to idea-frontend-independent. 2021-02-11 11:11:00 +01:00
Mark Punzalan
7962224804 FIR IDE: Add quickfix for VAR_OVERRIDDEN_BY_VAL. 2021-02-11 11:11:00 +01:00
Mikhail Glukhikh
57e06992c9 Skip JDK 6 in failing BB test (java.util.function in use) 2021-02-11 12:59:23 +03:00
Mikhail Glukhikh
cd483ad231 FIR2IR: fix raw SAM conversion (avoid * in type arguments) 2021-02-11 11:48:35 +03:00
Mikhail Glukhikh
5f3102bf2f FIR2IR: expand type before getting nullability #KT-44803 Fixed 2021-02-11 11:48:35 +03:00
Mikhail Glukhikh
791f589127 SymbolTable: Rewrite nasty code with if without else in elvis RHS 2021-02-11 11:48:34 +03:00
Mikhail Glukhikh
4bc630d82c FIR2IR: enhance approximation of captured types 2021-02-11 11:48:34 +03:00
Mikhail Glukhikh
346ffb3acf FIR2IR: support substitution for SAM types 2021-02-11 11:48:34 +03:00
Mikhail Glukhikh
7050af9b79 FIR2IR: use invariant projections for SAM_CONVERSION types 2021-02-11 11:48:34 +03:00
Roman Artemev
67671afab4 [Plugin API] Fix missed call in resolveBySignatureInModule 2021-02-11 11:44:09 +03:00
Nikolay Krasko
2c4a6fdb98 Revert "Use IDEA ASM in kapt module"
This reverts commit 903defdf
2021-02-11 01:07:38 +03:00
Alexander Udalov
73aa465ee9 Add tests for issues fixed in JVM IR
Note that KT-30696 is fixed only in the single-module case, and KT-42012
is not fixed fully (see KT-44855).

 #KT-30041
 #KT-30629
 #KT-30696
 #KT-30933
 #KT-32351
 #KT-32749
 #KT-38849
 #KT-42012
 #KT-42990
 #KT-44234
 #KT-44529
 #KT-44631
 #KT-44647
2021-02-10 21:42:10 +01:00
Yaroslav Chernyshev
17fc10a8af Mark obsolete Gradle JVM options as Deprecated with Error
Options `includeRuntime`, `noStdlib` and `noReflect` were affected
#Fixed KT-44361
2021-02-10 21:21:03 +03:00
Andrey Zinovyev
6eaf0a95ca [KAPT] Fix expected resolve errors in tests (#4105) 2021-02-10 19:40:28 +03:00
Ilya Gorbunov
af8061a4dd Remove kotlin-test-multiplatform special dependency handling
#KT-40225
2021-02-10 18:46:23 +03:00
Dmitriy Novozhilov
2cd1aefd5e [FIR-IDE] Add mapping for FirExpression in diagnostics and generate new IDE ones 2021-02-10 17:38:45 +03:00
Jinseong Jeon
9b1f01ab04 FIR checker: differentiate unsafe infix/operator calls from UNSAFE_CALL 2021-02-10 17:38:45 +03:00
Jinseong Jeon
1729eff31b FIR checker: reincarnate FIR source child lookup utils
This is a partial revert of commit 94ddb71213
2021-02-10 17:38:44 +03:00
Jinseong Jeon
5e150d62ea FIR checker: differentiate UNSAFE_IMPLICIT_INVOKE_CALL from UNSAFE_CALL 2021-02-10 17:38:44 +03:00
Dmitriy Novozhilov
0c0c53cc2e [FE] Don't analyze members with CLASSIFIERS kind filter in AbstractLazyMemberScope
This commit introduces partial support of descriptorKindFilter in
  `AbstractPsiBasedDeclarationProvider`. Without it there may be an error
  in following case:

```
sealed class Base
class Derived : Base()

class Test<out V>(val x: Base) {
    private val y = when (x) {
        is Derived -> null
    }
}
```

Here we start to resolve type of `y`, then go to computation of inheritors
  of sealed class Base, which also may be inside Test, so we need get all
  nested classifiers in Test. But without this filtration we will start
  computing descriptor for `y` again, which leads to ReenteringLazyComputationException

#KT-44316 Fixed
2021-02-10 16:56:49 +03:00
Mikhael Bogdanov
903defdf30 Use IDEA ASM in kapt module 2021-02-10 12:23:47 +01:00
Dmitriy Dolovov
154a768a3a [Commonizer] Minor. Remove unused import 2021-02-10 14:18:14 +03:00
Dmitriy Dolovov
ac966ad1d2 [Commonizer] Add getParentEntityId() method to CirEntityId 2021-02-10 14:18:14 +03:00
Dmitriy Dolovov
4bab505c3a [Commonizer] Introduce CIR entities for representing various flavors of names
- CirName - simple name
- CirPackageName - fully-qualified name of the package
- CirEntityName - fully-qualified name of some entity, ex: Class, TypeAlias
2021-02-10 14:18:14 +03:00
Dmitriy Dolovov
f8c5244a39 [Commonizer] Use CirConstantValue class to represent constant values 2021-02-10 14:18:13 +03:00
Dmitriy Dolovov
25df25ccc6 [Commonizer] Minor. Extract common module names from CommonizerParameters 2021-02-10 14:18:13 +03:00
Dmitriy Dolovov
97000b1285 [Commonizer] Drop CirContainingClassdetails in favor of CirClass entity 2021-02-10 14:18:13 +03:00
Dmitriy Dolovov
054b59198b [Commonizer] Don't keep fqName inside of CirPackageNode 2021-02-10 14:18:13 +03:00
Dmitriy Dolovov
5d19ac16d5 [Commonizer] Drop useless CirPackageNode.moduleName property 2021-02-10 14:18:12 +03:00
Dmitriy Dolovov
c6756762e5 [Commonizer] Refactoring: Clean-up in CirTreeMerger 2021-02-10 14:18:12 +03:00
Dmitriy Novozhilov
671ebc6819 [FIR] Fix detecting that if in then branch of outer if used as expression 2021-02-10 14:17:38 +03:00
Alexander Udalov
e6588ee8a4 CLI: include META-INF/services/ from kotlin-reflect with -include-runtime
This is an addition to bd205317aa where we
started to add the contents of kotlin-reflect into the resulting jar if
-include-runtime is specified. Apparently kotlin-reflect doesn't work
without some services in META-INF/services/, which didn't satisfy the
condition for inclusion. The existing test didn't catch that because
loading class annotations does not always lead to those services being
loaded.
2021-02-10 12:05:36 +01:00
Alexander Udalov
3dfd2a95fa Minor, do not output "Not changed" for generated FIR checkers on each build 2021-02-10 12:04:40 +01:00
Dmitriy Novozhilov
1216b33593 [Test] Move extracting JVM_TARGET to provideConfigurationKeys 2021-02-10 13:02:07 +03:00
Dmitriy Novozhilov
606ae45f5f [Test] Replace remaining KOTLIN_CONFIGURATION_FLAGS directives with specific ones 2021-02-10 13:02:06 +03:00
Dmitriy Novozhilov
3ee5665746 Parse compiler configuration for android tests using new test infrastructure 2021-02-10 13:02:05 +03:00
Dmitriy Novozhilov
a0007bf244 Add analysisFlags of LanguageVersionSettings to toString() method 2021-02-10 13:02:04 +03:00
Dmitriy Novozhilov
7e59e083d3 [Test] Make some functions of environment configurators public
This is needed for using those methods from android tests
2021-02-10 13:02:03 +03:00
Dmitriy Novozhilov
24d6853ead [Test] Cleanup JvmEnvironmentConfigurator 2021-02-10 13:02:01 +03:00
Dmitriy Novozhilov
a932f69b8a [Test] Don't pass MockProject to environment configurators 2021-02-10 13:02:00 +03:00
Jinseong Jeon
bd37badf29 FIR checker: add diagnostics for backing fields 2021-02-10 12:29:34 +03:00
Mikhail Glukhikh
a88b82d8ff Rewrite nasty code with if without else in elvis RHS 2021-02-10 12:19:59 +03:00
Yahor Berdnikau
7a9315e6b6 Fix KaptWithoutKotlincTask task tries to get wrong properties. 2021-02-10 10:15:58 +01:00
Andrey Zinovyev
48ec227aaf [KAPT] Suppress resolve error in annotation procssing
#KT-33223
2021-02-10 10:59:46 +03:00
Ilya Chernikov
d64f7dd8c7 Revert "Add :kotlin-scripting-compiler.test to modules with disabled -Werror flag"
This reverts commit 21f022de
2021-02-10 08:33:15 +01:00
Ilya Chernikov
79b4b18e25 [minor] fix warnings in the script compiler and tests 2021-02-10 08:32:11 +01:00
Dmitry Petrov
d0f26abd18 JVM_IR KT-44798 don't generate multiple stubs with same signature 2021-02-10 09:09:28 +03:00
Vladimir Dolzhenko
9afe8a0a39 Make checker tests independent of plugin version
Relates to #KT-37702 #KTI-433
2021-02-09 22:52:17 +01:00
Ilya Chernikov
09ea4116e4 Implement forced script configuration reloading API for plugins
#KT-43288 fixed
2021-02-09 20:33:18 +00:00
Mikhael Bogdanov
2673261b10 Use proper jvmArgs syntax, remove -FailOverToOldVerifier from last configurations
`FailOverToOldVerifier` support is removed from JDK 16
2021-02-09 18:51:26 +01:00
Ilya Kirillov
c54354f348 FIR: fix memory leak from ConeIntegerLiteralTypeImpl via static NUMBER_TYPE
ConeClassLikeType has a cachedExpanded type which has a strong ref to FirSession
2021-02-09 17:15:46 +01:00
Ilya Kirillov
ede5fef39c FIR IDE: fix memory leak in symbols by firBuilder 2021-02-09 17:15:45 +01:00
Ilya Kirillov
cf3defbc9c FIR IDE: add more KDoc to HLApplicator stuff 2021-02-09 17:15:44 +01:00
Ilya Kirillov
2554065ae9 FIR IDE: forbid resolve in HLApplicator/HLApplicabilityRange/HLPresentation 2021-02-09 17:15:43 +01:00
Ilya Kirillov
7ab9583102 FIR IDE: add KDoc for HLApplicabilityRange 2021-02-09 17:15:42 +01:00
Ilya Kirillov
91e135888d FIR IDE: introduce HLSpecifyExplicitTypeForCallableDeclarationIntention and HLRedundantUnitReturnTypeInspection 2021-02-09 17:15:41 +01:00
Ilya Kirillov
a6f76399e2 FIR IDE: introduce infrastructure for HL based inspections & intentions 2021-02-09 17:15:40 +01:00
Ilya Kirillov
5cefad1ab3 FIR: use GeneratorsFileUtil for checkers-component-generator 2021-02-09 17:15:38 +01:00
Ilya Kirillov
4cf863e054 FIR: simplify PositioningStrategy checkers generator 2021-02-09 17:15:38 +01:00
Ilya Kirillov
21ac83aba0 FIR: rename Diagnostic to DiagnosticData in checkers generators to avoid conflict with existing Diagnostic class 2021-02-09 17:15:37 +01:00
Ilya Kirillov
cf56c59ca2 Fix binary incompatibility of createRemoveModifierFromListOwnerFactory 2021-02-09 17:15:35 +01:00
Ilya Kirillov
8fc6e50dd1 FIR IDE: allow specify position to insert directive in IgnoreTests 2021-02-09 17:15:35 +01:00
Ilya Kirillov
b2d51dc455 FIR: Update diagnostics list after rebase 2021-02-09 17:15:34 +01:00
Ilya Kirillov
fe9c0e584f FIR IDE: update test data 2021-02-09 17:15:33 +01:00
Ilya Kirillov
e269b1d19d FIR IDE: temporary mute failing tests 2021-02-09 17:15:32 +01:00
Ilya Kirillov
d72a2d39da FIR IDE: ignore not passing quickfixes tests 2021-02-09 17:15:31 +01:00
Ilya Kirillov
6c81d9848d FIR IDE: introduce ChangeReturnTypeOnOverrideQuickFix 2021-02-09 17:15:31 +01:00
Ilya Kirillov
9304056901 FIR IDE: add quick fix tests 2021-02-09 17:15:30 +01:00
Ilya Kirillov
5d32cb0daf FIR IDE: add remove modifier quick fixes 2021-02-09 17:15:29 +01:00
Ilya Kirillov
c87e6c6a87 FIR IDE: fix finding containing declaration for constructor param 2021-02-09 17:15:29 +01:00
Ilya Kirillov
f7aec31abf FIR IDE: add KDoc for KtSymbol.psi 2021-02-09 17:15:28 +01:00
Ilya Kirillov
aed728c4d8 FIR IDE: do not require containing declaration for getting overridden symbols 2021-02-09 17:15:27 +01:00
Ilya Kirillov
0fbb5c60c9 FIR IDE: add helper function for getting psi of KtSymbol 2021-02-09 17:15:26 +01:00
Ilya Kirillov
99a6f24771 FIR IDE: make KtCallableSymbol to be KtTypedSymbol 2021-02-09 17:15:26 +01:00
Ilya Kirillov
b114a45f23 FIR IDE: render KtFunctionalType in KtTypeRenderer 2021-02-09 17:15:25 +01:00
Ilya Kirillov
a10f54befa FIR IDE: introduce KtFunctionalType 2021-02-09 17:15:24 +01:00
Ilya Kirillov
0551834164 Extract getText/getFamilyName from ChangeCallableReturnTypeFix to use in FIR IDE 2021-02-09 17:15:23 +01:00
Ilya Kirillov
79baffb69d FIR IDE: add PSI type parameter to KtDiagnostic 2021-02-09 17:15:23 +01:00
Ilya Kirillov
e008ad03a2 FIR: add groups to diagnostics DSL 2021-02-09 17:15:11 +01:00
Ilya Kirillov
aaba5742dc FIR IDE: add severity to KtDiagnostic 2021-02-09 17:14:58 +01:00
Ilya Kirillov
f5ec37db95 FIR IDE: report diagnostics for non-kt elements 2021-02-09 17:14:47 +01:00
Ilya Kirillov
e9a5749cf4 FIR IDE: introduce KtQuickFixService 2021-02-09 17:14:35 +01:00
Ilya Kirillov
05fb88d2d9 Migrate RemoveModifierFix factories to QuickFixesPsiBasedFactory to use in FIR IDE 2021-02-09 17:14:33 +01:00
Ilya Kirillov
794558ab68 Introduce QuickFixesPsiBasedFactory for quickfixes which can be created only by PSI 2021-02-09 17:14:27 +01:00
Ilya Kirillov
6dd2037f85 Move QuickFixActionBase & KotlinIntentionActionsFactory to frontend-independent module 2021-02-09 17:14:26 +01:00
Ilya Kirillov
15ff79830f FIR: remove existingN diagnostic creation functions 2021-02-09 17:14:24 +01:00
Ilya Kirillov
e41ad2ea06 FIR IDE: implement generators for IDE diagnostics 2021-02-09 17:14:23 +01:00
Ilya Kirillov
c87684a6ef FIR IDE: use simple KtDiagnostic wrapper for diagnostics 2021-02-09 17:14:22 +01:00
Ilya Kirillov
b92dce9be4 FIR: introduce DSL to generate diagnostics list
this is needed to generate diagnostic list for IDE
2021-02-09 17:14:22 +01:00
Ilya Kirillov
5ff816127a FIR: extract ConeDiagnostic -> FirDiagnostic to fun to use in IDE code 2021-02-09 17:14:21 +01:00
Ilya Chernikov
ef4fa3381d Pass provided script configuration to refining code
when script compilation configuration refinement
happening during parsing, the updated configuration
passed to the script compiler/REPL compile function
is now used.
#KT-44580 fixed
2021-02-09 15:22:55 +00:00
Dmitriy Novozhilov
6dd331d7e8 [FIR] Add tests for non exhaustive when as last expression of lambda
KT-44810
2021-02-09 16:04:42 +03:00
Dmitriy Novozhilov
e54f31cc2f [IR] Remove useless init block from IrLazyFunction
This block was accidentally added in aaa3fa58 in debug purposes
2021-02-09 16:04:42 +03:00
Dmitriy Novozhilov
8f0e1035fa [FIR] Rename KEY and VALUE generics of FirCache to K and V 2021-02-09 16:04:42 +03:00
Dmitriy Novozhilov
e7fdc18ced [FIR] Fix [JSP] Fast FIR tests run configuration 2021-02-09 16:04:41 +03:00
Dmitriy Novozhilov
d7e3e83251 [FIR] Update testdata of FIR spec tests 2021-02-09 16:04:41 +03:00
Dmitriy Novozhilov
18bde2c542 [FIR] Reimplement when exhaustiveness checker to fir it's logic with FE 1.0 2021-02-09 16:04:41 +03:00
Dmitriy Novozhilov
2a1c9283a4 [FIR] Add useful util extensions for cone type 2021-02-09 16:04:41 +03:00
Dmitriy Novozhilov
ad677046a8 [FIR] Replace isExhaustive flag with ExhaustivenessStatus object 2021-02-09 16:04:40 +03:00
Dmitriy Novozhilov
96038e4b32 [FIR] Support java sealed class interop 2021-02-09 16:04:40 +03:00
Dmitriy Novozhilov
abd1c8fb30 [FIR] Move sealedInheritors declaration data to :fir:tree module 2021-02-09 16:04:40 +03:00
Dmitriy Novozhilov
8dd9d98129 [FIR] Implement checker for exhaustive when's in expression position 2021-02-09 16:04:40 +03:00
Dmitriy Novozhilov
3f715e671d [FIR] Fix checking for null exhaustiveness with expression of Nothing? type 2021-02-09 16:04:40 +03:00
Dmitriy Novozhilov
76f9830b47 [FIR] Fix checking for boolean exhaustiveness with || in branch 2021-02-09 16:04:40 +03:00
Dmitriy Novozhilov
6469900b5e [FIR] Fix forgotten light source element for if expression 2021-02-09 16:04:39 +03:00
Dmitriy Novozhilov
11ab37160e [FIR] Save info that when was used as expression 2021-02-09 16:04:39 +03:00
Dmitriy Novozhilov
490ef210ac [FIR] Support sealed class inheritors in multiple files 2021-02-09 16:04:39 +03:00
Dmitriy Novozhilov
c8f9cc33ef [FIR] Pass all FirFiles to FirGlobalResolveProcessor.process 2021-02-09 16:04:39 +03:00
Dmitriy Novozhilov
38437fb036 [FIR] Rename session.firSymbolProvider to session.symbolProvider
to avoid visual conflicts with `session.firProvider`
2021-02-09 16:04:39 +03:00
Andrei Klunnyi
e3c1aa599d KT-44487 [Sealed Interfaces]: sealed-inheritors-provider for MPP 2021-02-09 12:54:51 +00:00
Igor Chevdar
6f9bcf249b [IR] Supported inlining of adapted references + tests 2021-02-09 17:23:19 +05:00
Dmitriy Novozhilov
9724d81a49 [FIR] Support boolean elvis bound smartcasts
#KT-44511 Fixed
2021-02-09 15:20:36 +03:00
Dmitriy Novozhilov
2b088f1147 [FIR] Fix generating data class if there is non-property in primary constructor
#KT-44554 Fixed
2021-02-09 15:20:34 +03:00
Mikhael Bogdanov
30b5bfe767 Disable D8 checks for -jvm-target 15 tests 2021-02-09 12:34:56 +01:00
Mikhael Bogdanov
3dff225b98 Aligh test data with JDK 15 reflection output 2021-02-09 12:34:55 +01:00
Mikhael Bogdanov
21e9f67322 Add JvmTargetXOnJvm15 test suites 2021-02-09 12:34:55 +01:00
Mikhael Bogdanov
5c5fb0ae39 Add JvmTarget6OnJvm8 test suite 2021-02-09 12:34:55 +01:00
Ilmir Usmanov
8af9ce1e0b Minor. Ignore test on WASM 2021-02-09 12:31:14 +01:00
Ilmir Usmanov
275fef94fe JVM_IR. Do not mangle callable reference constructor call
#KT-44703 Fixed
2021-02-09 12:31:11 +01:00
Andrey Zinovyev
10cc86c975 [KAPT] Warn about usage of types from default package
Java doesn't support import from default package. 
We can't fix it, so we warn about it.
#KT-36743
2021-02-09 13:32:27 +03:00
Tianyu Geng
58d903c638 [FIR IDE] Make KtSmartcastProvider report resolved smartcast type 2021-02-09 11:19:58 +01:00
Roman Artemev
d97a2b13c0 [Plugin API] Add API to load top level declaration by its signature
- request from JP Compose, #KT-44100
2021-02-09 11:56:20 +03:00
Roman Artemev
ca6e1b8f1b Add box test for #KT-43831 2021-02-09 11:33:34 +03:00
Roman Artemev
79f986bb75 [IR] Fix IrType equality in case of complex variance
- reimplement type capturing on top of pure IrCaptureType
 - add captured type substitutor
 - fix #KT-43831
2021-02-09 11:33:34 +03:00
Roman Artemev
4ed93d3dee [IR] Add IrCapturedType into IR type system
- support it in TypeSystemContext
2021-02-09 11:33:33 +03:00
Georgy Bronnikov
9b6f95faa2 FIR: report lowering time in FullPipelineModularizedTest 2021-02-09 10:59:35 +03:00
Georgy Bronnikov
1664eec7e4 FIR: report lowering time from JvmIrCodegenFactory 2021-02-09 10:59:35 +03:00
Pavel Kirpichenkov
75954dd1a4 Minor: refactor extended compiler checks
Use an analysis flag instead of a stub language feature
2021-02-08 18:47:30 +03:00
Pavel Kirpichenkov
2a46da906c Provide additional information about missing supertypes
Add -X flag to report extra compiler diagnostics which migth break compatibility.
Use the flag to unconditionally check constructors without fear of
prematurely evaluating lazy supertypes.

KT-19234
KT-42404
KT-44583
2021-02-08 18:47:30 +03:00
Mikhail Glukhikh
4a381d4b83 FIR DFA: update receivers properly in case of single flow in merge point 2021-02-08 18:23:44 +03:00
pyos
d96921e287 FIR2IR: collect annotations when expanding type aliases 2021-02-08 18:23:19 +03:00
Vladimir Dolzhenko
872effc21e Check declaration modifier for actual method to avoid freeze
Checking modifier aims to get rid of unnecessary resolve for methods in non MPP (the most) cases

Relates to #KTIJ-1200
2021-02-08 14:43:19 +00:00
Muhammad Hakim Asy'ari
3e17317f31 Update steps to install JDK 6 on Mac OS (#4052) 2021-02-08 16:41:38 +03:00
Mikhail Glukhikh
d4b0688690 FIR: introduce delegate field initializers
Before this commit we initialized delegate fields in primary constructor,
that could provoke NPE in case delegate is used in initializer of
some property backing field.
Now we initialize delegate fields directly instead.
2021-02-08 14:28:27 +03:00
Mikhail Glukhikh
2cbdad0bb1 FIR2IR: insert implicit cast of receiver to Any for interface Any calls 2021-02-08 14:28:26 +03:00
Mikhail Glukhikh
1c210c2386 FIR: fix of super.methodOfAny resolve in case of one supertype 2021-02-08 14:28:25 +03:00
Mikhail Glukhikh
694d69fbfa FIR2IR: select return target inside accessor properly 2021-02-08 14:28:24 +03:00
Ilya Goncharov
19bffc694b [JS IR] Add test with chain export--not-export--export
^KT-44616 fixed
2021-02-08 13:41:16 +03:00
Ilya Goncharov
76b124a9c0 [JS IR] Method of any is exported
^KT-44616 fixed
2021-02-08 13:40:39 +03:00
Ilya Goncharov
7b4624aac4 [JS IR] Add exported method into exportNestedClass.kt
^KT-44616 fixed
2021-02-08 13:38:47 +03:00
Ilya Goncharov
6c051b2be4 [JS IR] Override method are not exported
[JS IR] Add test with jsexport overrides not js export method with stable name

^KT-44616 fixed
2021-02-08 13:38:30 +03:00
Jinseong Jeon
a9322a01ce FIR checker: avoid redundant casting to resolved type ref 2021-02-08 13:01:12 +03:00
Jinseong Jeon
37a702b962 FIR: coerce to Unit when a lambda has early returns
^KT-39075 Fixed
2021-02-08 13:01:12 +03:00
Jinseong Jeon
83e3201677 FIR DFA: correct exit node retrieval when a safe call is the last expression
^KT-44699 Fixed
2021-02-08 13:01:11 +03:00
Jinseong Jeon
266432a482 FIR checker: fix condition for property type mismatch on override 2021-02-08 13:01:11 +03:00
Jinseong Jeon
065d0c66ab FIR checker: reproduce a false alarm on type mismatch of overridden property 2021-02-08 13:01:11 +03:00
pyos
64c5608f31 FIR: expect nullable type for elvis LHS 2021-02-08 13:00:22 +03:00
Margarita Bobova
0e8f4294f0 Add changelog for 1.4.30 2021-02-08 12:16:00 +03:00
Igor Yakovlev
04017b00a1 [FIR IDE] Fix TypeRef resolve to error type caused by invalid number of arguments 2021-02-08 11:57:39 +03:00
Victor Petukhov
f9e5584a3e Report error about uninferred type parameter for all CallForImplicitInvoke psi calls
^KT-44368 Fixed
2021-02-08 10:40:18 +03:00
Andrey Zinovyev
c75d2c05f0 [KAPT] Correct type for property with accessor
^KT-39060 Fixed
2021-02-08 10:11:50 +03:00
Dmitriy Novozhilov
dcb47d9934 Fix broken compilation after changing kotlin compiler configuration form
Problem was introduced at 391f5315
2021-02-06 13:40:40 +03:00
Vladimir Dolzhenko
391f53154a Fix NPE in Kotlin facets tab 2021-02-05 21:28:33 +01:00
Alexander Dudinsky
250040bab7 Common fix GradleQuickFixTest and GradleUpdateConfigurationQuickFixTest
Started as a result of postponed jdk dispose
71e7449

CodeInsightTestFixtureImpl assertPointersAreDisposed is invoked before
actually removing pointers.

com.intellij.openapi.util.TraceableDisposable$DisposalException: 1708093728
	at com.intellij.openapi.util.TraceableDisposable.getStackTrace(TraceableDisposable.java:121)
	at com.intellij.openapi.vfs.impl.VirtualFilePointerTracker.assertPointersAreDisposed(VirtualFilePointerTracker.java:86)
	at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$tearDown$38(CodeInsightTestFixtureImpl.java:1281)
	at com.intellij.testFramework.RunAll.collectExceptions(RunAll.java:57)
	at com.intellij.testFramework.RunAll.runAll(RunAll.java:35)
	at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.tearDown(CodeInsightTestFixtureImpl.java:1234)
	at org.jetbrains.kotlin.idea.codeInsight.gradle.GradleQuickFixTest.tearDownFixtures(GradleQuickFixTest.kt:41)
	at org.jetbrains.kotlin.idea.codeInsight.gradle.ExternalSystemTestCase.lambda$null$5(ExternalSystemTestCase.java:185)
2021-02-05 17:49:28 +03:00
Alexander Dudinsky
94e66acd54 Revert "Fix GradleQuickFixTest"
This reverts commit d5deccd2.
General solution was implemented
2021-02-05 17:45:47 +03:00
Pavel Kirpichenkov
9f7d7e55da Consider platform compatibility in library usage index
Logic of module dependencies is enhanced to filter out incompatible
common -> platform dependencies. However the reversed index for getting
all modules that use libraries doesn't take this filtering into
account and returns all modules based exclusively on order entries.
This leads to incorrect library dependency calculation.

^KT-44638 Verification pending
2021-02-05 16:36:59 +03:00
Dmitriy Dolovov
27dcd07a5e [Commonizer] Remove filter for simd_ functions (no more relevant) 2021-02-05 15:56:33 +03:00
Dmitriy Dolovov
4d5ec6e52a [Commonizer] Minor. Rename: builders.kt -> entityBuilders.kt 2021-02-05 15:56:28 +03:00
Dmitriy Dolovov
955f86ef9f [Commonizer] Minor. Rename: buildingVisitor.kt -> metadataBuilder.kt 2021-02-05 15:56:23 +03:00
Dmitriy Dolovov
33c1ca01f4 [Commonizer] Simplify creation of SerializedMetadataLibraryProvider 2021-02-05 15:56:17 +03:00
Dmitriy Dolovov
6c92ea518b [Commonizer] Add ModulesProvider.loadModuleMetadata() to load raw metadata 2021-02-05 15:56:12 +03:00
Dmitriy Dolovov
cb226e74a5 [Commonizer] Refactor ModulesProvider.loadModuleInfos() function
Change return type from Map<String, ModuleInfo> to Collection<ModuleInfo>
2021-02-05 15:56:06 +03:00
Andrey Zinovyev
08111031ec [KAPT] Keep annotations from kotlin.jvm. in stubs
^KT-35104 Fixed
2021-02-05 13:41:46 +03:00
Mikhail Glukhikh
a68837451a FirCatchParameterChecker: minor fix 2021-02-05 10:46:42 +03:00
Yan Zhulanow
0d1f493b6c Remove unneeded artifacts for Kotlin IDE plugin 2021-02-05 15:53:39 +09:00
Mikhail Glukhikh
f1ab5d1fbd FIR: introduce & use Throwable built-in type 2021-02-05 09:33:54 +03:00
Mikhail Glukhikh
bbd1da7b71 Use reportOn in FirThrowableSubclassChecker & FirCatchParameterChecker 2021-02-05 09:27:01 +03:00
eugenpolytechnic
a564f92eef FIR: introduce ThrowableSubclassChecker 2021-02-05 09:22:12 +03:00
Ilmir Usmanov
cd189c0812 JVM_IR. Do not unbox Result in inline lambda
Since JVM_IR generates inline lambdas differently from old backend,
in this case, it generates them as normal functions.
Thus, there is no need to unbox the lambda argument.
 #KT-44671 Fixed
2021-02-04 20:22:20 +01:00
Alexander Udalov
fb296b5b95 Do not create Array instance in kotlin-reflect where not necessary
Although the previous code of computing JVM internal name from a Class
instance was shorter, it led to unnecessary creation of array types,
which is less performant and makes configuration of kotlin-reflect for
GraalVM native-image more verbose.

Unfortunately I didn't succeed in writing a test for this, since
`Array.newInstance` calls a native method which doesn't record any trace
of it being called in the class loader: the resulting array type never
goes through findClass/loadClass, and is not visible via
findLoadedClass.

 #KT-44594 Fixed
2021-02-04 19:13:42 +01:00
Mikhael Bogdanov
35ec6b4f5c Run IR test on Test Codegen on different platforms 2021-02-04 18:53:06 +01:00
Nikolay Krasko
d5deccd2e9 Fix GradleQuickFixTest
Started as a result of postponed jdk dispose
71e74497b5

CodeInsightTestFixtureImpl assertPointersAreDisposed is invoked before
actually removing pointers.

com.intellij.openapi.util.TraceableDisposable$DisposalException: 1708093728
	at com.intellij.openapi.util.TraceableDisposable.getStackTrace(TraceableDisposable.java:121)
	at com.intellij.openapi.vfs.impl.VirtualFilePointerTracker.assertPointersAreDisposed(VirtualFilePointerTracker.java:86)
	at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$tearDown$38(CodeInsightTestFixtureImpl.java:1281)
	at com.intellij.testFramework.RunAll.collectExceptions(RunAll.java:57)
	at com.intellij.testFramework.RunAll.runAll(RunAll.java:35)
	at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.tearDown(CodeInsightTestFixtureImpl.java:1234)
	at org.jetbrains.kotlin.idea.codeInsight.gradle.GradleQuickFixTest.tearDownFixtures(GradleQuickFixTest.kt:41)
	at org.jetbrains.kotlin.idea.codeInsight.gradle.ExternalSystemTestCase.lambda$null$5(ExternalSystemTestCase.java:185)
2021-02-04 18:14:14 +03:00
Andrey Zinovyev
dacf012a78 [KAPT] Add newline after each java compiler log (#4087)
^KT-27123 Fixed
2021-02-04 17:29:13 +03:00
Svyatoslav Kuzmich
cdb488149f [JS IR] Namer improvements
- Compute and store local names locally when translating a body.
  It is a step towards separate JS generation and hopefully reduces memory usage.

- Use stable mangled names for member names. Needed for separate JS generation.

- Add `abstract class IrNamerBase` with just 3 abstract methods to simplify
  creating new IrNamer implementations.

- Fix O(N^2) of findFreshName when it is called wtih the same name suggestion a lot of times.

- Refactor NameTables initialisation: factor out some functions and use descriptive names.

- Use StringBuilder in sanitizeName
2021-02-04 16:17:01 +03:00
Svyatoslav Kuzmich
c9cb7bc0fd [JS IR] Update tests 2021-02-04 16:16:41 +03:00
Svyatoslav Kuzmich
ae738e9c59 [JS] Add basic optional logs to test runner 2021-02-04 16:16:21 +03:00
Svyatoslav Kuzmich
c6242ad167 [JS] String.isValidES5Identifier
- Check Latin letters and numbers first before doing more expensive Character.getType
2021-02-04 16:16:21 +03:00
Svyatoslav Kuzmich
8be7e6064e [JS IR] Optimize sanitization
- Use direct function call instead of lambda
- Don't do anything for already valid names
2021-02-04 16:16:00 +03:00
Svyatoslav Kuzmich
2a424ad2af [IR] Make isExternal mutable and accessible via common interface
JS IR: Mark all effectively external declarations as external to access it
directly instead of computing it every time
2021-02-04 16:15:33 +03:00
Svyatoslav Kuzmich
924a7b009b [JS IR] Fix object getInstance visibility 2021-02-04 15:41:22 +03:00
Svyatoslav Kuzmich
218c246111 [JS] Fix extra js function capturing 2021-02-04 15:41:21 +03:00
Andrey Zinovyev
95140f35f8 [parcelize] Fix codegen for generic classes
Replace type arguments with star projection in static methods
Fix IR function generation

^KT-42652  Fixed
2021-02-04 15:11:51 +03:00
Dmitriy Novozhilov
ca02573d1e [Test] Print bytecode if DxCheckerHandler had failed 2021-02-04 10:53:50 +03:00
Dmitriy Novozhilov
771b1acbc1 [Test] Ignore multimodule tests in AbstractLightAnalysisModeTest 2021-02-04 10:53:50 +03:00
Dmitriy Novozhilov
29b96aa15d [Test] Properly merge box against java testdata into codegen/box
Previous commit about it was 3199ce03 and it was completely wrong
2021-02-04 10:53:50 +03:00
Dmitriy Novozhilov
21c493a854 [Test] Support different backends enumeration in DONT_TARGET_EXACT_BACKEND directive 2021-02-04 10:53:49 +03:00
Alexander Udalov
acd8c4503b Do not generate $suspendImpl for JvmDefault functions in interfaces
#KT-44533 Fixed
2021-02-03 21:37:58 +01:00
Ilmir Usmanov
5f71cd5476 Minor. Mute test on FIR 2021-02-03 19:18:29 +01:00
Ilmir Usmanov
02f845636e JVM_IR: Box generic Result parameter in suspend lambda
#KT-44527 Fixed
2021-02-03 19:18:27 +01:00
Ilmir Usmanov
a30a961cf5 Minor. Throw exceptions in test coroutine builders 2021-02-03 19:18:24 +01:00
Dmitriy Dolovov
52e22796e1 [Commonizer] Prettier message about target with no libraries inside 2021-02-03 20:42:57 +03:00
Dmitriy Dolovov
73113c1041 [Commonizer] Dump every module to disk immediately when it's ready
No need to retain all metadata modules in memory -> lesser memory consumption.
2021-02-03 20:42:50 +03:00
Svyatoslav Kuzmich
53204661e3 [JS] Update stdlib API test data after dukat update 2021-02-03 20:36:24 +03:00
Svyatoslav Kuzmich
d3b4df7da8 [JS] Revert paramter names changed by dukat 2021-02-03 20:36:24 +03:00
Victor Turansky
f1682cba13 KT-40235 Dukat 0.5.8-rc.4 2021-02-03 20:36:24 +03:00
Victor Turansky
ba0d60853d KT-40235 null companion for stdlib external union types 2021-02-03 20:36:24 +03:00
Victor Turansky
7523a5e97f KT-40235 Fix external interface companion support 2021-02-03 20:36:24 +03:00
Ilya Gorbunov
cc55580300 Exclude kotlin-test root project during JPS sync 2021-02-03 19:28:42 +03:00
yaroslav.chernyshev
b32db1ac02 Refactoring: change assertion signature, proper source set copying way 2021-02-03 19:15:33 +03:00
yaroslav.chernyshev
b2017a9c9c Introduce importing checkers with implementation for orphan source sets
* Found diagnostics are attaching to the model
* Diagnostics are collecting into Module's DataNode on IDE side
* Some tests for diagnostics are added
2021-02-03 19:15:33 +03:00
Ilya Gorbunov
87e130e77a Remove obsolete diagnostics suppression
The diagnostic NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS is now
obsolete because internal constructors of inline classes became allowed.
2021-02-03 18:23:53 +03:00
Dmitriy Novozhilov
ebced14db2 [FIR] Implement suppressing diagnostics with @Suppress 2021-02-03 18:10:48 +03:00
Dmitriy Novozhilov
459a2886a0 [FIR] Add CheckerContext to DiagnosticReporter and refactor diagnostic reporting
Refactoring includes replacing `Diagnostic.report` extensions in
  checkers with `DiagnosticReporter.reportOn` extension declared
  in DiagnosticReporter.kt
2021-02-03 18:10:48 +03:00
Andrey Zinovyev
923a4427c5 [KAPT] Fix stub generation for anonymous delegates
Replace anonymous classes with superclass in delegate properties
#KT-34838 Fixed
2021-02-03 17:27:41 +03:00
Alexander Udalov
60a05dded0 Build: fix default value for kotlin.build.disable.werror 2021-02-03 15:06:20 +01:00
Denis.Zharkov
7942bd0b3b Minor. Regenerate tests 2021-02-03 16:38:13 +03:00
Dmitry Petrov
2535e5d5c9 Minor: LAMBDAS directive in old back-end tests 2021-02-03 15:11:04 +03:00
Alexander Udalov
bd45a6c11d Support -Xsuppress-version-warnings to suppress API/language version warnings
To be used in the project after bootstrap to get rid of warnings like
"Language version 1.3 is deprecated, ..." which prevent us from enabling
`-Werror` in `:compiler:cli` and other modules.
2021-02-03 13:07:04 +01:00
Denis.Zharkov
d901ceb734 FIR: Fix loading Java annotations with Class[]-typed methods 2021-02-03 15:05:22 +03:00
Denis.Zharkov
5a55d56320 IR: Fix offsets for value parameters for bridges
Previously, offsets from super class parameter have been used
and they might belong to a different file and those offsets are irrelevant
to the current file
2021-02-03 15:05:22 +03:00
Denis.Zharkov
8712772a5f FIR: Add test for type resolution when referenced nested class from supertypes 2021-02-03 15:05:22 +03:00
Denis.Zharkov
c51798d46f Fix warning at VMCounters.kt 2021-02-03 15:05:22 +03:00
Denis.Zharkov
e7669ef9d6 FIR: Fix builder inference case with independent calls inside lambda 2021-02-03 15:05:21 +03:00
Denis.Zharkov
29ac4cb9cc Minor. Simplify conditions in shouldRunCompletion 2021-02-03 15:05:21 +03:00
Denis.Zharkov
173a852273 FIR: Fix uninitialized lateinit FirSymbol::symbol for supertype of Java class
Earlier, isForSupertypes has been mapped to different boolean parameter
2021-02-03 15:05:21 +03:00
Alexander Udalov
8b2279072f Fix compilation in tests-compiler-utils 2021-02-03 13:04:21 +01:00
Alexander Udalov
e0b6d4d917 Add -Xsuppress-deprecated-jvm-target-warning to modules compiled with 1.6
Currently this leads to an unknown argument warning, but it'll be
removed automatically on the next bootstrap.
2021-02-03 12:51:39 +01:00
Alexander Udalov
99b5e5a373 Deprecate JVM target 1.6
#KT-44650 Fixed
2021-02-03 12:50:52 +01:00
Dmitry Petrov
ab20a8ffff JVM_IR indy-lambdas: minor updates and fixes
KT-44278 KT-26060 KT-42621
2021-02-03 14:16:25 +03:00
Dmitry Petrov
088448043a JVM_IR indy-lambdas: don't use indy for big arity lambdas
KT-44278 KT-26060 KT-42621
2021-02-03 14:16:24 +03:00
Dmitry Petrov
d94912ed62 JVM_IR indy-lambdas: initial implementation and tests
KT-44278 KT-26060 KT-42621
2021-02-03 14:16:22 +03:00
Igor Chevdar
0bc386cb08 [IR] Fixed bug with reflectionTarget evaluation 2021-02-03 15:26:40 +05:00
Igor Chevdar
bb8bf28b8b [PSI2IR] Set reflectionTarget for all adapted references 2021-02-03 15:26:40 +05:00
Andrei Klunnyi
690fb47cbb KT-44079 [Sealed Interfaces]: move refactoring update
The idea behind this commit is that Move Refactoring should warn
developers in case their intention potentially breaks sealed
hierarchies (members must share the same module and package).

Provided algorithm has two goals:
- prevent destruction of correct hierarchies
- help in fixing broken ones
2021-02-03 10:04:26 +00:00
Ilya Goncharov
de3678a805 [JS IR] Add test with fun interface call inside lambda
^KT-44433 fixed
2021-02-03 12:13:53 +03:00
Ilya Goncharov
d6e74b9620 [JS IR] Use local scope for SAM if there are scopes
[JS IR] Use private for top level sam wrappers and local otherwise

^KT-44433 fixed
2021-02-03 12:13:52 +03:00
Jinseong Jeon
ca314c5bb9 FIR checker: add diagnostic CANNOT_WEAKEN_ACCESS_PRIVILEGE 2021-02-03 12:07:36 +03:00
Jinseong Jeon
3a07ca4c64 FIR checker: add diagnostic VAR_OVERRIDDEN_BY_VAL 2021-02-03 12:07:36 +03:00
Jinseong Jeon
80d5a1a1db FIR checker: add diagnostic OVERRIDING_FINAL_MEMBER 2021-02-03 12:07:36 +03:00
Jinseong Jeon
4ef1e1119f FIR LT: introduce positioning strategies for specific modifiers 2021-02-03 12:07:35 +03:00
Jinseong Jeon
0dd5b94556 FIR checker: rename override checker
We can report more diagnostics than type mismatch, e.g.,
nothing to override, var overridden by val, final override, etc.
2021-02-03 12:07:35 +03:00
Jinseong Jeon
b48835f3ce FIR checker: fix positions of type mismatch on overrides
To handle implicit return types, those should be reported on
declarations with return type positioning strategy, instead of
return type itself.
2021-02-03 12:07:35 +03:00
Dmitriy Novozhilov
571c4ce398 [Test] Support new configuration directives in old codegen tests 2021-02-03 10:03:23 +03:00
pyos
8277c96933 FIR: copy nullability when mapping type alias arguments 2021-02-03 08:38:56 +03:00
scaventz
bd205317aa CLI: improve behavior of -include-runtime
1.fix KT-17344: Include kotlin-reflect to resulting jar if "-include-runtime" is specified, unless the -no-reflect option is specified.
2.fix KT-43220: -include-runtime should add .kotlin_builtins to the output
2021-02-02 12:49:23 -08:00
Alexander Udalov
496d857db1 Add kotlin.build.disable.werror to disable -Werror locally
This can be placed, for example, in `local.properties` to temporarily
disable `-Werror` in compiler/stdlib/plugin/test modules during
development.
2021-02-02 21:47:33 +01:00
Mads Ager
6a959fefd0 [JVM_IR] Fix accessibility bridges for static protected fields.
Super-qualifiers have to be taken into account. Otherwise, too
few accessibility bridges will be generated which can lead to
binary compatibility issues.
2021-02-02 12:46:08 -08:00
Dmitriy Dolovov
62897a194b [Commonizer] Force GC after each serialized target 2021-02-02 23:13:14 +03:00
Dmitriy Dolovov
ff45e58543 [Commonizer] Minor. Post-review changes, p.2 2021-02-02 23:13:06 +03:00
Dmitriy Dolovov
c8a938275c [Commonizer] Minor. Post-review changes 2021-02-02 23:13:00 +03:00
Dmitriy Dolovov
318dd22bd1 [Commonizer] Add tests for CommonizerTarget 2021-02-02 23:12:54 +03:00
Dmitriy Dolovov
6fe5f85da7 [Commonizer] Use kotlin/Any as the default supertype for commonized class 2021-02-02 23:12:49 +03:00
Dmitriy Dolovov
2438265ba8 [Commonizer] Dump every target to disk immediately when it's ready 2021-02-02 23:12:43 +03:00
Dmitriy Dolovov
9c4af5070b [Commonizer] Ignore acceptable (minor) metadata mismatches in tests 2021-02-02 23:12:37 +03:00
Dmitriy Dolovov
a4438ad64f [Commonizer] Fix calculation of type parameter IDs for nested classes and their members 2021-02-02 23:12:30 +03:00
Dmitriy Dolovov
55c37183d9 [Commonizer] Ignore constructors for enum entries 2021-02-02 23:12:23 +03:00
Dmitriy Dolovov
dfd1a53624 [Commonizer] Don't serialize kotlin/Any? as the single type parameter upper bound 2021-02-02 23:12:18 +03:00
Dmitriy Dolovov
1c8cd242bf [Commonizer] Don't write IS_EXPECT flag for synthesized expect functions 2021-02-02 23:12:12 +03:00
Dmitriy Dolovov
9d6c0e56ed [Commonizer] Fix HAS_ANNOTATIONS flag calculation for serialized classes 2021-02-02 23:12:07 +03:00
Dmitriy Dolovov
b39a205671 [Commonizer] Minor. Improved diagnostics message in tests 2021-02-02 23:12:01 +03:00
Dmitriy Dolovov
80b95a22a4 [Commonizer] Fix property backing/delegate field annotations serialization 2021-02-02 23:11:55 +03:00
Dmitriy Dolovov
3b91d1c5e5 [Commonizer] Don't commonize built-ins 2021-02-02 23:11:49 +03:00
Dmitriy Dolovov
585cd64b9a [Commonizer] Drop descriptors for commonized declarations 2021-02-02 23:11:44 +03:00
Dmitriy Dolovov
5ff6b5ef42 [Commonizer] Rework test infrastructure to compare metadata instead of descriptors 2021-02-02 23:11:38 +03:00
Dmitriy Dolovov
f67a9615b8 [Commonizer] Pretty target name output in console 2021-02-02 23:11:31 +03:00
Dmitriy Dolovov
e5aa772639 [Commonizer] Fix approximation for aliases types 2021-02-02 23:11:26 +03:00
Dmitriy Dolovov
4c640e3f81 [Commonizer] Log stats during building metadata 2021-02-02 23:11:19 +03:00
Dmitriy Dolovov
d610837caf [Commonizer] Integrate metadata builder with the commonizer environment 2021-02-02 23:11:13 +03:00
Dmitriy Dolovov
2bcaf1fa63 [Commonizer] Introduce metadata builder 2021-02-02 23:11:04 +03:00
Dmitriy Dolovov
e28c1fd310 Metadata: Chunked KlibModuleFragmentWriteStrategy implementation 2021-02-02 23:10:57 +03:00
Dmitriy Dolovov
9551e0fff2 [Commonizer] Introduce MetadataDeclarationsComparator for metadata-based comparison of KLIBs 2021-02-02 23:10:51 +03:00
Dmitriy Dolovov
701374a646 [Commonizer] Embed :kotlinx-metadata-klib into the commonizer Jar 2021-02-02 23:10:45 +03:00
Dmitriy Dolovov
08cc904a71 [Commonizer] Restore lost nullability for underlying types in TAs 2021-02-02 23:10:39 +03:00
Dmitriy Dolovov
85f79695b9 [Commonizer] Avoid leaking non-commonized underlying types in TAs 2021-02-02 23:10:32 +03:00
Dmitriy Novozhilov
4bf6e58f2b [TD] Fix directive order in codegen testdata 2021-02-02 20:37:47 +03:00
Zalim Bashorov
3f10914f05 [JS] Replace usages of FileUtil.loadTextAndClose with functions from stdlib to avoid crashes on files larger than 10MiB 2021-02-02 18:47:44 +03:00
Anton Bannykh
165533fdb7 JS DCE: use Multimaps to reduce Node fields RAM 2021-02-02 18:39:35 +03:00
Anton Bannykh
f42f2fa743 JS DCE: disable logging by default
Based on Vladislav Saifulin's PR #4031
2021-02-02 18:38:50 +03:00
Anton Bannykh
26ce6b5131 JS DCE: inline Qualifier class to reduce RAM usage 2021-02-02 18:38:49 +03:00
Anton Bannykh
bbc6d2b993 JS DCE: use less LinkedHashSets 2021-02-02 18:38:49 +03:00
Anton Bannykh
3c0b226344 JS DCE: create collections on demand
Based on Vladislav Saifulin's PR #4031
2021-02-02 18:38:49 +03:00
Dmitriy Novozhilov
0ebb39a26e [Test] Exclude multimodule tests from codegen tests on android 2021-02-02 17:54:59 +03:00
Dmitriy Novozhilov
17d59e0daa [Test] Support skip of android codegen tests with new ASSERTION_MODE directive 2021-02-02 17:54:59 +03:00
Dmitriy Novozhilov
81ba7aa833 [Test] Use javac for compilation test java files from runtime by default 2021-02-02 17:54:59 +03:00
Dmitriy Novozhilov
e9cb30b4f3 [Test] Add ability to use custom CompilerConfigurationProvider 2021-02-02 17:54:59 +03:00
Dmitriy Novozhilov
c432efc364 [Build] Extract configuration of JUnit5 dependencies to common helper in buildSrc 2021-02-02 17:54:59 +03:00
Dmitriy Novozhilov
dea3c954f1 [Test] Add ability to stop test pipeline if there was an exception in handler 2021-02-02 17:54:59 +03:00
Dmitriy Novozhilov
2ae35b0b08 [Test] Move fir backend tests back to :compiler:fir2ir module 2021-02-02 17:54:58 +03:00
Dmitriy Novozhilov
e79d02f482 [Test] Don't generate extends clause for nested classes in generated tests for JUnit5
This is fine since all nested classes in tests are inners by JUnit5
  specification, so they will see `runTest` method from outer root class
2021-02-02 17:54:58 +03:00
Dmitriy Novozhilov
a4e9ab90a0 [Test] Migrate :tests-different-jdk on runners which are using JUnit5 2021-02-02 17:54:51 +03:00
Dmitriy Novozhilov
c969a34644 [Test] Set static field with application to null after tests are completed 2021-02-02 17:54:51 +03:00
Dmitriy Novozhilov
53e5aa4364 [Test] Don't use PSI based class reading in codegen BB tests
#KT-34826 is rela ted
2021-02-02 17:54:51 +03:00
Dmitriy Novozhilov
09ec3f6eaf [Test] Support various jdk targets in test infrastructure 2021-02-02 17:54:51 +03:00
Dmitriy Novozhilov
93741ced5c [Test] Read default target version from sys property in new test infra 2021-02-02 17:54:50 +03:00
Dmitriy Novozhilov
a3ad626f99 [Test] Support invoking box method in BB tests in separate process 2021-02-02 17:54:50 +03:00
Dmitriy Novozhilov
b351ca6bd4 [Test] Regenerate spec tests 2021-02-02 17:54:50 +03:00
Dmitriy Novozhilov
3199ce03a6 [Test] Merge box against java testdata into codegen black box testsdata 2021-02-02 17:54:49 +03:00
Dmitriy Novozhilov
e62b118351 [TD] Ignore JS backends in boxAgainstJava tests 2021-02-02 17:54:49 +03:00
Dmitriy Novozhilov
99cb85ab00 [Test] Merge box against java tests into codegen black box tests 2021-02-02 17:54:47 +03:00
Dmitriy Novozhilov
6f3713af5f [Test] Migrate AbstractIrCompileKotlinAgainstKotlinTest to new infrastructure 2021-02-02 17:53:53 +03:00
Dmitriy Novozhilov
49c2bfe637 [Test] Enable SMAP dump handler in boxInline tests 2021-02-02 17:53:53 +03:00
Dmitriy Novozhilov
64a300bfcd [TD] Update testdata according to previous commit 2021-02-02 17:53:52 +03:00
Dmitriy Novozhilov
3a0eee64b8 [Test] Migrate all jvm tests runners for boxInline tests 2021-02-02 17:53:50 +03:00
Dmitriy Novozhilov
8973e3f362 [TD] Update fir directives in boxInline tests 2021-02-02 17:50:07 +03:00
Dmitriy Novozhilov
92e21e76ba [Test] Implement SMAP dump handler 2021-02-02 17:50:07 +03:00
Dmitriy Novozhilov
e3ab3d6be3 [Test] Align lines in TestFile with lines in real testdata file 2021-02-02 17:50:07 +03:00
Dmitriy Novozhilov
60e0831c11 [Test] Introduce two module structure transformers for codegen test 2021-02-02 17:50:07 +03:00
Dmitriy Novozhilov
13a778fd9c [Test] Add ability to freely transform module structure which was parsed from directive
Service ModuleStructureExtractor may break readabilty of test so it
  should be used very carefully

Originally it is created for box inline test where we have different
  runners on same testdata where one runner assumes that all files
  in test in same module and other that they in different ones
2021-02-02 17:50:06 +03:00
Dmitriy Novozhilov
fc83dc17fe [Test] Support USE_OLD_INLINE_CLASSES_MANGLING_SCHEME directive 2021-02-02 17:50:06 +03:00
Dmitriy Novozhilov
3f758a3fa2 [Test] Make BytecodeInliningHandler for new infrastructure 2021-02-02 17:50:06 +03:00
Dmitriy Novozhilov
0768a7089c [TD] Fix friend modules 2021-02-02 17:50:06 +03:00
Dmitriy Novozhilov
5075484c8e [TD] Update directives in kotlinAgainstKotlin testdata 2021-02-02 17:50:05 +03:00
Dmitriy Novozhilov
9ba41c5b88 [Test] Improve error reporting if there are too many values passed to directive 2021-02-02 17:50:05 +03:00
Dmitriy Novozhilov
5c8d555808 [Test] Move KotlinAgainstKotlin tests under BlackBoxCodegen tests 2021-02-02 17:50:05 +03:00
Mikhael Bogdanov
1ea4fa4464 Fix android test with type annotations. Remove obsolete JVM 8 flavors
Remove some new test cause their originals would be executed on JvmTarget6OnJvm8
2021-02-02 14:32:50 +01:00
Mikhael Bogdanov
c13f38f6df Support proper frame maps for enumValues 2021-02-02 14:32:50 +01:00
Mikhael Bogdanov
1a044e5af4 Support proper frame maps for enum valueOf 2021-02-02 14:32:50 +01:00
Mikhael Bogdanov
5b64ceceb3 JVM_IR. Generate additional checkcast for when/try epressions to avoid frame map problems on reification 2021-02-02 14:32:50 +01:00
Mikhael Bogdanov
16928d6e3f Don't remove checkcast for reified values
#KT-35511 Fixed
2021-02-02 14:32:50 +01:00
Mikhail Glukhikh
0b0ba7d987 Don't use warningsAsError in compiler modules if useFIR is ON 2021-02-02 16:29:27 +03:00
Marcin Aman
d953a03807 Specify type explicitly in KotlinCoreProjectEnvironment.createCoreFileManager to allow overriding this method with different implementation 2021-02-02 05:26:04 -08:00
Mikhail Glukhikh
21000f4174 [FIR] Support TypeVariableMarker.isReified 2021-02-02 16:25:08 +03:00
Mikhail Glukhikh
465261e611 FIR: don't create intersection override for duplicating symbols 2021-02-02 16:25:08 +03:00
Dmitry Gridin
b9c33a0c6e [i18n] copy-paste message from RefactoringBundle to fix missing resource in 202
^KT-44675 Fixed
2021-02-02 20:23:04 +07:00
Ivan Gavrilovic
2fce6a4af9 Locate build history when file is outside of root project dir
Support use-cases when the build dir is outside of root project dir.
Many projects set up output dir as <root_project>/../out/<project_name>/build
to be able to clean build dir more easily. This commit adds support
to build history file detection and it tries to find build history
files for artifacts that are:
- under root project dir (a default structure)
- under root project's build dir parent (to support typical custom setup)

Fixes https://youtrack.jetbrains.com/issue/KT-40875

Test: BaseIncrementalCompilationMultiProjectIT
2021-02-02 12:47:07 +03:00
Nicola Corti
5de34b052f Remove unsupported '!' from DIAGNOSTICS directive 2021-02-02 01:30:33 -08:00
Nicola Corti
e2b7aba086 Do not report UNNECESSARY_SAFE_CALL on ErrorType 2021-02-02 12:10:56 +03:00
Roman Artemev
59551eb037 [Plugin API] Provide diagnostic API for IR plugins 2021-02-02 12:05:35 +03:00
Roman Artemev
9fa5feeeea [CLI] Provide MessageCollector based logger for IR from CLI 2021-02-02 12:05:35 +03:00
Roman Artemev
daa65a2fff [KLIB] Handle linkage error
Do not crash compiler with ugly stacktrace in case of misconfiguration.
Report relatively friendly diagnostic message instead
2021-02-02 12:05:35 +03:00
Roman Artemev
bf67308cc2 [KLIB] Use IrMessageLogger in klib linker to report errors 2021-02-02 12:05:35 +03:00
Roman Artemev
6891ad0dfc [IR] Add IrMessageLogger interface for diagnostic reporting from IR 2021-02-02 12:05:35 +03:00
Roman Artemev
bb66b2fd04 Drop redundant compile dependency 2021-02-02 12:05:35 +03:00
Roman Artemev
c5068b7d45 [KLIB] Drop unused logger 2021-02-02 12:05:34 +03:00
Roman Artemev
484b884d04 [KLIB] Make IrModuleDeserializer's printable 2021-02-02 12:05:34 +03:00
Roman Artemev
d6bb1f2d4e [KLIB] Make KotlinLibraryImpl printable 2021-02-02 12:05:34 +03:00
Roman Artemev
24d82c63e0 [JS IR] Commonize CLI error reporting
Use general `AnalysisResult.CompilationErrorException` instead of
custom JsIrCompilationError to indicate about unsuccessful compilation

- Drop JsIrCompilationError
2021-02-02 12:05:34 +03:00
Roman Artemev
ba5193870e [IR] Drop unused language version settings parameters from DependenciesGenerator 2021-02-02 12:05:34 +03:00
Sergey Bogolepov
06498c0efd Support for macos_arm64 target in backend 2021-02-02 15:30:03 +07:00
Dmitriy Novozhilov
f255f93ad9 [Test] Support skip of android codegen tests with new ASSERTION_MODE directive 2021-02-02 07:08:13 +01:00
Alexander Udalov
eff13d24dc Remove unneeded language feature configuration from fir:tree
It causes a verbose warning to be displayed on each build. Inline
classes are enabled by default since Kotlin 1.5, so this configuration
is no longer needed.
2021-02-01 20:25:06 +01:00
Nwokocha wisdom maduabuchi
e47dfcbe64 Update ReadMe.md (#3877) 2021-02-01 21:27:02 +03:00
Igor Yakovlev
18cebe5131 [FIR IDE] Codereview minor refactoring
https://jetbrains.team/p/kt/review/2069/
https://jetbrains.team/p/kt/review/2070/
2021-02-01 21:21:03 +03:00
Igor Yakovlev
e529a7bf9b [FIR IDE] Implement isInheritor for FirLightClassForClassOrObjectSymbol 2021-02-01 21:21:03 +03:00
Igor Yakovlev
56db4bd1ac [FIR IDE] Implement isInheritor for KtFirBasedFakeLightClass 2021-02-01 21:21:02 +03:00
Igor Yakovlev
5d4606daaa [FIR IDE] Remove LightClassProvider 2021-02-01 21:21:02 +03:00
Igor Yakovlev
2812034896 [FIR IDE] Make KtFakeLightClass independent 2021-02-01 21:21:02 +03:00
Igor Yakovlev
c1cdf273a6 [FIR IDE] Fix test data fir parameters highlighting test 2021-02-01 21:21:02 +03:00
Igor Yakovlev
9f282e0ddc [FIR] Do not erase type arguments for unresolved method calls 2021-02-01 21:21:02 +03:00
Igor Yakovlev
659d2c13b4 [FIR IDE] Fix annotation value parameter and ctor resolve 2021-02-01 21:21:01 +03:00
Igor Yakovlev
019635189a [FIR IDE] Fix annotation call reference resolve to ctor 2021-02-01 21:21:01 +03:00
Igor Yakovlev
65b6a95f64 [FIR IDE] Fix structure element non analyzable elements recording for analyzable properties 2021-02-01 21:21:01 +03:00
Alexander Udalov
5480faf5c5 Add tests for issues fixed in JVM IR and other obsolete issues
#KT-6007
 #KT-16445
 #KT-17753
 #KT-22488
 #KT-23881
 #KT-24135
 #KT-26360
 #KT-27427
 #KT-27449
 #KT-27830
 #KT-28042
 #KT-29595
 #KT-30708
 #KT-32793
2021-02-01 18:29:59 +01:00
Anton Yalyshev
3e59adc7f3 Add change-notes for 1.4.30 release 2021-02-01 19:03:47 +03:00
Anton Yalyshev
90f9dd5b33 Revert change-notes for 1.4.30 2021-02-01 18:57:05 +03:00
Mikhael Bogdanov
206b38f0ab Fix compilation against asm 7.0 2021-02-01 16:52:46 +01:00
Anton Yalyshev
78c6e0733c Add change-notes for 1.4.30 2021-02-01 18:51:38 +03:00
Mikhail Glukhikh
1f62fee4f9 Fix typo 2021-02-01 18:33:05 +03:00
Mads Ager
593fb8770b [FIR] Fix lookup order for statics in super chains
The order was reversed and the static in the top-most class
in the inheritance hierarchy would be found instead of the
lowest one.
2021-02-01 18:32:55 +03:00
Dmitry Petrov
4ec369ac5b JVM_IR fix special bridge generation for inline classes 2021-02-01 17:57:58 +03:00
Alexander Udalov
8172ae5d89 Fix codegen test classLiteralWithExpectedType.kt on Android
Similar to changes in d022bb0248, this test started to fail because
`AnnotationTarget.TYPE` is mapped to `ElementType.TYPE_USE` if JVM
target is >= 1.8. In codegen tests on Android, we're running the
emulator of version 19 which is less than 26, where `TYPE_USE` has first
appeared.
2021-02-01 15:54:01 +01:00
pyos
bd3bc13e75 JVM_IR: give loops somewhat more debuggable labels 2021-02-01 15:51:31 +01:00
pyos
ad53fc931e JVM: optimize temporary kotlin.jvm.internal.Refs as well
i.e. remove the condition that there must be an LVT entry. Such
temporary `Ref`s can be created, for example, by the JVM_IR backend
if a lambda inlined at an IR level (e.g. argument to `assert`/`Array`)
is the target of a non-local return from a function inlined at bytecode
level (e.g. `run`):

    IntArray(n) { i ->
        intOrNull?.let { return@IntArray it }
        someInt
    }

->

    val `tmp$0` = IntArray(n)
    for (i in 0 until `tmp$0`.size) {
        var `tmp$1`: Int
        do {
            intOrNull?.let {
                `tmp$1` = it // causes `tmp$1` to become an IntRef
                break
            }
            `tmp$1` = someInt
        } while (false)
        `tmp$0`[i] = `tmp$1`
    }
2021-02-01 15:51:31 +01:00
pyos
0f2ca5d84c JVM_IR: support non-local break/continue in the inliner
Not in the frontend or psi2ir, though, so this not a complete
implementation of KT-1436, but rather a part of it that is currently
useful to make other code compile. In particular, lambdas passed to
array constructors and JVM-style `assert` are inlined as IR returnable
blocks, which are then converted into `do { ... } while (false)` loops,
so non-local returns from them become non-local `break`s.
2021-02-01 15:51:31 +01:00
Ilya Gorbunov
4a17228621 Infer required kotlin-test jvm capability based on used test framework
Except when:
- the Gradle version is less than 6.0, it doesn't read the metadata
published by a newer Gradle by default.
- the requested dependency version is less than 1.5, because it doesn't
have metadata published.

Update integration tests to use kotlin-test common dependency.

KT-40225
2021-02-01 16:50:05 +03:00
Ilya Gorbunov
cbeadba15d Disable metadata publishing for legacy common artifacts
When they are used explicitly in common source sets, they cannot be
resolved in platform ones after that since they only have
common kotlin-api variants in their metadata.

KT-40225
2021-02-01 16:50:05 +03:00
Ilya Gorbunov
573aac7252 Apply common configuration to custom publications in kotlin-test
To do that, extract parts of publishing setup into reusable functions.
This change makes signing and repository configuration applied to all
project publications, not just to the Main one.

Also:
- Get rid of dependencies from non-default variants in the root pom
- Add an empty javadoc jar

KT-40225
2021-02-01 16:50:05 +03:00
Ilya Gorbunov
a16aaa3824 Setup publications with MPP Gradle metadata for kotlin-test library
Move publication configuration from individual platform specific
kotlin-test- modules to the root module.

KT-40225
2021-02-01 16:50:05 +03:00
Vladimir Dolzhenko
913c298be8 Kotlin highlight passes are reworked
#KT-37702 Fixed
2021-02-01 13:18:38 +00:00
Vladimir Dolzhenko
558338f997 Lazy diagnostics API in frontend
Relates to #KT-37702
2021-02-01 13:18:37 +00:00
Pavel Kirpichenkov
8f675fe757 Split combined test into two to avoid flaky behaviour
Prevent simultaneous access to the library directory
2021-02-01 15:09:13 +03:00
eugenpolytechnic
9ad88a5a0d FIR: introduce parameter type is Throwable check 2021-02-01 15:07:21 +03:00
eugenpolytechnic
5c0231b727 FIR: introduce CatchParameterChecker 2021-02-01 15:07:13 +03:00
Alexander Udalov
d8549d6292 Build: fix inaccurate change to the logic of useIRForLibraries 2021-02-01 11:54:36 +01:00
Alexander Udalov
e9436da858 Change logic of applying JVM target from AGP options
Now that the default JVM target is 1.8, we have to add the JVM target
1.6 explicitly if the Android project is configured with source/target
1.6, and not do anything if it's configured with 1.8.

 #KT-31027
2021-02-01 11:54:05 +01:00
Alexander Udalov
adfa8c788c Light classes: use JVM target from the module
Using "JVM_1_8" always resulted in incorrect mapping of Kotlin
annotation targets to Java element types.

The change in AbstractKotlinRenderLogTest is needed because while
CliTraceHolder.module is technically a descriptor leak, it was never
detected by this test accidentally, because of the depth cutoff equal to
10, which started to not be enough after the minor refactoring of
replacing `Delegates.notNull` with `lateinit`.
2021-02-01 11:54:05 +01:00
Alexander Udalov
64e97225b8 Light classes: map annotation targets depending on JVM target
Since the default JVM target (`JvmTarget.DEFAULT`) is now 1.8, the
changed test started to fail. This change fixes it.
2021-02-01 11:54:04 +01:00
Alexander Udalov
d022bb0248 Switch default JVM target to 1.8
#KT-29405 Fixed
2021-02-01 11:54:04 +01:00
Ivan Gavrilovic
509ed64917 KT-43686: Make kapt Gradle task cacheable across machines
Use `@Classpath` for kotlin stdlib input property. This is to
allow cache hits when builds are running on different machines
and path to kotlin stdlib differs.

Test: BuildCacheRelocationIT
2021-02-01 13:28:20 +03:00
Dmitriy Novozhilov
771600077c [Test] Fail if there are changes in generated fir tree files in teamcity build 2021-02-01 10:18:37 +03:00
Dmitriy Novozhilov
297288e984 [Test] Don't generate new files in GeneratorsFileUtil in teamcity mode 2021-02-01 10:18:37 +03:00
Dmitriy Novozhilov
772ca2715c [Test] Don't change testdata in FirIdenticalChecker in teamcity mode 2021-02-01 10:18:37 +03:00
Alexander Gorshenev
6265ac8c19 Re-enabled disabled test 2021-01-30 17:41:54 +03:00
Alexander Gorshenev
16b3fedcd4 Created AbstractKlibBinaryCompatibilityTest and AbstractJsKlibBinaryCompatibilityTest
A common test runner for klib binary compatibility tests
and its js counterpart
2021-01-30 17:41:54 +03:00
Alexander Udalov
e7cf34a2a9 Workaround illegal access problem in daemon for JDK 17-ea
Otherwise Kotlin cannot be used in Gradle since
https://github.com/openjdk/jdk/commit/ed4c4ee7 where JDK internals
started to be encapsulated by default.

For some reason, using

    listOf("--add-opens", "java.base/java.util=ALL-UNNAMED")

doesn't help, so use the more general `--illegal-access=permit`.

 #KT-43704
2021-01-29 21:29:08 +01:00
Alexander Udalov
f08733eb75 CLI: suppress warning on JDK 9+ with illegal access to ResourceBundle
The underlying issue is tracked in IDEA-248785.

 #KT-43704 Fixed
2021-01-29 21:29:08 +01:00
Alexander Udalov
2ef4ca4e6e CLI: do not pass -noverify to java process starting from JDK 13
#KT-44232 Fixed
2021-01-29 21:28:25 +01:00
Alexander Udalov
2bbe3db041 Update copyrights in CLI scripts 2021-01-29 21:27:28 +01:00
Mikhael Bogdanov
9f9c8e3d77 Mute stream api test on Android 2021-01-29 18:22:16 +01:00
Dmitriy Novozhilov
21f022dec2 Add :kotlin-scripting-compiler.test to modules with disabled -Werror flag 2021-01-29 20:01:01 +03:00
Sergey Igushkin
021a63827d Add API version 1.5 to accepted values in MPP language settings 2021-01-29 19:49:45 +03:00
Mikhael Bogdanov
6a29097a8c Remove obsolete dependency for dx 2021-01-29 17:47:37 +01:00
Mikhael Bogdanov
be9ef8f3c8 Remove obsolete DxChecker 2021-01-29 17:47:37 +01:00
Steven Schäfer
482e217b5e JVM IR: Fix inline class mangling for calls to internal functions
...in a different module, e.g., using -Xfriend-paths.
2021-01-29 16:23:15 +01:00
Mikhail Glukhikh
6747084fe2 FIR TEST: perform more accurate check on file identity 2021-01-29 16:57:14 +03:00
Mikhail Glukhikh
338aad98eb FIR: run diagnostic "with stdlib" tests also in light tree mode 2021-01-29 16:55:34 +03:00
Mikhail Glukhikh
7d4eaefd36 FIR: report UNSAFE_CALL on dot when possible 2021-01-29 16:55:26 +03:00
Mikhail Glukhikh
0ee4f1f393 FIR: more exact nullability determination in potential UNSAFE_CALL check 2021-01-29 16:55:09 +03:00
Jinseong Jeon
e72ddbcbfe FIR checker: differentiate UNSAFE_CALL from INAPPLICABLE_CANDIDATE
To do so, inside the root cause of inapplicable candidate errors,
we will record expected/actual type of receiver, if any.
That will help identifying inapplicable calls on nullable receiver.
2021-01-29 16:54:23 +03:00
Mikhail Glukhikh
4b823eca21 Fix test data (FIR_IDENTICAL) 2021-01-29 16:54:17 +03:00
Mikhael Bogdanov
3e1fabd46c Set ANDROID_SDK_ROOT for android box tests 2021-01-29 14:30:24 +01:00
Dmitriy Novozhilov
4a50dc9074 Add workaround for problem with initialization of :tools:kotlinp 2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
e8068b5576 Update testdata of maven plugin tests 2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
0a47b1c32b Remove incorrectly added dependency on experimental coroutines 2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
0769157a16 Revert "Revert "Build: enable -Werror in stdlib/core/compiler/plugins modules""
This reverts commit 1300ec3e
2021-01-29 14:57:08 +03:00
Dmitriy Novozhilov
7e3802bde3 Advance bootstrap to 1.5.0-dev-2205 2021-01-29 14:57:07 +03:00
Mikhael Bogdanov
c5baf3fdd2 Upgrade gradle plugin to 4.1. and build tools to 29.0.3 for android box tests 2021-01-29 11:57:51 +01:00
Mikhael Bogdanov
9459f8113f Set ANDROID_HOME/ANDROID_SDK_ROOT for android box tests
In some cases emulator execution on TC fails cause of problem with pathes
2021-01-29 11:57:51 +01:00
Ilya Goncharov
fd29fab971 [Gradle, JS] Update tool versions
- Node.js - 14.15.4
- Yarn - 1.22.10

^KT-44614 fixed
2021-01-29 13:57:17 +03:00
Victor Petukhov
9efac8f68b Propagate all annotations during creating simple functional types
^KT-44563 Fixed
2021-01-29 13:50:46 +03:00
Dmitry Petrov
5d7dc5fa39 JVM_IR indy-SAM conversions: minor updates
See: KT-44575 KT-44577

KT-44278 KT-26060 KT-42621
2021-01-29 12:59:48 +03:00
Dmitry Petrov
f34224ecee JVM_IR indy-SAM conversions: tests for function references equality
(SAM conversion using LambdaMetafactory is not used for function refs).

KT-44278 KT-26060 KT-42621
2021-01-29 12:59:48 +03:00
Dmitry Petrov
f0abd8bc68 JVM_IR indy-SAM conversions: prohibit in crossinline lambdas
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:47 +03:00
Dmitry Petrov
ad1d80d700 JVM_IR indy-SAM conversions: add more tests
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:47 +03:00
Dmitry Petrov
98b0c07b18 JVM_IR indy-SAM conversions: inline funs and lambdas
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:47 +03:00
Dmitry Petrov
4da2f3d9d4 JVM_IR indy-SAM conversions: use old scheme for suspend funs
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:46 +03:00
Dmitry Petrov
1f16b96796 JVM_IR indy-SAM conversions: inline classes
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:46 +03:00
Dmitry Petrov
f30e25aa52 JVM_IR indy-SAM conversions: more cases
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:45 +03:00
Dmitry Petrov
3140cca050 JVM_IR indy-SAM conversions, 1st passing tests
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:45 +03:00
Ilya Goncharov
c13949d322 [Gradle, JS] Move incremental test into non-ir js tests and add module name into 2js plugin
[Gradle, JS] Fix tests for incremental compilation of IR klib dir

[Gradle, JS] Add hack of outputFile into kotlin2js plugin

[Gradle, JS] Remove producing klib-dir

[Gradle, JS] Try to fix outputFileOrNull in JS compile

Because on clean run, file is not yet created, isFile check is incorrect
2021-01-29 12:22:54 +03:00
Denis.Zharkov
7e6abffb62 FIR: Fix incorrectly serialized type
See the test added: there's a non-denotable T!! type inside flexible type
that wasn't handled before.

ConeKotlinType::contains handles flexible types content and some other cases
Also, it has better asymptotics
2021-01-29 10:50:23 +03:00
Denis.Zharkov
1e0d9f4075 FIR2IR: Do not add implicit casts for types with different nullability
For smart casts, elvises, etc., there are no implicit casts in psi2fir
in changed test data
2021-01-29 10:50:22 +03:00
Denis.Zharkov
5c62ee4ba8 FIR2IR: Fix complex cases of smart cast expressions used as dispatch receiver
It might be not only <ExpressionWithSmartCast>(a).foo(), but also
id(<ExpressionWithSmartCast>(a)).foo() and many other cases
2021-01-29 10:50:22 +03:00
Denis.Zharkov
b3b1eb57ae FIR2IR: Simplify Fir2IrImplicitCastInserter::convertToImplicitCastExpression
Use dispatchReceiverType instead of looking into scopes
2021-01-29 10:50:22 +03:00
Denis.Zharkov
71596a08b3 FIR2IR: Simplify Fir2IrImplicitCastInserter 2021-01-29 10:50:22 +03:00
Denis.Zharkov
aab85121e2 Minor. Add clarification comment to MainFunctionDetector 2021-01-29 10:50:22 +03:00
Denis.Zharkov
b1b89e6f5f FIR2IR: Fix smart-cast approximation implicit receiver
Previously, it was always cast to the first type of smart cast variants list
independently of callee symbol that might be present in the member scope
of a different type
2021-01-29 10:50:22 +03:00
Denis.Zharkov
d9f45fdf9e FIR2IR: Fix incorrect fake override structure for delegated member in supertype
In C, fake override for `name` should have B::name as base symbol, not Named::name
2021-01-29 10:50:21 +03:00
Mikhael Bogdanov
844d2572e5 Don't run dx test in emulator 2021-01-29 08:48:30 +01:00
Mikhael Bogdanov
1c612376dd Disable some android box test 2021-01-28 18:30:48 +01:00
Mikhael Bogdanov
0ad24f5346 Enable Android box test 2021-01-28 18:01:21 +01:00
Mikhael Bogdanov
b16b1b3b78 Test for obsolete KT-26360
#KT-26360
2021-01-28 18:01:21 +01:00
Mikhael Bogdanov
bea29d0de5 Add test for KT-44074
#KT-44074
2021-01-28 18:01:21 +01:00
Ilya Goncharov
5fa9acc17a [JS IR] Add additional exported declarations inside dce loop
[JS IR] Remove useless filter in dce for more log information

^KT-44469 fixed
2021-01-28 18:56:34 +03:00
Ilya Goncharov
d88d1d048e [JS IR] Context to NameTables for stable names in additional exported declarations
[JS IR] BridgesConstruction with generic without cast

^KT-44469 fixed
2021-01-28 18:56:21 +03:00
Ilya Goncharov
f186047101 [JS IR] Add additional exported declarations with exported stub to dce
^KT-44469 fixed
2021-01-28 18:56:01 +03:00
Ilya Goncharov
6e98b81f3a [JS IR] Use recursive isExported for stable name detection
^KT-44469 fixed
2021-01-28 18:55:48 +03:00
Ilya Goncharov
977781fa49 [JS IR] Add tests with export all file and export nested class
[JS IR] Skip dce driven for nested classes export

^KT-44469 fixed
2021-01-28 18:55:33 +03:00
Ilya Kirillov
1b68f35f7c FIR: create new ConeTypeCheckerContext on every supertypes calculation
It can be recursively used while calculating supertypes via IDE lazy resolve,
which is forbidden
2021-01-28 13:52:04 +01:00
Mikhail Glukhikh
1c80c5610d FIR: fix serialization of accessor with source-level annotations 2021-01-28 13:21:16 +03:00
Dmitriy Novozhilov
72b07c727b fixup! Add runtime dependency on experimental coroutines to :kotlin-scripting-compiler-impl 2021-01-28 13:19:35 +03:00
Dmitriy Novozhilov
4389cc7787 Update testdata of maven plugin tests 2021-01-28 13:19:35 +03:00
Dmitriy Novozhilov
8b892a46c9 Update testdata of maven plugin test 2021-01-28 13:19:35 +03:00
Dmitriy Novozhilov
f740e4141c Temporary force building all libraries with old backend 2021-01-28 13:19:35 +03:00
Dmitriy Novozhilov
71d8b842fd Add runtime dependency on experimental coroutines to :kotlin-scripting-compiler-impl
This is needed to keep compatibility with old gradle versions which
  are steel using kotlin 1.2 with experimental coroutines
2021-01-28 13:19:34 +03:00
Dmitriy Novozhilov
17230397e6 [Test] Update or drop some IDE tests about experimental coroutines 2021-01-28 13:19:34 +03:00
Dmitriy Novozhilov
bc3b791cd8 [TMP] Remove :kotlin-coroutines-experimental-compat module 2021-01-28 13:19:34 +03:00
Dmitriy Novozhilov
1300ec3e45 Revert "Build: enable -Werror in stdlib/core/compiler/plugins modules"
This reverts commit 3be62dfc
2021-01-28 13:19:34 +03:00
Dmitriy Novozhilov
f3364ec602 [TD] Update testdata according to KT-44546 2021-01-28 13:19:33 +03:00
Dmitriy Novozhilov
299272fa6d [Test] Update diagnostics testdata according to allowed suspend fun interfaces 2021-01-28 13:19:33 +03:00
Dmitriy Novozhilov
a253b9508e Mute some ultra light classes tests according to KT-44472 2021-01-28 13:19:33 +03:00
Dmitriy Novozhilov
c0bc492029 Mute some script tests according to KT-44471 2021-01-28 13:19:33 +03:00
Dmitriy Novozhilov
95aa8dc85a Fix detecting of non-physical files in ClassFileFactory 2021-01-28 13:19:32 +03:00
Dmitriy Novozhilov
3b97835b74 Disable -Werror for :compiler:cli module
This is needed because we should compile cli with target version
  (which is deprecated now) for compatibility with gradle
2021-01-28 13:19:32 +03:00
Dmitriy Novozhilov
2c3031f981 [Test] Mute IC with circular dependencies with JVM IR backend 2021-01-28 13:19:32 +03:00
Victor Petukhov
ba44ad1aa3 Approximate anonymous return types for private inline functions to explicit supertype or Any (KT-33917) 2021-01-28 13:19:32 +03:00
Victor Petukhov
670f029bdf Allow passing non-spread arrays into a vararg parameter after sam properly, through propagating vararg element type to a sam adapter from the original parameter descriptor 2021-01-28 13:19:31 +03:00
Victor Petukhov
af3eaf5d71 Add explicit disabling ProhibitVarargAsArrayAfterSamArgument feature in tests as it's enabled by default in 1.5 2021-01-28 13:19:31 +03:00
Victor Petukhov
e39bbcd937 Unmute test which checks the evaluation order of value arguments with varargs.
The corresponding feature (UseCorrectExecutionOrderForVarargArguments) is enabled by default in 1.5.
2021-01-28 13:19:31 +03:00
Dmitriy Novozhilov
4f8b12c96f [Test] Fix various tests according to switching to kotlin 1.5 2021-01-28 13:19:30 +03:00
Dmitriy Novozhilov
64100eec07 [Test] Add workaround for KT-44359 2021-01-28 13:19:30 +03:00
Dmitriy Novozhilov
ffc585ad5c [Debugger] Fix compiler option for disabling IR backend in tests 2021-01-28 13:19:30 +03:00
Dmitriy Novozhilov
cd93b2f39b Use old backend in script compilation context 2021-01-28 13:19:30 +03:00
Dmitriy Novozhilov
ee1aff1012 [Test] Update different testdata according to changes in sealed classes 2021-01-28 13:19:29 +03:00
Dmitriy Novozhilov
81fd8b5940 [IR] Fix undeterministic order in signature clash reporting 2021-01-28 13:19:29 +03:00
Dmitriy Novozhilov
6a2796b067 [Test] Fix source maps in testdata according to KT-37704 2021-01-28 13:19:29 +03:00
Dmitriy Novozhilov
a6600cef47 [Test] Remove some outdated tests from LocalInspectionTestGenerated
Those tests are referring to outdated language features which are
  meaningless for language version 1.5
2021-01-28 13:19:29 +03:00
Dmitriy Novozhilov
a9ef8bb32f [IDE] Update SuperClassNotInitialized to relaxed restrictions on sealed classes 2021-01-28 13:19:28 +03:00
Dmitriy Novozhilov
16e0c0b820 [Test] Update testdata of quickfix tests related to sealed classes 2021-01-28 13:19:28 +03:00
Dmitriy Novozhilov
7632c11745 Enforce using old backend in JvmCliReplShellExtension 2021-01-28 13:19:28 +03:00
Dmitriy Novozhilov
c6039d76d3 Enforce using old backend in JvmAbiAnalysisHandlerExtension 2021-01-28 13:19:27 +03:00
Alexander Udalov
f350e9dacb Fix rendering of metadata of multifile facades in classFilesComparison.kt
Multifile facades (class files with header kind MULTIFILE_CLASS) have
the list of their parts in the d1 field (KotlinClassHeader.data), not
some byte-encoded protobuf message which this code was trying to
deserialize previously.
2021-01-28 13:19:27 +03:00
Alexander Udalov
1deb317e0d Update and regenerate incremental compilation tests for 1.5
Set TargetBackend.JVM_IR for these tests by default; remove the
generated IR-based test and add a new old-backend-based test. This fixes
the issue where some (3) of these tests were not properly ignored
because of incorrect target backend used in the test generator.

Also update test data for some tests which use local functions, which
are not generated to separate anonymous classes in JVM IR.
2021-01-28 13:19:27 +03:00
Alexander Udalov
4dff7e648f Minor, restore abiStabilityUnstableWithOldBackend CLI test
Add -Xuse-old-backend to make it pass with LV=1.5 where JVM IR is
enabled by default.
2021-01-28 13:19:26 +03:00
Alexander Udalov
d87d0cceae JVM IR: report all sources as outputs for .kotlin_module file
This fixes some tests for LV=1.5 in KotlinJpsBuildTest,
KotlinJpsBuildTestIncremental, IncrementalJvmJpsTestGenerated,
IncrementalCacheVersionChangedTestGenerated.

 #KT-42069 Fixed
2021-01-28 13:19:26 +03:00
Dmitriy Novozhilov
f3393eae1b [Test] Update testdata of CompileKotlinAgainstCustomBinariesTest 2021-01-28 13:19:26 +03:00
Dmitriy Novozhilov
9b80a552e9 [Test] Update testdata of spec tests 2021-01-28 13:19:25 +03:00
Dmitriy Novozhilov
73e6d42224 [Test] Update CLI tests according to new default language version 2021-01-28 13:19:25 +03:00
Dmitriy Novozhilov
5122e748c1 Add workaround for KT-44316 2021-01-28 13:19:25 +03:00
Dmitriy Novozhilov
facc52fe49 Introduce ApiVersion.KOTLIN_1_5 2021-01-28 13:19:25 +03:00
Dmitriy Novozhilov
f14bd87ecc [Test] Update testdata of diagnostic tests during to change language to 1.5
Mostly this commit contains changes of descriptor dump of sealed classes
  tests according to changed visibility of sealed class constructor
2021-01-28 13:19:24 +03:00
Dmitriy Novozhilov
d7cfd9c188 Switch latest stable version to 1.5 2021-01-28 13:19:24 +03:00
Dmitriy Novozhilov
5098eb84af Switch IS_PRE_RELEASE flag to true
#KT-44284 Fixed
2021-01-28 13:19:24 +03:00
Kristoffer Andersen
836261ba6e [Test] Ignore test infrastucture sources in debugging tests
This solves no immediate deficiency, but is a to-do that arose as part
of an ongoing effort to port the old, slightly too restrictive
checkLocalVariableTable tests to the more "functional" debugger
infrastructure.

This just shaves a little bit of overhead off the test expectations
and couples them less tightly to the specifics of the test
infrastructure.
2021-01-28 08:09:42 +01:00
Abduqodiri Qurbonzoda
46b7a774b5 Commonize CharCategory and related functions #KT-39177 #KT-43216 #KT-39906 #KT-30652 2021-01-28 01:41:24 +03:00
Ilya Kirillov
9b429fb535 FIR IDE: update testdata 2021-01-27 21:27:00 +01:00
Ilya Kirillov
1d167e4bc5 FIR: enable inline classes support in kotlin.compiler.fir.tree module 2021-01-27 21:26:59 +01:00
Ilya Kirillov
c53d6ed5d2 FIR: remove SymbolProviderCache as it is unused now 2021-01-27 21:26:59 +01:00
Ilya Kirillov
9f5b46cc76 FIR: use MutableMap in JavaSymbolProvider.parentClassTypeParameterStackCache as temp solution
parentClassTypeParameterStackCache will be soon removed
as will SymbolProviderCache
2021-01-27 21:26:59 +01:00
Ilya Kirillov
6a83b8b5a4 FIR: migrate FirDependenciesSymbolProviderImpl to FirCachesFactory 2021-01-27 21:26:59 +01:00
Ilya Kirillov
6543429b9a FIR: use FirCachesFactory for package parts cache in KotlinDeserializedJvmSymbolsProvider 2021-01-27 21:26:59 +01:00
Ilya Kirillov
32ae395e05 FIR: use FirCachesFactory for package type alias in KotlinDeserializedJvmSymbolsProvider 2021-01-27 21:26:58 +01:00
Ilya Kirillov
b270d66f68 FIR: use FirCachesFactory for
class cache in KotlinDeserializedJvmSymbolsProvider
2021-01-27 21:26:58 +01:00
Ilya Kirillov
3cee5e848a FIR: encapsulate annotation loading in KotlinDeserializedJvmSymbolsProvider.knownClassNamesInPackage into class 2021-01-27 21:26:58 +01:00
Ilya Kirillov
169134655a FIR: encapsulate KotlinDeserializedJvmSymbolsProvider.knownClassNamesInPackage into class 2021-01-27 21:26:58 +01:00
Ilya Kirillov
7284acc9f9 FIR IDE: use FirCaches in JavaSymbolProvider 2021-01-27 21:26:58 +01:00
Ilya Kirillov
1fef5859e3 FIR IDE: implement thread safe fir caches for IDE 2021-01-27 21:26:58 +01:00
Ilya Kirillov
191a948ffe FIR: introduce caches factory 2021-01-27 21:26:57 +01:00
Ilya Kirillov
2f12b8f87f FIR: refactoring, move class Java class building to separate fun 2021-01-27 21:15:28 +01:00
Mikhail Glukhikh
93436c1341 FIR: optimize / simplify member checkers 2021-01-27 19:46:06 +03:00
Jinseong Jeon
97241599bf FIR checker: add support diagnostic: EXPECTED_PRIVATE_DECLARATION 2021-01-27 19:46:06 +03:00
Jinseong Jeon
57c8dd86a0 FIR checker: introduce top-level property checkers
Also, refactor property initializer checking so that those
newly added property checkers as well as member property checker
can share the same logic
2021-01-27 19:46:06 +03:00
Jinseong Jeon
f9378a3ab7 FIR checker: add diagnostic EXPECTED_DECLARATION_WITH_BODY 2021-01-27 19:46:06 +03:00
Jinseong Jeon
9341ca3004 FIR checker: introduce top-level function checker 2021-01-27 19:46:05 +03:00
Mikhail Glukhikh
df68f319bc FIR LT: simplify defaultValue() search 2021-01-27 19:46:05 +03:00
Jinseong Jeon
8b4f2b269c FIR checker: introduce PARAMETER_* positioning strategies
and use them to add support diagnostics:
ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE
USELESS_VARARG_ON_PARAMETER
2021-01-27 19:46:05 +03:00
Mikhail Glukhikh
33b7c68a21 Add FIR_IDENTICAL to kt44440.kt test 2021-01-27 19:45:27 +03:00
Victor Petukhov
977ac7cbe7 Propagate nullness flexibility into the result type from type variables in other constraints during result type finding, to prevent variable fixation to less flexible type
^KT-44540 Fixed
2021-01-27 17:23:15 +03:00
Mikhail Glukhikh
ce1f9882df FIR2IR: Fix mapping for intersection overrides of deserialized functions 2021-01-27 15:42:04 +03:00
Svyatoslav Kuzmich
4bde884844 [JS IR] Use non-persistent IR for non-dce-driven mode
Eliminate overhead of persistency that we don't use in this mode.
2021-01-27 14:58:33 +03:00
Svyatoslav Kuzmich
02615ec569 [JS IR] Fix: Use proper parameter in ExportedDefaultParameterStub 2021-01-27 14:57:42 +03:00
Roman Golyshev
75ed167566 FIR IDE: Use FirModuleResolveState instead of TowerDataContextProvider
This way we will have a single place to get information about scopes,
so in the future it would be easier to refactor it
2021-01-27 08:02:53 +00:00
Roman Golyshev
dd91ebf1ea FIR IDE: Collect TowerDataContext only for block-level expressions
This makes finding right context easier later in situations like this:

```
fun test() {
  foo.bar.bazz()
}
```

Context is written for `bazz()` element, but we might want to find it
from `foo.bar.bazz()` element
2021-01-27 08:02:52 +00:00
Roman Golyshev
b51b8b59b1 FIR IDE: Collect scopes in FirDesignatedImplicitTypesTransformerForIDE
We need this to capture scopes for properties
with initializers (like `val a = 10`)
2021-01-27 08:02:52 +00:00
Roman Golyshev
445edf8e28 FIR IDE: Mark FirTowerDataContextCollector as ThreadSafeMutableState
Also, use HashMap instead of LinkedHashMap
in `FirTowerDataContextCollector`
2021-01-27 08:02:51 +00:00
Roman Golyshev
11564d7950 FIR: Collect all scopes in FirModuleResolveStateImpl
We need to collect the scopes to later use them in reference shortening

Probably we will need to optimize this behaviour later, since it seems
inefficient
2021-01-27 08:02:50 +00:00
Roman Artemev
8bc7866f01 [KLIB] Fix klib IO when accessing parent file 2021-01-27 09:48:57 +03:00
Roman Artemev
6118d1cf23 [Commonizer] Fix commonizer build 2021-01-26 19:23:25 +03:00
Roman Artemev
b0adcffed9 [JS IR] Fix transitive dependency resolve 2021-01-26 19:23:25 +03:00
Roman Artemev
75016bf54d [Gradle, JS] Fix bridge between Gradle and Js IR CLI 2021-01-26 19:23:25 +03:00
Roman Artemev
350ff8033d [IC KLIB] Replace JS IR build log with KLIB build log for klib compialtion
- fix test data
2021-01-26 19:23:25 +03:00
Roman Artemev
5c25ef62e2 [JVM IR] Fix jvm test runner 2021-01-26 19:23:25 +03:00
Roman Artemev
b4ed7110dd [IC TEST] Fix IC multi module tests for gradle 2021-01-26 19:23:24 +03:00
Roman Artemev
04777d2ff2 [IC TEST] Generate legacy js multi module IC tests 2021-01-26 19:23:24 +03:00
Roman Artemev
898c0470dc [IC TEST] Implement legacy js multi module gradle-like test infra 2021-01-26 19:23:24 +03:00
Roman Artemev
43022a292d [IC TEST] Abstract multi module test runner from klib 2021-01-26 19:23:24 +03:00
Roman Artemev
5b1c70a430 [KLIB IC] Generate multi module klib IC tests 2021-01-26 19:23:24 +03:00
Roman Artemev
10d8e95df7 [IC TEST] Support multi module IC tests for klibs
- implement required infrastructure
 - pass changed class path dependencies
2021-01-26 19:23:24 +03:00
Roman Artemev
9aeda12b99 [KLIB IC] Produce .klib file instead of directory in test
- disable sourcemaps
 - clean up comment
2021-01-26 19:23:24 +03:00
Roman Artemev
37c7f60ae7 [KLIB] Fix issues between directory and .klib modes
- use .klib extension explicitly
 - fix issue with `module.klib.klib` names
2021-01-26 19:23:23 +03:00
Roman Artemev
939da9dbc8 [KLIB] Take into account *.klib rebuild similar to *.jar
Fix multi-module incremental compilation. Fix allows to trigger klib
rebuild when dependency changed.
2021-01-26 19:23:23 +03:00
Roman Artemev
daf1da1c70 [KLIB IC] Fix klib IC test data
Since neither inline function nor super classes affect klib there is no
need for extra passes so compiler doesn't report any dirty files.
Do not check that.
2021-01-26 19:23:23 +03:00
Roman Artemev
380225e0cb [KLIB IC] Support special klib-build.log in IC test infrastructure 2021-01-26 19:23:23 +03:00
Roman Artemev
96ba3b873e [IC] Add in-module tests for incremental compilation
Two tests to check recompilation when parameter with default value was
added or removed without changing use-site.
2021-01-26 19:23:23 +03:00
Roman Artemev
697d4675a2 [KLIB] Improve klib debugging implementing KotlinLibrary.toString() 2021-01-26 19:23:23 +03:00
Roman Artemev
2daf0cc11c [JS IR] Support additional repositories in CLI (cli part) 2021-01-26 19:23:22 +03:00
Roman Artemev
cd9e341fa9 [JS IR] Support additional repositories in CLI (compiler part) 2021-01-26 19:23:22 +03:00
Simon Ogorodnik
e22711d17f [FIR] Reuse empty scopes 2021-01-26 18:33:57 +03:00
Simon Ogorodnik
67267518f0 [FIR] Optimize tower group comparisons
Fix incorrect used bits calculation

bits debug

Disable tower group debugging

Extend comment

Proper to binary string
2021-01-26 18:33:57 +03:00
Simon Ogorodnik
4530cdefe5 [FIR] Implement proper equals/hashCode for TowerGroupKind.WithDepth 2021-01-26 18:33:57 +03:00
Alexander Anisimov
a4dd47daab Update ReadMe.md 2021-01-26 17:29:15 +03:00
Vladimir Dolzhenko
8019dbe06c Do not leak LowMemoryWatcher on plugin unload
#KT-44543 Fixed
2021-01-26 13:55:47 +00:00
Mikhail Glukhikh
76c2288e21 IrInterpreter: interpret IrGetField properly 2021-01-26 16:19:14 +03:00
Mikhail Glukhikh
b311e95487 FIR2IR: don't generate IR getter for const library properties 2021-01-26 16:10:09 +03:00
Hung Nguyen
e2521718dd Kapt: Add flag to keep KDoc comments in stubs
Currently, KaptGenerateStubsTask may not generate KDoc comments
correctly. See KT-43593 for more details.

This commit provides a Kapt flag called
`kapt.keep.kdoc.comments.in.stubs`
to control whether KDoc comments will be included in the generated
stubs.

This flag is currently enabled by default to keep the existing behavior
and avoid breaking existing users.

Users who don't need KDoc comments in stubs but are hitting KT-43593 can
disable the flag.

Whether this flag will be disabled by default later is to be determined.

Bug: https://youtrack.jetbrains.com/issue/KT-43593
     (Note that this commit only provides a workaround, it doesn't
     actually fix the bug.)
Test: (Ir)ClassFileToSourceStubConverterTestGenerated#testCommentsRemoved
2021-01-26 15:28:52 +03:00
sebastian.sellmair
dcda47b502 Ensure that Decompiler and IDE agree on rendered function types with parameterized annotations
findDecompiledDeclaration.kt: Use same DescriptorRenderer options as Decompiler

DescriptorRendererImpl.kt: not enforce different AnnotationArgumentsRenderingPolicy for function type annotations

This will fix KTIJ-563 where rendered Descriptors are used as Keys
for GOTO navigation into decompiled sources.

^KTIJ-563 fixed
2021-01-26 12:24:53 +00:00
Sergey Shanshin
122d04b9fa Returned support for generic serializers in @UseSerializers (#4055)
Fixes Kotlin/kotlinx.serialization#1305
2021-01-26 14:57:40 +03:00
Mikhail Glukhikh
1a4b327210 FIR2IR: fix smart casts in case field is accessed 2021-01-26 12:27:09 +03:00
Mikhail Glukhikh
1c9064836e FIR2IR: fix intersection type smart cast when synthetic property accessed 2021-01-26 12:26:50 +03:00
Alexander Gorshenev
504bdfc283 testData for binary compatibility tests on klib library evolution 2021-01-26 03:42:15 +03:00
Sergey Igushkin
3704b2a5af Fix testJvmKtAppDependsOnMppTestRuntime after 3b0f4f31 2021-01-25 23:59:28 +03:00
Bingran
d4965b1e6e Avoid resolving deprecated configurations in tests (#3970)
* Avoid resolving deprecated configurations in tests

This PR enables more integration tests run with warning-mode=fail by
updating "resolveAllConfigurations" task in a way where we don't resolve
deprecated configurations and instead check dependencies on alternative
configurations.

* Add custom resolvable configuration for testing
2021-01-25 23:00:12 +03:00
Sergey Igushkin
3b0f4f3164 Set canBeConsumed = false on the deprecated configurations like compile
This leads to clearer error messages in Gradle variant-aware dependency
resolution failures. Gradle has deprecated those configurations since
long ago, and we didn't see much use of them as variant-aware dependency
resolution entities either.

So this commits sets `canBeConsumed` to false on these configuratons:
* compile (+ testCompile, fooCompile in MPP)
* runtime (+ testRuntime, fooRuntime, ...)
* compileOnly (+ testCompileOnly, fooCompileOnly, ...)

This change replaces the PR #3995
2021-01-25 22:51:42 +03:00
Steven Schäfer
3e820ff3b1 JVM: Take inline class mangling state into account for default methods 2021-01-25 18:12:01 +01:00
Svyatoslav Kuzmich
f85263ca7f [JS IR] Add fast path to JsCodeOutliningLowering 2021-01-25 19:18:44 +03:00
Svyatoslav Kuzmich
cb3b1f8ae2 [JS IR] Fix referencing Kotin variables in inline JS code
Fixed by outlining JS code that uses Kotlin variables making usages of
these locals explicit and preventing bugs due to one-sided variable renaming.

This prevents using Kotlin variables as lvalue in JS code.
2021-01-25 19:18:44 +03:00
Dmitry Petrov
708e6914bd JVM JVM_IR hide sealed class constructors 2021-01-25 17:29:38 +03:00
Dmitriy Novozhilov
ca3bb02897 [TD] Update spec testdata after f06a5321 2021-01-25 17:16:54 +03:00
Dmitriy Novozhilov
f61a318c9d [Test] Migrate AbstractBytecodeTextTest to new test infrastructure 2021-01-25 17:11:21 +03:00
Dmitriy Novozhilov
e928448e00 [Test] Fix default jps [JSP] Fast FIR tests run configuration 2021-01-25 17:11:21 +03:00
Dmitriy Novozhilov
663d5026d8 [Test] Migrate FIR diagnostic spec tests to new infrastructure
This commit includes a lot of minor changes in testdata: new infrastructure
  requires that each test file in one testdata file in one module must
  have unique name, but a lot of existing spec tests didn't satisfy
  this requirement
2021-01-25 17:08:32 +03:00
Dmitriy Novozhilov
0b45139b34 [Test] Fix OutOfMemoryError during extracting meta info from test
Previously CodeMetaInfoParser saved MatchResults for each meta info in
  text (and for each meta info it was different string with text because
  of extracting parsed part from original text), so it led to O(n^2)
  memory complexity (where n is a size of original text).
  Such complexity caused OOME in case of big testdata (~1k meta infos
  for text of 4k lines)
2021-01-25 17:08:32 +03:00
Dmitriy Novozhilov
fd8795de99 [Test] Fix FirIdenticalChecker and update some FIR_IDENTICAL testdata 2021-01-25 17:08:32 +03:00
Dmitriy Novozhilov
98c22f9e59 [TD] Add forgotten bytecode dump 2021-01-25 17:08:32 +03:00
Dmitriy Novozhilov
5c0cfa87ba [Test] Support some jvm codegen specific configuration directives 2021-01-25 17:08:31 +03:00
Dmitriy Novozhilov
7d4adaba21 [Test] Add ability to simply declaring mapping between directives and configuration keys 2021-01-25 17:08:31 +03:00
Dmitriy Novozhilov
5490689fea [Test] Add ability to disable specific handler if there was an error from previous one 2021-01-25 17:08:31 +03:00
Dmitriy Novozhilov
42f9442728 [Test] Handle any Throwable from test instead of AssertionError 2021-01-25 17:08:31 +03:00
Victor Petukhov
c111c33950 Fix failing tests after 8bd78064be 2021-01-25 16:24:43 +03:00
scaventz
1654dfb3bf Upgrade Apache Ant dependency to 1.10.7 2021-01-25 04:28:32 -08:00
Ilya Goncharov
aa1e23d9b0 [JS IR] Use origins for bridge with and without stable names
^KT-44415 fixed
2021-01-25 15:16:47 +03:00
Ilya Goncharov
57fdabdace [JS IR] Add BRIDGE origin as ignore for stabitility of names
^KT-44415 fixed
2021-01-25 15:16:35 +03:00
Ilya Goncharov
a89fe90043 [JS IR] Add test on exportable overriden method
^KT-44415 fixed
2021-01-25 15:16:22 +03:00
Victor Petukhov
f06a5321a6 Approximate definitely not-null types for type parameter's types if they are already not-null (has not-null upper bounds)
^KT-44440 Fixed
2021-01-25 14:17:58 +03:00
Simon Ogorodnik
f2c1608c2b Update testData 2021-01-25 13:53:45 +03:00
Denis.Zharkov
9548caf6ea FIR2IR: Use TEST ClassBuilderFactory in for tests
It helps with bytecode printing when tests fail
2021-01-25 12:29:32 +03:00
Denis.Zharkov
8c30adc301 FIR2IR: Unwrap intersection overrides for intersection types 2021-01-25 12:29:31 +03:00
Denis.Zharkov
3a3d2ee3e9 FIR2IR: Fix mapping for intersection overrides of deserialized properties 2021-01-25 12:29:31 +03:00
Victor Petukhov
fdf0934ade Don't generate txt dump for buildFlexibleEnhancement.kt diagnostic test 2021-01-25 12:16:13 +03:00
Victor Petukhov
8bd78064be Do substitution of a type enhancement, not only lower and upper bounds
^KT-44439 Fixed
2021-01-25 12:14:34 +03:00
Victor Petukhov
83c93aca2e Build type enhancement properly, by taking into account both bounds of the original flexible type
^KT-44420 Fixed
2021-01-25 11:36:49 +03:00
Nikolay Krasko
293f2f9950 Build: Replace Bintray with Space for kotlin-dependencies repository (KTI-466) 2021-01-24 15:04:41 +03:00
Mikhail Glukhikh
eed0f50c5d Code cleanup: ConeAttributes 2021-01-23 10:56:43 +03:00
Mikhail Glukhikh
94e613dd01 FIR: support custom annotation-based type attributes 2021-01-23 10:56:42 +03:00
Mikhail Glukhikh
4cd6266bce FIR: fix suspend type serialization 2021-01-23 10:56:40 +03:00
Mikhail Glukhikh
afe335e504 FIR: serialize ExtensionFunctionType attribute 2021-01-23 10:56:37 +03:00
Mikhail Glukhikh
9e5c9efadf FIR2IR: don't generate IrGetObject for anonymous objects 2021-01-23 10:56:36 +03:00
Mikhail Glukhikh
06ee768c6a FIR: in case of smart cast, use original type for FirThisRcvrExpression
Before this commit, we used type after smart cast both for original
FirThisReceiverExpression and for wrapping FirExpressionWithSmartCast.
However, this makes FIR2IR implicit cast generator work incorrectly
(it decides not to insert implicit cast because original type is the same).
After this commit, expressions have different types and implicit cast
generator works properly.
2021-01-23 10:56:34 +03:00
Mikhail Glukhikh
4fd4f504d0 FIR: make componentX functions operator 2021-01-22 18:11:57 +03:00
Mikhail Glukhikh
7934853c8e Set ABI stability to JVM modules which are built with FIR 2021-01-22 18:11:57 +03:00
pyos
4a76ea6ecb JVM: regenerate objects if they have been regenerated in parent contexts
This is a hack to work around the fact that type mappings should not be
inherited by inlining contexts for lambdas called from anonymous
objects. As the lambda can call the inline function again, this could
produce a reference to the original object, which is remapped to a new
type in the parent context. Unfortunately, there are many redundant
`MethodRemapper`s between the lambda and the class file, so simply
editing `TypeRemapper` does not work. Hence, this hack. For now.

(Issue found by compiling IntelliJ IDEA BTW.)
2021-01-22 13:39:20 +01:00
Mads Ager
ef36b81c67 [JVM_IR] Reduce the amount of super suffixes on accesibility bridges.
The super suffix was used for any static field/method that needed
an accessor. We should only use it when that field or method is
inherited.
2021-01-22 13:20:25 +01:00
Mikhail Zarechenskiy
a33877a9b9 Fix add import quick fix for unresolved conventional invoke operator
After adding extension invoke on DeepRecursiveFunction in 1.4,
 the compiler start reporting another error and now it doesn't write
 info about callable descriptor. Therefore it's needed to use another
 source of info for expression type

 ^KT-40926 Fixed
2021-01-22 13:57:47 +03:00
Mikhail Zarechenskiy
d2ce73853d Report more specific diagnostic for variable + invoke calls
Do not report same set of diagnostics for variable call if actual
 error was happened with a function candidate. Here the candidate is
 invoke function on DeepRecursiveFunction

 ^KT-40991 Fixed
 ^KT-41491 Fixed
 ^KT-40926 In Progress
2021-01-22 13:57:47 +03:00
Dmitriy Novozhilov
c423750962 [TD] Fix incorrect module structure directives in test data file 2021-01-22 13:51:34 +03:00
Dmitriy Novozhilov
0d058c7c8c [Test] Allow parse FILE and MODULE directives with other strings between them in old tests 2021-01-22 13:51:33 +03:00
Dmitriy Novozhilov
b9e9620ab5 [TD] Unmute passing Fir2Ir text test 2021-01-22 13:51:32 +03:00
Dmitriy Novozhilov
842ed624a7 [TD] Remove some outdated dumps in FIR_IDENTICAL tests 2021-01-22 13:51:31 +03:00
Dmitriy Novozhilov
77115cea92 [TD] Union ir dumps of different test files 2021-01-22 13:51:30 +03:00
Dmitriy Novozhilov
4752924b13 [TD] Update FQN's in testdata of IR text tests 2021-01-22 13:51:29 +03:00
Dmitriy Novozhilov
8286a160bd [TD] Update order of directives 2021-01-22 13:51:27 +03:00
Dmitriy Novozhilov
bdcb8aecab [Test] Migrate AbstractFir2IrTextTest to new infrastructure 2021-01-22 13:51:26 +03:00
Dmitriy Novozhilov
aba029237d [Test] Add handler for comparing pretty kt ir dumps 2021-01-22 13:51:25 +03:00
Dmitriy Novozhilov
87ffbd8206 [IR] Collect all dependencies of module recursively 2021-01-22 13:51:24 +03:00
Dmitriy Novozhilov
aaa3fa5845 [Test] Migrate IrTextTestGenerated to new infrastructure 2021-01-22 13:51:23 +03:00
Dmitriy Novozhilov
5ae5f660f6 [Test] Add ability to explicitly declare default binary kind for test 2021-01-22 13:51:22 +03:00
Dmitriy Novozhilov
a2ae618185 [Test] Introduce IGNORE_ERRORS diagnostic to suppressing backend errors 2021-01-22 13:51:21 +03:00
Dmitriy Novozhilov
acb6d2e196 [Test] Allow facades to return null which indicates that facade can't complete it's job
This is needed for cases when test pipeline assumes that some part of
  pipeline may be unavailable because of errors on previous stage.

For example, this may occur in some test which check something on IR
  but contains backend facade for compiling binary dependencies. In
  this case testdata with frontend errors is allowed if test has only
  one module which should not be compiled
2021-01-22 13:51:20 +03:00
Dmitriy Novozhilov
6a7cd0c811 [Test] Add ability to specify applicability of diagnostic to module or file 2021-01-22 13:51:19 +03:00
Dmitriy Novozhilov
28cff22cd0 [Test] Add ability to specify directive for test file
Rules of directives resolving:
- If no `MODULE` or `FILE` was declared in test then all directives
  belongs to module
- If `FILE` is declared, then all directives after it will belong to
  file until next `FILE` or `MODULE` directive will be declared
- All directives between `MODULE` and `FILE` directives belongs to module
- All directives before first `MODULE` are global and belongs to each
  declared module
2021-01-22 13:51:17 +03:00
Alexander Udalov
e17153fab9 Minor, improve Ant test on includeRuntime
Also check that we _do_ include runtime if includeRuntime is true.
2021-01-21 18:29:19 +01:00
scaventz
a13eb4c8e6 Ant task: do not include runtime by default if destination is a jar 2021-01-21 18:29:19 +01:00
Denis.Zharkov
b0b7f39c75 FIR: Do not use return statement for type of a block expression
Type of a block is a kind of irrelevant for lambdas: their type is much
more complicated and defined via FirDataFlowAnalyzer#returnExpressionsOfAnonymousFunction
at at FirCallCompleter.LambdaAnalyzerImpl#analyzeAndGetLambdaReturnArguments
2021-01-21 18:53:03 +03:00
Denis.Zharkov
4dc2653736 FIR: Do not complete finally parts of try-finally
It's been processed via Body transformer explicitly
2021-01-21 18:53:03 +03:00
Denis.Zharkov
7df4f67f7c FIR: Minor. Drop unused parameter 2021-01-21 18:53:03 +03:00
Denis.Zharkov
9493e68584 FIR: Do not run completion for lambda's explicit return too early
See the test case
Completion for synthetic call: x ?: return@myRun materialize()
makes `materialize()` while it's obviously too early for that
2021-01-21 18:53:03 +03:00
Denis.Zharkov
5afebb4e78 FIR: Transform synthetic calls children even without incomplete candidate
It might be necessary for cases like
run @l1{
   run {
      if (...) return@l1 1
   }
}

"if" is a synthetic call, but without candidate since there's just one branch
But return@l1 1 is incomplete because it's resolved in dependent context
and "1" is hang incomplete integer literal
2021-01-21 18:53:03 +03:00
Denis.Zharkov
5f0d00a83f FIR: Use proper tower data contexts for postponed callable references
E.g., it should contain local scopes of containing lambdas
2021-01-21 18:53:03 +03:00
Denis.Zharkov
ad30c6c380 FIR: Fix callable references resolution when they're being returned from lambdas 2021-01-21 18:53:03 +03:00
Denis.Zharkov
0e368cc237 FIR: Analyze return statements for implicit lambda with independent context 2021-01-21 18:53:02 +03:00
Denis.Zharkov
5e83e10a72 FIR: Add callable references nodes to CFG
Otherwise, they are not being considered as return expressions from lambdas
2021-01-21 18:53:02 +03:00
Alexander Dudinsky
6dc0440cd0 Remove commented code in previous commit 2021-01-21 18:47:48 +03:00
Alexander Dudinsky
71e74497b5 Use addTestJdk&removeTestJdk methods instead addJdk&removeJdk 2021-01-21 18:38:06 +03:00
Mikhail Glukhikh
20843b6894 Remove error suppression in KotlinChangeSignatureDialog 2021-01-21 18:32:34 +03:00
Pavel Kirpichenkov
628d6a9c30 Don't store logger in instance field 2021-01-21 16:53:09 +03:00
Pavel Kirpichenkov
5003738d29 Fix: use idea caches correctly
Instead of using value from cache the first created value
was being saved to field and not invalidated later.
2021-01-21 16:53:09 +03:00
Sergey Igushkin
87c6b6bffc Revert "Set canBeConsumed = false on the deprecated configurations like compile"
This reverts commit dfacccf8
2021-01-21 16:39:00 +03:00
Jinseong Jeon
2e660ef62a Raw FIR: use lambda parameter type if available 2021-01-21 16:06:23 +03:00
Jinseong Jeon
fa0b933bc8 FIR checker: add diagnostics for missing/ambiguous component calls 2021-01-21 16:06:10 +03:00
Jinseong Jeon
83b9c29495 FIR checker: relocate sealed class ctor call checker 2021-01-21 16:06:10 +03:00
Jinseong Jeon
5f0eb8a401 FIR checker: minor cleanups 2021-01-21 16:06:10 +03:00
Jinseong Jeon
be29b6d64d FIR checker: use aliased checker when possible (part 2) 2021-01-21 16:06:10 +03:00
Jinseong Jeon
de592f4f67 FIR checker: introduce FunctionChecker alias
and use it to add support diagnostic FUNCTION_DECLARATION_WITH_NO_NAME
2021-01-21 16:06:09 +03:00
Mikhail Glukhikh
40bec30393 FIR: implement LT positioning in diagnostic tests, fix LT strategies 2021-01-21 16:06:09 +03:00
Jinseong Jeon
f1d8a6e5d1 FIR checker: introduce DECLARATION_SIGNATURE_OR_DEFAULT positioning strategy
and fix CONFLICTING_OVERLOADS to use it
2021-01-21 16:06:09 +03:00
Igor Yakovlev
2e4daee1d4 [FIR] Fix invalid diagnostic fir node sites and improved invalid type parameters count diagnostic report 2021-01-21 15:20:30 +03:00
Simon Ogorodnik
b7d3469819 [FIR] Remove transform/accept from FirResolvedTypeRef.delegateTypeRef 2021-01-21 15:20:30 +03:00
Igor Yakovlev
243f85a4d6 [FIR IDE] Add base support for FIR incomplete types resolve 2021-01-21 15:20:30 +03:00
Ilmir Usmanov
704366e531 JVM: Mark suspend lambda receiver as used if callable reference
accesses it.
 #KT-44131 Fixed
2021-01-21 12:47:59 +01:00
Mikhael Bogdanov
de00f72fa3 Generate linenumber for inline call site in case of implicit iterator/hasNext/next calls in for loop
Otherwise -1 is generated in smap
2021-01-21 12:04:09 +01:00
Sergey Igushkin
dfacccf84f Set canBeConsumed = false on the deprecated configurations like compile
This leads to cleaner error messages in Gradle variant-aware dependency
resolution failures. Gradle has deprecated those configurations since
long ago, and we didn't see much use of them as variant-aware dependency
resolution entities either.

So this commits sets `canBeConsumed` to false on these configuratons:
* compile (+ testCompile, fooCompile in MPP)
* runtime (+ testRuntime, fooRuntime, ...)
* compileOnly (+ testCompileOnly, fooCompileOnly, ...)
* default (+ fooDefault in MPP)

This change replaces the PR #3995
2021-01-21 11:00:21 +00:00
Sergey Igushkin
6e913e16ad Add integration tests for Kapt + Android Gradle plugin 7.0 2021-01-21 11:00:21 +00:00
Sergey Igushkin
341b87fad0 Use implementation instead of compile in GradleIT, fix versions 2021-01-21 11:00:20 +00:00
Sergey Igushkin
17b71555e0 KT-43944: Don't access Android test source sets' API configurations
When dependencies are added to our corresponding configurations,
report errors, as there's no proper way to add those dependencies.

Issue #KT-43944 Fixed
2021-01-21 11:00:19 +00:00
Andrei Klunnyi
77ffc318f2 KT-44250 [Sealed interfaces]: completion fails for 'when' with sealed 2021-01-21 10:53:36 +00:00
Dmitriy Novozhilov
14108011ee [FIR] Fix inferring arguments of bare types in different situations
- argument type is flexible
- supertype has flexible type argument
- type of expression is more specific than bare type
2021-01-21 12:02:01 +03:00
Jinseong Jeon
b99f1a1512 FIR checker: error messages for function diagnostics
Also, update error inputs to conform to old FE's

These should have been part of commit 39df3e2b0a
2021-01-21 09:57:55 +03:00
Jinseong Jeon
021395ce39 FIR checker: error message for destructuring declaration diagnostic
Also, update error inputs to conform to old FE's

This should have been part of commit 03cb0c3cd1
2021-01-21 09:57:55 +03:00
Jinseong Jeon
35093e0958 FIR checker: error messages for properties/accessors diagnostics
Also, update error inputs to conform to old FE's

These should have been part of commit 5167d69b7c
2021-01-21 09:57:55 +03:00
Ilmir Usmanov
952576e98f JVM_IR: Do not unbox Result parameter if it not only one inline class
parameter, since in this case, the compiler generates a bridge, where
the result is unboxed.
2021-01-20 18:30:00 +01:00
Ilmir Usmanov
d48f92775b JVM_IR: Do not unbox Result parameter in invoke if there is a bridge
since the bridge unboxes it.

 #KT-44141 Fixed
2021-01-20 18:29:58 +01:00
Ilya Goncharov
0ddb603eaa [JS IR] Fix of test with method in abstract class calling extension on super type 2021-01-20 20:01:42 +03:00
Steven Schäfer
9c4f8f7e54 JVM IR: Fix signature mapping for inline classes using new mangling
When resolving inline class methods in binary dependencies we look for
methods matching both the new and the old mangling scheme. On the IR
backend the method signature has to be computed for the inline class
replacement, since the logic for signature mangling is not contained in
the method signature mapping, unlike in the old backend.
2021-01-20 17:43:41 +01:00
Mikhael Bogdanov
91717cdcdd Perform inline checks in IR tests 2021-01-20 15:23:09 +01:00
Mikhael Bogdanov
216b775095 Remove obsolete code 2021-01-20 15:23:09 +01:00
Mikhael Bogdanov
147d60523d Generate inline function arguments with parameters types
#KT-44429 Fixed
2021-01-20 15:23:08 +01:00
Ilya Goncharov
50ab9ed054 [JS IR] Add test on interface with default method calling extension method on super-interface
^KT-42176 fixed
2021-01-20 14:26:38 +03:00
Pavel Kirpichenkov
5c28762c02 Fix check for local classes in approximating string table
Take local/anonymous classes and their inner classes into account.
Simplify approximation: use first available super classifier instead
of first super class. This approximation should only happen for
private declarations that were not previously approximated by frontend.
So basically the only requirement for the approximated types is to be
denotable. Note that this only works if the types are not used later.
JVM uses a different string table implementatin as it needs exact
types of private members for reflection.

^KT-20996 Fixed
2021-01-20 11:05:53 +03:00
Pavel Kirpichenkov
b66f5c8180 Drop type aliases for JS and KLIB string tables
They used to use the same approximation logic anyway
^KT-20996
2021-01-20 11:05:53 +03:00
Pavel Kirpichenkov
2f3f75b512 Fix local anonymous class name error in K2MetadataCompiler
Extract the logic of approximating to denotable class supertype
from JS/KLIB and use it in metadata compiler.

^KT-20996 In Progress
2021-01-20 11:05:53 +03:00
Pavel Kirpichenkov
b82a44fa63 Add test for KT-20996 2021-01-20 11:05:53 +03:00
Ilmir Usmanov
cce9469e6a JVM_IR: Do not unbox Result parameter in Result methods
#KT-44140 Fixed
2021-01-20 06:27:15 +01:00
Sergey Shanshin
10d9259df5 Returned support for nullable types by not null serializers
Fixes Kotlin/kotlinx.serialization#1265
2021-01-19 20:44:47 +03:00
Ilmir Usmanov
b476f1cc3e Minor. Change test to use the feature instead of suppressing error 2021-01-19 16:03:33 +01:00
Ilmir Usmanov
d1ee45b518 Add language feature for suspend functions in fun interfaces
Since in 1.5 JVM_IR is enabled by default and supports suspend functions
in fun interfaces, it is safe to enable the feature by default as well.
2021-01-19 16:03:31 +01:00
Yaroslav Chernyshev
6aa6f82c47 Fix MultiplatformModelImportingContextImpl#isOrphanSourceSet predicate 2021-01-19 17:28:15 +03:00
Svyatoslav Kuzmich
cf228bebc3 Use static year range in copyright of generated FIR and tests
Dynamically calculating a year is problematic, especially in cases like
FIR where generation happens in every build. When you are working on a
last year's commit, each build creates a bunch of uncommited
 changes of updating the year in copyrights.
2021-01-19 17:17:31 +03:00
Svyatoslav Kuzmich
ba8223218f [Wasm] Add inline property accessors optimization 2021-01-19 17:08:58 +03:00
Svyatoslav Kuzmich
2aa3c197a3 [Wasm] Use non-persistent IR to speed up tests 2021-01-19 17:08:05 +03:00
Ilya Kirillov
11a3126c8c FIR: copy class supertypes list on iterating while calculating supertypes
This list is backed by mutable list and during iterating on it
we can resolve supertypes of that class via IDE light classes
as IJ Java resolve may resolve a lot of stuff by fir light classes
This causes ConcurrentModificationException
2021-01-19 14:34:57 +01:00
Vyacheslav Gerasimov
a0ad85e20d Build: Disable caching of test tasks
Until `KTI-464 Test tasks with failed tests are cached` is resolved
2021-01-19 14:19:05 +03:00
Sergey Bogolepov
284d42fd2b Use camelCase for cacheKind control property
Because it is more intuitive for end-users.
2021-01-19 17:31:45 +07:00
pyos
29f95c7df2 FIR: improve inference of implicit type arguments in casts
Type parameters do not necessarily match one-to-one, or preserve order.
2021-01-18 18:01:03 +03:00
sebastian.sellmair
acdc1f532b Rewrite CommonizerTask params to fix ^KT-42098 2021-01-18 14:57:18 +00:00
Shagen Ogandzhanian
23332bac13 More precise message for "this test can be unmuted" 2021-01-18 12:51:23 +01:00
Vladimir Dolzhenko
6331a135c8 Add LightClassUtil.getLightClassMethodsByName to avoid resolving all lightClassMethods and filtration later on 2021-01-18 11:13:16 +00:00
Ilmir Usmanov
167bfcf6ea Minor. Remove accidentally added bunch file 2021-01-18 10:14:11 +01:00
Sebastian Sellmair
bf5feb1b4a Remove KotlinMetadataTarget's KotlinTargetComponent in favour of KotlinSoftwareComponent.kt
^KT-44322 fixed
2021-01-18 08:49:30 +00:00
Mikhail Glukhikh
9a5791ad6d FIR: use correct context for enum entry resolve
Now the same resolve context is used for enum entries and
for constructors.
2021-01-18 08:34:46 +03:00
Mikhail Glukhikh
f85fc47383 FIR: introduce separate companion object resolve context
Before this commit, during the resolve of companion objects we used
the same context than for any nested class. However, during companion
object resolve we should not have companion object receiver itself
accessible in any case (in particular, it should not be accessible
in constructor). So in this commit we introduced separate context
for this purpose.
2021-01-18 08:32:06 +03:00
Mikhail Glukhikh
f282c3e547 Cleanup: FirTowerResolveTask 2021-01-18 08:28:49 +03:00
Mikhail Glukhikh
9f06c1a500 FIR cleanup: runResolverForDelegatingConstructor 2021-01-18 08:28:37 +03:00
Mikhail Glukhikh
6cee4e968e [FIR] Don't call componentX for anonymous destructuring entry 2021-01-18 08:28:15 +03:00
Mikhail Glukhikh
795bd26eaf FIR bootstrap: don't use -Werror in useFIR mode 2021-01-18 08:28:05 +03:00
Mikhail Glukhikh
3787018e40 [FIR] Fix parameter index storage in contract serializer 2021-01-18 08:28:01 +03:00
Mikhail Glukhikh
12caf5d743 Fix test BE JvmBoxRunner to be able to see FIR BB tests exceptions 2021-01-18 08:27:51 +03:00
Dmitry Petrov
0c463d3260 KT-44378 don't generate no-arg constructor for sealed classes 2021-01-15 22:31:01 +03:00
Dmitriy Dolovov
ee93efc19d [Commonizer] Avoid leaking non-commonized types as arguments in short-circuited TAs 2021-01-15 22:01:56 +03:00
Ilya Kirillov
8fa848bed3 FIR IDE: fix testdata after rebase 2021-01-15 17:23:12 +01:00
Ilya Kirillov
459c919072 FIR IDE: introduce JAVA_SYNTHETIC_PROPERTY symbol origin 2021-01-15 17:23:12 +01:00
Ilya Kirillov
a5e6c1d82b FIR IDE: implement new getTopLevelFunction(/property)Symbols in FirModuleWithDependenciesSymbolProvider 2021-01-15 17:23:11 +01:00
Ilya Kirillov
450ab33f16 FIR IDE: do not highlight by-name argument as parameter 2021-01-15 17:23:11 +01:00
Ilya Kirillov
16cd2f08fe FIR: preserve delegatedTypeRef when transforming FirFunctionTypeRef 2021-01-15 17:23:11 +01:00
Ilya Kirillov
b405cbb1ff FIR IDE: consider synthetic functional interfaces to have LIBRARY origin 2021-01-15 17:23:10 +01:00
Ilya Kirillov
981f932033 FIR IDE: ignore synthetic references in reference resolve 2021-01-15 17:23:10 +01:00
Ilya Kirillov
087840122a FIR: mark FirBuiltinSymbolProvider with ThreadSafeMutableState
It has mutable cache in BuiltInsPackageFragment
2021-01-15 17:23:09 +01:00
Ilya Kirillov
56bd6a30b3 FIR IDE: introduce delegated symbol origin 2021-01-15 17:23:09 +01:00
Ilya Kirillov
2a9779cd89 FIR IDE: resolve reference to intersection override member to overridden members 2021-01-15 17:23:09 +01:00
Ilya Kirillov
95eb701f75 FIR: introduce symbols for intersection override 2021-01-15 17:23:08 +01:00
Ilya Kirillov
2ef8f58d90 FIR IDE: add KDoc for KtSymbolOrogin 2021-01-15 17:23:08 +01:00
Ilya Kirillov
e060778528 FIR IDE: implement assignment statement references 2021-01-15 17:23:07 +01:00
Ilya Kirillov
14d2b1be49 FIR IDE: resolve by-name-parameter call 2021-01-15 17:23:07 +01:00
Ilya Kirillov
47894c6cc9 FIR IDE: invalidate LibraryModificationTracker in memory leak test 2021-01-15 17:23:06 +01:00
Ilya Kirillov
87e6dbf435 FIR IDE: generate heap dump on memory leak in memory leak test 2021-01-15 17:23:06 +01:00
Ilya Kirillov
f454ec8e4a FIR IDE: introduce methods for working with annotations 2021-01-15 17:23:05 +01:00
Ilya Kirillov
191a1ee242 FIR: add fake source fir element to it parameter 2021-01-15 17:23:05 +01:00
Ilya Kirillov
132fc9e68b FIR IDE: invalidate caches between tests 2021-01-15 17:23:04 +01:00
Ilya Kirillov
861c9b8e45 FIR IDE: unmute passing tests
fix unmute passing
2021-01-15 17:23:04 +01:00
Ilya Kirillov
c97c4fa99c FIR IDE: fix finding fir in container which have conflicting duplicate by name 2021-01-15 17:23:03 +01:00
Ilya Kirillov
601d5cbff8 FIR IDE: fix duplicating diagnostics collection 2021-01-15 17:23:03 +01:00
Ilya Kirillov
008260451c FIR: make FirNestedClassifierScopeWithSubstitution to be name aware 2021-01-15 17:23:03 +01:00
Ilya Kirillov
c2866152bf FIR IDE: fix not initialized containingClassAttr for copied declaration 2021-01-15 17:23:02 +01:00
Ilya Kirillov
a7903c64f1 FIR IDE: do not consider function literal as fqName-having declaration 2021-01-15 17:23:02 +01:00
Ilya Kirillov
1fb33207b8 FIR IDE: add meaningful error message when opening non-source file 2021-01-15 17:23:01 +01:00
Ilya Kirillov
1901436c96 FIR IDE: add more info to error messages 2021-01-15 17:23:01 +01:00
Ilya Kirillov
c131983188 FIR IDE: implement FirIdeProvider.getClassNamesInPackage
#KT-41048 fixed
2021-01-15 17:23:00 +01:00
Ilya Kirillov
a52674f181 FIR: use more meaningful error messages 2021-01-15 17:23:00 +01:00
Ilya Kirillov
4d07eb27bb FIR IDE: add incremental analysis test for function in companion object 2021-01-15 17:23:00 +01:00
Ilya Kirillov
e63d084cdc FIR IDE: allow getting light class name from EDT 2021-01-15 17:22:59 +01:00
Ilya Kirillov
d53af8170b FIR IDE: cache module libraries 2021-01-15 17:22:59 +01:00
Ilya Kirillov
8c113f02d5 FIR IDE: consider top level file change as out of block modification 2021-01-15 17:22:58 +01:00
Ilya Kirillov
d3dd6e3b96 FIR IDE: delegate light classes is valid to corresponding symbol validity check 2021-01-15 17:22:58 +01:00
Ilya Kirillov
a95f38569f FIR IDE: fix FirModuleWithDependenciesSymbolProvider recursive calls 2021-01-15 17:22:58 +01:00
Nikolay Krasko
5838357e61 Extract long project wizard tests to separate TC configuration (KTI-422) 2021-01-15 16:55:41 +03:00
Dmitry Petrov
2f30b0994a Minor: mute test in WASM 2021-01-15 15:31:41 +03:00
Jinseong Jeon
6b5ee6c9f9 FIR checker: warn redundant open in interface members properly 2021-01-15 14:38:37 +03:00
Jinseong Jeon
2e8b5f2380 FIR checker: make member property checker robust to conflict modifiers 2021-01-15 14:38:36 +03:00
Jinseong Jeon
39df3e2b0a FIR checker: introduce member function checker 2021-01-15 14:38:35 +03:00
Jinseong Jeon
5594af0d70 FIR checker: utilize modifier retrievals 2021-01-15 12:46:22 +03:00
Jinseong Jeon
3af820eaf4 FIR: utilize lookups of certain properties of classes/functions 2021-01-15 12:46:20 +03:00
Jinseong Jeon
ec68ac36db FIR checker: use the aliased checker when possible 2021-01-15 12:46:17 +03:00
Jinseong Jeon
03cb0c3cd1 FIR checker: introduce PropertyChecker alias
and use it to add diagnostic
ININITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION
2021-01-15 12:45:25 +03:00
Jinseong Jeon
db65c787e5 FIR checker component generator: handle type parameters in alias arguments 2021-01-15 12:45:25 +03:00
Ilya Goncharov
f3dfb38163 [Gradle, JS] Exclude transitive dependencies of semver4j
^KT-44204 fixed
2021-01-15 11:54:31 +03:00
Dmitriy Novozhilov
e742af5444 [Test] Run fir diagnostics tests with light tree in sequential mode
In parallel mode many tests are failing so it's temporary workaround
2021-01-15 11:16:28 +03:00
Dmitriy Novozhilov
2f1e4862e5 [Test] Enable builtin parallel tests execution form JUnit5 in :compiler:tests-common-new 2021-01-15 11:16:26 +03:00
Dmitry Savvinov
78b2eb994b Deduplicate logic of computing orphan source sets in MPP Gradle Import
Set of compiled source sets is already available in
MultiplatformModelImportingContext via
'sourceSetsToParticipatedCompilations.keys', no need to recompute it

^KT-37127
2021-01-15 11:12:46 +03:00
Dmitry Savvinov
1d0a696a62 Simplify building of source-sets during MPP Import
Build dependsOn closure straight away by using KotlinSourceSetProto
instead of building first KotlinSourceSetImpls with incorrect
dependsOn-names, and then discarding it

^KT-37127
2021-01-15 11:12:46 +03:00
Dmitry Savvinov
9e58e3c3fd Remove unused KotlinSourceSetImpl.defaultIsTestModule; simplify logic of test modules detection
^KT-37127
2021-01-15 11:12:46 +03:00
Dmitry Savvinov
58b2064295 Introduce MultiplatformModelImportingContext
Essentially it is responsible for returning various information about
the model being imported, such as:

- flags and properties, which configure the process of import
- "bulk" requests which might be needed multiple times during import,
but which are more convenient to be computed once, like various indices
(source sets by name, compilations by source-sets, etc.)

^KT-37127
2021-01-15 11:12:46 +03:00
Dmitry Savvinov
f87aa4612b Minor: return map straight away 2021-01-15 11:12:45 +03:00
Dmitry Savvinov
cf2bd75a73 Minor: reformat 2021-01-15 11:12:45 +03:00
Dmitry Savvinov
0aef3680c1 Remove useless function
Looks like it has been broken by 40633768bc
where 'KotlinCompilation.dependencies' switched its type from
KotlinDependency (which is alias to
org.jetbrains.plugins.gradle.model.ExternalDependency) to
KotlinDependencyId (which is alias to Long), leading to safe-cast in the
'reportUnresolvedDependencies' to be always evaluated to 'null'

Rationale for removing it completely instead of fixing:
No one has noticed that this function has been broken + I haven't
managed to find any user-visible behaviour it adds (tried fixing it and
checking project similar to one from
NewMultiplatformProjectImportingTest.testUnresolved, no difference for
me).
2021-01-15 11:12:45 +03:00
Dmitry Savvinov
824efe8498 Remove useless condition
Note that in previous line we already check for !isHmppEnabled and for
sourceSet.name == KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME, and if it
holds, then we continue to the next loop iteration. So, this conditional
here is essentually equal to 'false'
2021-01-15 11:12:45 +03:00
Dmitry Savvinov
ecd96e14c9 Use all participated compilations for source-sets platform detection even in non-HMPP 2021-01-15 11:12:45 +03:00
Dmitry Savvinov
09286504b7 Add a bunch of tests on corner-cases in Gradle MPP Import
For most of those the behaviour isn't set in stone, though at the moment
of making that commit we're more or less sure that it's reasonable.

Behaviour in some cases might be more strictly enforces (as much as you
can enforce something in esoteric cases with misconfigured project
sturcture). Those are marked with comments with '!'.
2021-01-15 11:12:45 +03:00
Dmitry Savvinov
69261ca1e6 Add tests on precise platforms importing
Note the behaviour in 'precisePlatformsWithUnrelatedModuleHmpp': it is
incorrect, as set of platforms still contains unrelated platforms.

This is because in the current solution, some source-sets
(commonMain/commonTest) always receive COMMON platform and then it gets
coerced to set of targets actually seen in the project.This helps if
projects uses as much targets as current module (like in
precisePlatformsHmpp), but fails if it uses more targets than the
current module (like in precisePlatformsWithUnrelatedModuleHmppp)

The upcoming commits will fix that issue
2021-01-15 11:12:45 +03:00
Mads Ager
250cc1dc92 [JVM] Never treat arguments to methods as locals that can be removed.
Fixes KT-44347
2021-01-15 10:33:11 +03:00
Sergey Bogolepov
ada51509c4 Test caches for linux_x64 on Linux host. 2021-01-15 13:41:15 +07:00
Sergey Bogolepov
ed18fcdf28 Use target-specific cache control in tests 2021-01-15 13:41:15 +07:00
Sergey Bogolepov
2dabfbc613 Bump Native version.
The new one has `cacheableTargets` property
in konan.properties that is now required
for native caches support in Gradle.
2021-01-15 13:41:15 +07:00
Sergey Bogolepov
092020577c More precise native cache control.
Introduce `kotlin.native.cacheKind.$targetName`
that allows to control cache kind on per target basis.
2021-01-15 13:41:14 +07:00
Nikolay Krasko
d017e1c2ce Add protection for master branch in VCS settings 2021-01-14 21:24:49 +03:00
Nikolay Krasko
a0d42b5da6 Build: Download ktor from maven central (KTI-445)
#KTI-445 Fixed
2021-01-14 21:24:48 +03:00
Nikolay Krasko
0a1e4fd7d7 Download ktor from maven central in wizard project 2021-01-14 21:24:47 +03:00
Margarita Bobova
ae67bb4565 Add changelog for 1.4.30-M1 2021-01-14 21:19:09 +03:00
Kevin Bierhoff
c1360c5a7a Uast: resolve reified callees from classpath (#4013, KT-41279) 2021-01-14 20:29:03 +03:00
Pavel Kirpichenkov
c0dd731818 Load JVM built-ins in IDE from module dependencies
Fix built-ins for JVM platform and make them consistent
with module's dependency on standard library. Changes
don't affect non-JVM platforms.

Previously all built-ins in IDE were loaded from classloader
and were based on the same pre-serialized .kotlin_builtins files.
This approach is generally not correct as built-in declarations
differ for different platforms, but it had been working for a while
without immediately observalble effects (see KT-33233 for more info).
After changes in standard library JvmBuiltins started producing
false errors (see KT-39728).

To fix this, JVM built-ins in IDE now utilize the same technique as
applied in CLI: using dependency on standard library as a module
for built-ins instead of artificial module that considers only
.kotlin_builtins.

Change summary:
- Provide JvmBuiltins with kind FROM_DEPENDENCIES
  for all modules with stdlib dependency in IDE
- Add JvmBuiltinsPackageFragmentProvider to JVM-ish module resolvers
  (JVM and Composite with JVM platform) to support their use as
  built-ins module
- Create KotlinBuiltInsMetadataIndex file index for tracking libraries
  containing .kotlin_builtins to support JvmBuiltinsPackageFragmentProvider
- Create KotlinStdlibIndex file index for tracking kotlin-stdlib(-common),
  which looks for "Kotlin-Runtime-Component" manifest attribute
- Add caching service to track LibraryInfo for kotlin-stdlib(-common)
- Put LibraryInfo for kotlin-stdlib(-common) alongside SDKs
  due to the need to resolve that modules in BuiltInsCache
- Update BuiltInsCache to separate JvmBuiltins by module's dependency
  on stdlib and JDK
- Make platform of KotlinSDK common instead of JVM
- Set built-ins module lazily in IDE

^KT-33233 Verification Pending
2021-01-14 17:28:15 +03:00
Dmitry Savvinov
1479c7a270 Minor: load FALLBACK built-ins in JvmPlatformAnalyzerServices
It doesn't matter because this built-ins instance will be used only to
get names of default imports, so nothing can be resolved to those
built-ins => no diagnostics will be reported
2021-01-14 17:28:15 +03:00
Pavel Kirpichenkov
ba4cc4e075 Minor: cleanup 2021-01-14 17:28:14 +03:00
Pavel Kirpichenkov
b9d5c1bc39 Move KotlinSdk to idea-analysis module 2021-01-14 17:28:14 +03:00
Pavel Kirpichenkov
2df4d26b37 Built-ins in IDE: update tests
KT-33233
2021-01-14 17:28:14 +03:00
Dmitry Savvinov
d6c27608ac Minor: remove effectively unused test runner 2021-01-14 17:28:14 +03:00
Vyacheslav Karpukhin
71c71d8619 AndroidDependencyResolver: compatibility with AGP 7 2021-01-14 14:02:28 +01:00
Stanislav Erokhin
c1722350b6 Add constructors to KtScope
- KtClassLikeSymbol.primaryConstructor was removed
- Constructors were removed from getCallableMembers because
constructors has no name (or special name `<init>`) and previous
implementation was incorrect
- KtScope.getAllSymbols returns constructors as before. Before it was
like this because of the incorrect implementation of getCallableMembers
- getConstructors has sence only for class scope,
for the rest cases it is empty
2021-01-14 12:12:28 +01:00
Stanislav Erokhin
c5229291be Add dispatchReceiver and extensionReceiver to relevant KtSymbols 2021-01-14 12:12:27 +01:00
Stanislav Erokhin
96b6efd401 Add type parameters to the KtConstructorSymbol
Yes, for kotlin classes there are not allowed. But unfortunately
they are for java classes
2021-01-14 12:12:27 +01:00
Stanislav Erokhin
732a997479 Use Variance instead of custom class in KtTypeArgumentWithVariance 2021-01-14 12:12:27 +01:00
Stanislav Erokhin
f6bf2f6b7b Add variance and isReified into KtTypeParameterSymbol 2021-01-14 12:12:27 +01:00
Stanislav Erokhin
c17eee0085 Add data/inline/fun/isExternal flags to KtClassLikeSymbol 2021-01-14 12:12:26 +01:00
Stanislav Erokhin
7e4ba1a062 Remove unused Unknown modality from KtSymbolWithModality. 2021-01-14 12:12:26 +01:00
Stanislav Erokhin
e1e096b4ea Add PRIVATE_TO_THIS visibility to KtSymbolWithVisibility
This visibility is used for some cases where it isn't allowed to access
to private members of the object from other instances of the same object
because of the type parameter variance.

For almost all clients this visibility is the same as PRIVATE
2021-01-14 12:12:26 +01:00
Stanislav Erokhin
d50a5e7517 Add ConstantValueKind to KtSimpleConstantValue 2021-01-14 12:12:25 +01:00
Stanislav Erokhin
d24331955e Rename FirConstKind to ConstantValueKind and move it to compiler.common 2021-01-14 12:12:25 +01:00
Andrei Klunnyi
eed27906e3 KT-44043 [Sealed interfaces]: tests
So far, quick-fix tests infrastructure neither supports the check
for multiple files (several .before/.after pairs) nor multi module
structure. Provided tests are quite limited yet allow to make sure that
the fix in question appears in expected context and get activated.

^KT-44043 fixed
2021-01-14 10:25:34 +00:00
Andrei Klunnyi
43cc022613 KT-44043 [Sealed interfaces]: quickfix for nested -> to another file 2021-01-14 10:25:33 +00:00
Andrei Klunnyi
da98fc4b07 KT-44043 [Sealed interfaces]: quickfix for nested -> to upper level 2021-01-14 10:25:33 +00:00
Andrei Klunnyi
521bebee0f KT-44043 [Sealed interfaces]: quickfix for top level abstractions 2021-01-14 10:25:32 +00:00
Alexander Udalov
a6b51da308 Fix compilation in the case of JDK_16 pointing to JDK 1.8 2021-01-13 21:47:23 +01:00
Alexander Udalov
3be62dfc89 Build: enable -Werror in stdlib/core/compiler/plugins modules
Exclude modules where there are still warnings in an explicitly declared
variable `tasksWithWarnings`.

Also remove "-progressive" from compiler arguments in modules which are
built with non-latest language version, as the warning about that leads
to an error with -Werror.
2021-01-13 19:34:24 +01:00
Alexander Udalov
cc90ff78fd Build: output build time for tasks with --info
To minimize the amount of output during project build, to make it more
comfortable to work with the project in the terminal.
2021-01-13 19:34:24 +01:00
Alexander Udalov
07ce991b3f Build: minor, remove extra newlines in log 2021-01-13 19:34:24 +01:00
Alexander Udalov
2a7a297399 Suppress "runtime JAR files version mismatch" warnings in some plugins 2021-01-13 19:34:24 +01:00
Alexander Udalov
0d8f909bda Use ObsoleteTestInfrastructure instead of Deprecated in black box tests 2021-01-13 19:34:24 +01:00
Alexander Udalov
221f44da5f Fix warnings in stdlib/compiler/plugins/test code 2021-01-13 19:18:20 +01:00
Alexander Udalov
b3d85e656e Fix warnings after update to 202 platform
#KT-44069 Fixed
2021-01-13 19:17:22 +01:00
Alexander Udalov
ee7691f1ad Fix IntArrayList deprecation warning in JvmDependenciesIndexImpl
Copy relevant parts of deprecated IntelliJ's IntArrayList to a new util
class. Also fix some minor IDE inspections.
2021-01-13 19:17:21 +01:00
Alexander Udalov
8ae19f5cd7 Fix deprecated Interner/StringInterner usages after update to 202 2021-01-13 19:17:21 +01:00
Alexander Udalov
f8c2f4a8d0 Fix incorrect code in AbstractJspecifyAnnotationsTest
There was a warning on line 78
(`diagnosticsToJspecifyMarksMap[diagnostic.name]`) which unconvered that
the map wasn't used in the same way in both call sites.
2021-01-13 19:17:21 +01:00
Alexander Udalov
d101f1b3a6 Minor, fix compiler warnings in kotlin-serialization-compiler 2021-01-13 19:17:21 +01:00
Alexander Udalov
e0363788f4 Remove some remaining tests on old coroutines 2021-01-13 19:16:31 +01:00
Mikhail Glukhikh
7953974f3d [FIR] Make WRONG_IMPLIES_CONDITION warning instead of error 2021-01-13 18:14:26 +03:00
Simon Ogorodnik
7c8a67b20b Make useFir build property set -Xuse-fir flag 2021-01-13 18:14:21 +03:00
sebastian.sellmair
bfbb6afee5 Add sourcesJar from metadata target to root multiplatform publication
^KT-44298 fixed
2021-01-13 15:07:35 +00:00
Ivan Gavrilovic
dfdd107fc0 Update KAPT stubs for tests
Update expected outputs so they match
the new sorting rules.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic
3b2986f069 Apply consistent sorting for elements from the same position
There could be multiple elements originating from the same
position in the source file, so make sure to use name+desc to
sort those.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic
ad8517c19a Add tests from the reverted commit
To ensure deterministic build outputs.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic
ecc0eee3cf KT-44130: Sort fields and methods in generated stubs
Use the position in the source file if possible, and
only if the members are coming from other source files,
use their name and descriptor. This is necessary in order
to ensure deterministic output in clean and incremental
runs, while preserving the order of members in the sources.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic
a320152a03 Revert "Sort class members to ensure deterministic builds"
This reverts commit 4bf63a9539.
2021-01-13 22:49:09 +09:00
Bingran
77f8c1e58f Improve cacheability test coverage on kotlin compile, kapt tasks
This PR makes sure we have following cases covered for :compileKotlin,
:kaptKotlin, :kaptGenerateStubsKotlin tasks.

1. incremental change + input relocated
2. incremental change + input not relocated
2021-01-13 12:17:14 +03:00
Ivan Gavrilovic
1c8a25c106 KT-44020: Rename KAPT configuration used as task property
This is so AGP does not try to apply AndroidX substitution
to dependencies found in the annotation processor classpath.
AGP does this by checking if the configuration name starts
with "kapt".

Test: Kapt3Android42IT
2021-01-13 16:25:57 +09:00
Zalim Bashorov
47c4197098 [JS old] Revert fix made for KT-44221 in ab753625
And mute the test for old BE.

#KT-44221 Open
2021-01-13 01:22:17 +03:00
Alexander Udalov
0d6c5dd2bc Fix incorrect generation of Ant task tests, restore tests 2021-01-12 22:18:32 +01:00
Dmitriy Novozhilov
0e62cd9998 Regenerate tests 2021-01-12 18:35:41 +03:00
Dmitriy Novozhilov
e3066a166e [Test] Migrate AbstractFirBlackBoxCodegenTest to new infrastructure 2021-01-12 18:35:40 +03:00
Dmitriy Novozhilov
af5a635f85 [Test] Ignore error diagnostics from FIR in some BB tests 2021-01-12 18:35:39 +03:00
Dmitriy Novozhilov
2eeed1281c [Test] Mute failing FIR BB tests related to MPP 2021-01-12 18:35:37 +03:00
Dmitriy Novozhilov
5329a6ce8e [Test] Properly dispose class loader for running BB tests 2021-01-12 18:35:36 +03:00
Dmitriy Novozhilov
e6fd74f368 [Test] Add ability to remove default directives in test configuration 2021-01-12 18:35:35 +03:00
Dmitriy Novozhilov
e3c7bd5f85 [Test] Migrate AbstractIrBlackBoxCodegenTest to new infrastructure 2021-01-12 18:35:34 +03:00
Dmitriy Novozhilov
f1a2e66ba4 [Test] Setup proper jvm target for kotlinClassImplementsJavaInterface test 2021-01-12 18:35:33 +03:00
Dmitriy Novozhilov
93ce37319a [Test] Drop BlackBoxCodegenTestGenerated from :compiler:tests-different:jdk 2021-01-12 18:35:32 +03:00
Dmitriy Novozhilov
85c87f7df9 [Test] Migrate AbstractBlackBoxCodegenTest to new infrastructure 2021-01-12 18:35:30 +03:00
Dmitriy Novozhilov
f01122d8dc [Test] Fix module names according to MPP module conventions in test data 2021-01-12 18:35:29 +03:00
Dmitriy Novozhilov
0608c50e27 [Test] Properly configure dependencies for common modules in ModuleStructureExtractor 2021-01-12 18:35:28 +03:00
Dmitriy Novozhilov
285ccf7583 [Test] Don't generate JVM BB tests for expect-actual linker
This feature is supported only on JS backend so those tests on JVM
  are meaningless. Also those tests had passed on jvm because of
  old codegen tests didn't use `MODULE` directive and analyze all
  files in tests in single module
2021-01-12 18:35:27 +03:00
Dmitriy Novozhilov
3a41f1e435 [Test] Filter out support module with coroutine helpers from module deps
In old tests coroutine helpers was added as separate module named `support`
  instead of additional files for current module.
So to safe compatibility with old testdata we need to filter this dependency
2021-01-12 18:35:26 +03:00
Dmitriy Novozhilov
065255adbe [Test] Support friend modules in new test infrastructure 2021-01-12 18:35:24 +03:00
Dmitriy Novozhilov
7e92fb8eb9 [Test] Remove redundant empty IGNORE_BACKEND directive 2021-01-12 18:35:23 +03:00
Dmitriy Novozhilov
726184eda9 [Test] Add @JvmMultifileClass to coroutine helpers files
This is needed to keep compatibility with old format, when all those
  helpers were generated dynamically on test run in one file, so
  you can reference helpers methods from java code just importing
  `helpers.CoroutineUtilKt`
2021-01-12 18:35:22 +03:00
Dmitriy Novozhilov
9fd2800594 [Test] Support KOTLIN_CONFIGURATION_FLAGS directive in new tests 2021-01-12 18:35:20 +03:00
Dmitriy Novozhilov
e0cd830a0e [Test] Drop codegen tests for experimental coroutines
Experimental coroutines was deprecated in Kotlin 1.3,
  so since Kotlin 1.5 we don't support (and don't test) them
2021-01-12 18:35:18 +03:00
Dmitriy Novozhilov
d547ce7c42 [Test] Save TargetBackend instead of BackendKind in TestModule 2021-01-12 18:35:17 +03:00
Dmitriy Novozhilov
3c2079c926 [Test] Compute target backend in test generator automatically using reflection 2021-01-12 18:35:16 +03:00
Dmitriy Novozhilov
9378d1ff31 [Test] Add nullability annotations on InTextDirectivesUtils methods 2021-01-12 18:35:15 +03:00
fjjohnchen
49f2ac3545 KT-43818:NPM Dependencies already resolved and installed in Android Studio resolve 2021-01-12 17:24:05 +03:00
Dmitriy Novozhilov
5382e68180 [Test] Properly delete temporary directories after test run 2021-01-12 16:51:33 +03:00
Dmitriy Novozhilov
ce44a2a7e4 [Test] Inject info about test (class and method names, tags) to TestServices 2021-01-12 16:51:32 +03:00
Dmitriy Novozhilov
84eb74e194 [Test] Fix bug with FirCfgDumpHandler which didn't start at all
Flag `alreadyDumped` is needed due to the fact that CFG dumper is not
  prepared to multimodule tests yet, so in such test this handler
  dumps only first module to .dot file.
I forgot to switch it to `true` when it was introduced, so this checker
  actually, didn't handle anything at all
2021-01-12 16:51:31 +03:00
Dmitriy Novozhilov
13f6b37ae7 [Test] Drop duplicating Constructor typealias 2021-01-12 16:51:29 +03:00
Dmitriy Novozhilov
af94bcebea [IDE] Propagate KotlinFacetSettings version and completely drop isReleaseCoroutines flag
Also this commit removes number of tests related to support
  experimental coroutines
2021-01-12 16:47:55 +03:00
Dmitriy Novozhilov
e991c9d476 [CLI] Drop CommonCompilerArguments.coroutinesState 2021-01-12 16:47:54 +03:00
Dmitriy Novozhilov
df3b12e13b [FE] Drop coroutinesState from build configurations plugins 2021-01-12 16:47:51 +03:00
Dmitriy Novozhilov
7f4a925b85 [FE] Drop isReleaseCoroutines flag from LanguageSettingsProvider 2021-01-12 16:47:50 +03:00
Dmitriy Novozhilov
a8b65bc673 [IDE] Drop coroutines KotlinFacetSettings.coroutineSupport 2021-01-12 16:47:48 +03:00
Dmitriy Novozhilov
69e1d60b08 [IDE] Drop coroutines combo box from compiler configuration tab 2021-01-12 16:47:47 +03:00
Alexander Udalov
0fef890d1a Minor refactoring in CompileEnvironmentUtil 2021-01-12 14:45:06 +01:00
scaventz
4374438ff1 Kotlinc: Exclude module-info.class from resulting jar when "-include-runtime" is specified 2021-01-12 14:45:06 +01:00
Alexander Udalov
742fef9042 Rewrite generator for OperationsMapGenerated
Do not generate operations as lambdas; instead use `when` over
strings/enums, which is generated to tableswitch in the bytecode.

This reduces the proguarded compiler jar size by ~0.57%.

 #KT-23565 Fixed
2021-01-12 14:38:41 +01:00
Ilya Goncharov
df75cddcb8 [Gradle, JS] Add possibility to set jvmArgs for dce process
^KT-44104 fixed
2021-01-12 15:54:28 +03:00
Svyatoslav Kuzmich
ab753625fe [JS Legacy] Fix returning Char from suspend functions (KT-44221)
Mark translated expression with a proper type, like we do with
non-suspending calls, to coerce it later.
2021-01-12 15:42:31 +03:00
Svyatoslav Kuzmich
2d88ff6fb2 [JS IR] Fix unsgined integer default arguemtns (KT-44180)
Const lowering didn't exprect null constants with unsigned number
types and crashed with NPE. This commit fixes that.
2021-01-12 15:42:31 +03:00
scaventz
0110b4e4b4 Ant: Add support for fork-mode
#KT-44293
2021-01-12 13:03:27 +01:00
Kris Hall
ee952db1a2 Added samples for String.replace() function 2021-01-12 14:59:43 +03:00
Iaroslav Postovalov
77180a5b13 [JVM IR] Make file classes with all private members package-private 2021-01-12 12:47:59 +01:00
Mikhail Zarechenskiy
032c64669c Show pre-released 1.5 version in configuration preferences
^KT-44116 Fixed
2021-01-12 14:15:30 +03:00
Jinseong Jeon
d53354057a FIR: build functional type for SAM with receiver properly 2021-01-12 10:33:55 +03:00
pyos
f618763250 FIR: implement -Xfriend-paths 2021-01-12 10:33:45 +03:00
Ilya Chernikov
bd708da82c Do not check script discovery file extension
it is optional (so far), so this check was incorrect.
#KT-44117 fixed
2021-01-11 19:50:22 +01:00
Denis.Zharkov
0e3aaceb16 Fix ultra light structure for @JvmRecord classes 2021-01-11 20:51:40 +03:00
Kristoffer Andersen
43b61a618d [IR+Tests] Improve Local Function Debugging Experience
This change improves the debugging experience around local functions
on the IR backend. The changes include moving old
checkLocalVariablesTable (cLVT) tests to the new stepping/local variable
infrastructure in order to refine the tests and further define the
behavior of the two JVM backends, and their differences.

The primary ported test case is cLVT/localFun.kt that documents the
discrepancy in implementation strategy for local functions on the two
backends. The old backend implements local functions as lambdas
assigned to a local variable while the IR backend lifts them out as
static funtions on the surrounding class. The discrepancies and their
consequences are documented in bytecodeListing, idea-stepping,
localVariableTable and debugStepping tests.

The only _code change_ is disabling the captured variable name
mangling for captured variables on the IR backend. Captured variables
are passed as arguments to the static function, so in the debugger,
they really just are local variables. For them to show properly in the
debugger and be detectable by evaluate expression, they simply need no
mangling.

Finally, this change cleans 3 redundant cLVT tests, copyFunction.kt
and destructuringInlineLambda.kt and destructuringInFor.kt, that are
all covered in the new suite. The stepping behavior needs to be made
precise around for loops, but that is an entirely seperate issue.
2021-01-11 18:21:23 +01:00
Alexander Udalov
c2d7b69e5f Remove bytecode text test kt15806.kt
It's not correct to expect that the backend generates the `when` in this
test as tableswitch because there are only two branches. JVM IR has a
cutoff in the when optimization and generates `when`s with fewer than 3
branches as if-else chains, which is probably better. Note that there's
also a corresponding box test in when/enumOptimization/, so the backend
behavior is still tested.
2021-01-11 17:27:03 +01:00
Alexander Udalov
92f3b759c0 Fix codegen test data for genericTypeWithNothing.kt
#KT-18367 Fixed

Co-authored-by: Zalim Bashorov <zalim.bashorov@jetbrains.com>
2021-01-11 17:20:55 +01:00
Mikhail Glukhikh
0c0dbd6245 [FIR] Perform more accurate pre-check of candidate receiver type 2021-01-11 17:57:04 +03:00
Mikhail Glukhikh
4e4293b609 [FIR] Introduce separate getTopLevelFunction/PropertySymbols 2021-01-11 17:52:51 +03:00
Mikhail Glukhikh
fd99f2b2cf FirDefaultStarImportingScope: improve measurements 2021-01-11 17:52:05 +03:00
Mikhail Glukhikh
33037fd885 FirAbstractImportingScope: minor simplification 2021-01-11 17:52:00 +03:00
Mikhail Glukhikh
3f5e515bd6 Fix broken ABI in DiagnosticFactory #KT-44145 Fixed 2021-01-11 17:43:35 +03:00
Dmitry Petrov
b02a9846d0 IR KT-44233 support flexible nullability in IrTypeSystemContext
^KT-44233 Fixed Target versions 1.5-M1
2021-01-11 17:33:50 +03:00
Jinseong Jeon
093f62caac FIR2IR: check non-parameter Unit type for adapted callable references 2021-01-11 16:23:00 +03:00
Mikhail Galanin
4d3ec301c0 Misprint: "val or val" instead of "val or var" 2021-01-11 14:07:34 +01:00
Alexander Udalov
12078666c2 Add warning if both -Xuse-ir and -Xuse-old-backend are passed 2021-01-11 12:57:03 +01:00
Alexander Udalov
cb3191769d Enable JVM IR by default if language version is >= 1.5
#KT-44021 Fixed
2021-01-11 12:47:54 +01:00
Alexander Udalov
22d0e5eb65 Rename -Xno-use-ir -> -Xuse-old-backend, add Gradle option
As soon as JVM IR is enabled by default (in language version 1.5), use
the CLI argument `-Xuse-old-backend` or Gradle option `useOldBackend` to
switch to the old JVM backend.
2021-01-11 12:47:54 +01:00
Alexander Udalov
b8fb1ce83c Fix Java 9 module tests for many JDKs
Module 'oracle.desktop' is not guaranteed to be present in JDK. Also,
its usage in these tests doesn't check anything new that isn't already
checked by usages of jdk.net and jdk.httpserver.
2021-01-11 12:39:03 +01:00
Alexander Udalov
b8d7b39e2c Extract Java 9 module test about irrelevant jars in JDK home
Skip it on JDKs where ant-javafx.jar is not present.
2021-01-11 12:39:03 +01:00
Alexander Udalov
9fd250b2b1 Exclude libraries/stdlib/wasm/build in CodeConformanceTest
Similarly to libraries/stdlib/js-ir/build, there are some copyrights
produced during the build, which should not be checked in this test.
2021-01-11 12:27:26 +01:00
Dmitriy Novozhilov
1e67702128 [Test] Introduce opt in @ObsoleteTestInfrastructure for migrating tests to new infrastructure 2021-01-11 14:19:10 +03:00
Mads Ager
dfc86feecd [IR] Extend test coverage for smart cast handling. 2021-01-11 12:01:48 +03:00
Mads Ager
6fc0de39c2 [PSI2IR] Propagate smart cast information for variable loads.
This gives us more precise type information and can enable backend
optimizations. This was motivated by when expressions not compiled
to table switches in the JVM_IR backend.

Fixed KT-36845.
2021-01-11 12:01:47 +03:00
Steven Schäfer
98a9e142e8 JVM IR: Fix visibility of protected/private functions with reified types 2021-01-08 16:35:31 +01:00
Steven Schäfer
dad10e94aa JVM IR: Mangle names of $$forInline functions 2021-01-08 16:30:18 +01:00
Jinseong Jeon
7cc06489dd IR: move enum value array initialization out of <clinit>
#KT-44192 Fixed
2021-01-07 23:00:37 +01:00
Jinseong Jeon
f8f08e8134 IR: add a test about maximum number of constants in an enum class 2021-01-07 23:00:37 +01:00
Ilya Chernikov
0a8858fbfe [minor] document -compiler-path option for kotlin runner 2021-01-07 10:37:23 +01:00
Ilya Chernikov
979144157f Implement -howtorun option for kotlin runner
Implement -no-stdlib argument support in kotlin runner

#KT-43534 fixed
2021-01-07 10:37:22 +01:00
Ilya Chernikov
edc730f70b Implement -no-stdlib argument support in kotlin runner
#KT-43294 fixed
2021-01-07 10:37:22 +01:00
Ilya Chernikov
d2ecc1e361 Implement -X arguments passing from kotlin runner to compiler 2021-01-07 10:37:22 +01:00
Ilya Chernikov
9a7d1948a7 Implement support for -Xdefault-script-extension cli option 2021-01-07 10:37:22 +01:00
Ilya Chernikov
534342a566 [minor] use new kotlin.io.path API in tests 2021-01-07 10:37:21 +01:00
Ilya Chernikov
1bd6cc823c Fix provided properties access generation
The presense of accessors in the descriptor led to the wrong code
generation in some cases.
#KT-43176 fixed
2021-01-07 10:37:20 +01:00
Ilya Chernikov
ffdcda8914 [build] Fix JDK detection on Mac OS X 11 (Big Sur)
#KTI-443 fixed
2021-01-07 10:37:19 +01:00
Kristoffer Andersen
77836f1aa9 [Test] Port checkVariableTable suspend lambda tests
Reveals discrepancy in LVT presence on lambda implementations on the
old and new backend.

The generated code in the constructors of Suspend Lambda objects is
identical, but the IR backend generates an LVT with the constructor
parameters.

The user has to be very insistent to see this ("for step into" +
disabling "Show only kotlin variables"), but it is an observable
difference.
2021-01-06 22:33:37 +01:00
Alexander Udalov
82abc80215 Move old changelogs to docs/changelogs/ 2021-01-06 21:53:12 +01:00
Nelson Osacky
db3bebb531 Add Revved up by Gradle Enterprise badge to Readme 2021-01-06 20:37:45 +03:00
Alexander Udalov
41c4693ebf Build: remove obsolete -Xir-binary-with-stable-abi
It's no longer needed after eef06cded3 and 3e3ffee2a0.
2021-01-04 18:10:43 +01:00
Alexander Udalov
ee2ae0c471 JVM IR: remove obsolete -Xir-check-local-names
This flag was added a long time ago, at the time when we weren't sure if
we were going to keep the naming of local and anonymous classes
completely equal to the naming in the old backend. Now that we've
decided that we won't keep it equal and there are a lot of differences
already, it's not useful anymore.
2021-01-04 12:13:13 +01:00
Alexander Udalov
acd29481bd Regenerate sources of builtins and stdlib 2021-01-03 22:31:06 +01:00
Alexander Udalov
ed9a0e514d Regenerate tests and fir-tree 2021-01-03 14:53:41 +01:00
Shagen Ogandzhanian
96de9144de [JS IR] Generate stub for exported functions with default params
see https://youtrack.jetbrains.com/issue/KT-43407
2020-12-31 20:21:21 +01:00
Alexander Udalov
bf3f6594d5 IR: do not lose $default function annotations when generating calls
Losing an annotation like `JvmName` resulted in the incorrect bytecode
generated in the JVM IR backend.

 #KT-44160 Fixed
2020-12-31 18:36:24 +01:00
Alexander Udalov
ac325f6111 IR: add toString for IrBased descriptors
To help in diagnosing issues like KT-44160.
2020-12-31 18:36:24 +01:00
Ilya Gorbunov
3c37bbaf64 Duration: normalize to avoid negative zeroes (KT-44168)
The current comparison method of inline classes makes
durations of positive and negative zeroes non-equal.
To avoid that, normalize the duration value upon construction
preventing negative zero being stored.
2020-12-31 19:44:39 +03:00
Ilya Gorbunov
ae6f10df3b Duration: reject NaN duration values (KT-44168) 2020-12-31 19:44:10 +03:00
Ilya Gorbunov
1d40ed39d0 KotlinVersion: Advance snapshot version 1.4.255 -> 1.5.255
KTI-421
2020-12-31 19:20:29 +03:00
Nikolay Krasko
133e39b783 Advance snapshot version 1.4.255 -> 1.5.255 (KTI-421)
#KTI-421 Fixed
2020-12-31 15:49:06 +03:00
Abduqodiri Qurbonzoda
662787b12b Straighten Char-to-code and Char-to-digit conversions out #KT-23451 2020-12-31 12:07:41 +03:00
Ilya Gorbunov
79e426270c Rename Random.Default serialization surrogate object (KT-25571) 2020-12-31 06:57:17 +03:00
Iaroslav Postovalov
00506a75d3 Make Random implementations serializable (KT-25571)
Make Random.Default, XorWowRandom, and wrapper classes for JDK Random implement Serializable interface.

Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
2020-12-31 04:10:28 +03:00
Svyatoslav Kuzmich
38967f208e [Wasm] Remove unused WasmI1 type 2020-12-30 19:29:11 +03:00
Svyatoslav Kuzmich
22239e2733 [Wasm] Remove unused super class field in type info 2020-12-30 19:29:11 +03:00
Svyatoslav Kuzmich
785c947782 [Wasm] Improve class type checks
Use wasm ref.test instad of manual type info linked list traversal
2020-12-30 19:29:10 +03:00
Svyatoslav Kuzmich
b6ad1584c9 [Wasm] Improve interface method dispatch
- Use typed Wasm tables for each interface method to avoid runtime
  function type check

- Use linear search by implemented interface rather than by individual
  virtual function signature
2020-12-30 19:29:10 +03:00
Shagen Ogandzhanian
e7dc199ad7 Init enum entries whenever we access companion object or accessing valueOf
Fixes https://youtrack.jetbrains.com/issue/KT-43987
Fixes https://youtrack.jetbrains.com/issue/KT-43989
2020-12-30 14:54:34 +01:00
Dmitry Petrov
7fa04afda2 JVM_IR KT-32115 fix $$delegatedProperties initialization in enum 2020-12-30 15:56:18 +03:00
Dmitriy Novozhilov
3e3ffee2a0 Advance bootstrap to 1.5.0-dev-1141 2020-12-30 11:37:37 +03:00
Dmitry Petrov
81e00ca371 JVM box tests for KT-30402 2020-12-30 10:57:46 +03:00
Abduqodiri Qurbonzoda
1314adb6f7 Locale-agnostic case conversions by default #KT-43023 2020-12-30 10:08:25 +03:00
Ilmir Usmanov
80289e4a3f IC Mangling: Generate inline class literal instead of underlying type
literal in annotations.
 #KT-30280 Fixed
2020-12-30 03:31:08 +01:00
Shagen Ogandzhanian
55a5695fc0 [JS] Forbid export of interfaces
With the only exception of external interfaces.

See https://youtrack.jetbrains.com/issue/KT-44099
2020-12-29 20:43:57 +01:00
Mikhail Glukhikh
a6534c4653 [FIR] Fix completion of synthetic call arguments 2020-12-29 17:48:15 +03:00
Denis.Zharkov
b7a382f097 Revert "Fix ISE when inferring type of a property that delegates to itself"
This reverts commit 1a03d5c93e.

The reason is that original change seems to be breaking (see KT-44137).

^KT-44137 Relates
^KT-37796 Open
2020-12-29 17:41:12 +03:00
Roman Artemev
826985450e Add test for KT-42036 2020-12-29 16:27:31 +03:00
Victor Petukhov
30a5eee481 Don't approximate abbreviation during substitution it as it can't be projected at top-level
^KT-42036 Fixed
2020-12-29 16:08:38 +03:00
Dmitriy Novozhilov
009add2b41 [Test] Report difference in test data file in a first place 2020-12-29 16:06:48 +03:00
Dmitriy Novozhilov
0af1c81d62 Revert "Probably fix issue with creating module descriptor for SDK twice"
This reverts commit 92adccde

Actually this commit didn't fix anything so it can be reverted
2020-12-29 14:16:48 +03:00
Ilya Kirillov
6230a7861a Wizard: do not print plugin repositories in build files if all of them are default ones
Also, use space dev repo for kotlin dev plugins
2020-12-29 11:50:36 +01:00
Mikhail Glukhikh
74077bf6d2 [FIR] Don't attempt to process interface constructors 2020-12-29 12:18:03 +03:00
Yunir Salimzyanov
6a6e2a1c77 Set custom timeout for flaky muted tests synchronization requests
Cause: Teamcity requests processes for average 80 seconds
2020-12-29 12:16:40 +03:00
Victor Petukhov
27dd9484ba Add missed type arguments for a star projection into the enhanced type arguments list 2020-12-29 11:31:16 +03:00
Zalim Bashorov
531ba4bb48 [IR] Narrow usage scope of ObsoleteDescriptorBasedAPI in CheckIrElementVisitor 2020-12-28 18:53:55 +03:00
Zalim Bashorov
02849edc22 [IR] Make descriptor parameter optional for IrFileSymbolImpl and IrExternalPackageFragmentSymbolImpl
Remove DescriptorlessIrFileSymbol and use IrFileSymbolImpl instead.
2020-12-28 18:53:54 +03:00
Zalim Bashorov
14254ceb0b [IR] Remove no longer needed usages of ObsoleteDescriptorBasedAPI 2020-12-28 18:53:54 +03:00
Zalim Bashorov
0372dae3ce [JS scripting] Remove usages of descriptor based APIs and proper support for callable references 2020-12-28 18:53:53 +03:00
Zalim Bashorov
9ac7c3d8bc [Wasm] Remove usage of descriptor based API usage from WasmSharedVariablesManager 2020-12-28 18:53:53 +03:00
Zalim Bashorov
c569ec1bad [IR] Add dumpKotlinLike for IrType and IrTypeArgument 2020-12-28 18:53:52 +03:00
Alexander Udalov
77a9d14f93 Capitalize/decapitalize only ASCII characters across project
Use {de,}capitalizeAsciiOnly and to{Lower,Upper}CaseAsciiOnly where
possible, and stdlib's functions with Locale.US everywhere else.

Otherwise, if the default system locale is Turkish, the capital latin
letter "I" is transformed in toLowerCase to "ı" (see
66bc142f92/libraries/stdlib/jvm/test/text/StringJVMTest.kt (L119)),
which for example breaks the codegen for `intArrayOf` in
KT-25400/KT-43405.

Similarly, lower case latin letter "i" is transformed to "İ".

 #KT-13631 Fixed
 #KT-25400 Fixed
 #KT-43405 Fixed
2020-12-28 16:10:30 +01:00
Dmitry Petrov
5d4b0b19d4 JVM_IR KT-13213 split string constants into parts of acceptable length 2020-12-28 16:50:29 +03:00
Andrei Klunnyi
3f287d344e KT-43941 [Sealed interfaces]: subclass intention
Restriction for sealed inheritors was relaxed. Instead of being nested
class members now they can be the members of the same module and
package.
2020-12-28 13:45:58 +00:00
Andrei Klunnyi
1cac8b0d61 KT-43941 [Sealed interfaces]: preliminary, J2K 2020-12-28 13:45:57 +00:00
Andrei Klunnyi
86792131cd KT-43941 [Sealed interfaces]: preliminary, code cleanup 2020-12-28 13:45:57 +00:00
Denis.Zharkov
acbf382d04 FIR: Add test on ambiguous vararg
Fix is in the two previous commits
2020-12-28 13:19:23 +03:00
Jinseong Jeon
8c7b23a8dd FIR Java/JVM: avoid plain "Array" comparison 2020-12-28 12:45:51 +03:00
Jinseong Jeon
383de7a9c5 FIR Java: Fix Java override ambiguity with vararg value type
#KT-44066 Fixed
2020-12-28 12:45:51 +03:00
Mikhail Glukhikh
d663f204e5 FIR Java: make method annotations lazy 2020-12-28 12:06:51 +03:00
Mikhail Glukhikh
c8c34ebf17 FIR Java: make constructor annotations lazy 2020-12-28 12:06:45 +03:00
Mikhail Glukhikh
56df95b8e7 FIR Java: make field annotations lazy 2020-12-28 12:06:39 +03:00
Nikolay Krasko
33892f3ddf Make checker tests independent of plugin version (KTI-433) 2020-12-25 22:36:49 +03:00
Nikolay Krasko
f72cec7904 Minor: remove unused methods 2020-12-25 22:36:48 +03:00
Victor Petukhov
37473ad640 Substitute lambda's receiver type during completion including the builder inference stub variables substitution
^KT-42175 Fixed
2020-12-25 21:33:37 +03:00
Svyatoslav Kuzmich
672859d447 [Wasm] Support init blocks in inline classes 2020-12-25 17:00:23 +03:00
Svyatoslav Kuzmich
0945c110bf [JS IR] Support init blocks in inline classes 2020-12-25 17:00:23 +03:00
Victor Petukhov
07b6f0d871 Fix failing tests 2020-12-25 14:29:11 +03:00
Mikhail Glukhikh
0d40fde713 FIR synthetics: make setter subtype check more precise #KT-43347 Fixed 2020-12-25 14:07:28 +03:00
Mikhail Glukhikh
8c8f81330a FIR Java: make value parameter annotations lazy 2020-12-25 14:07:16 +03:00
Mikhail Glukhikh
1239a8629e FIR Java: make type annotations lazy 2020-12-25 14:06:34 +03:00
Mikhail Glukhikh
776c4ba6ca Add test for KT-25489 (to reproduce, turn UL classes OFF) 2020-12-25 14:06:16 +03:00
Yunir Salimzyanov
532124d9a1 Increase timeout for flaky muted tests synchronization requests 2020-12-25 12:28:37 +03:00
Yunir Salimzyanov
f2ecf7f666 Mute MultiModuleHighlightingTest via csv-file 2020-12-25 12:28:36 +03:00
Victor Petukhov
7ed6aae46e Fix tests after rebasing 2020-12-25 11:53:21 +03:00
Victor Petukhov
50a388aec1 Mute wasm tests around builder inference and callable references 2020-12-25 11:53:21 +03:00
Victor Petukhov
0dde5ddd7e Fail calls constraints of which contain uninferred type parameter
^KT-44055 Fixed

It's possible only if there is a callable reference among subcalls which go though the old type inference (and the error for uninferred type parameter wasn't reported)
2020-12-25 11:53:16 +03:00
Victor Petukhov
9afc13f002 Unwrap block expressions to report errors on them about not enough type information
^KT-44055 Fixed
2020-12-25 11:53:15 +03:00
Victor Petukhov
4c56962678 Report errors on callable references which contains postponed type variables in the receiver type 2020-12-25 11:53:15 +03:00
Victor Petukhov
86edc5ca3a Reuse information from already recorder descriptor for some callable references and don't rewrite at slice 2020-12-25 11:53:15 +03:00
Victor Petukhov
1926434b18 Report error about uninferred type parameter for some special call' subcalls 2020-12-25 11:53:14 +03:00
Victor Petukhov
0b472f858b Don't create DONT_CARE type for CR and lambdas within builder inference calls
It leads to leak such type to the back-end. Calls within a builder call should be updated without marking CR and lambdas with DONT_CARE type.

^KT-43845 Fixed
^KT-43956 Fixed
^KT-42622 Fixed
2020-12-25 11:53:14 +03:00
Victor Petukhov
b4d8adeeb4 Don't clean type info for containment operator if the resolution was unsuccessful, but all diagnostics were about only input types and non-strict only input types check was enabled 2020-12-25 11:53:09 +03:00
Victor Petukhov
954c9cecca Compute type for callable references and lambdas inside not null assertion if couldn't get already recorded type 2020-12-25 11:52:59 +03:00
Victor Petukhov
39e579db91 Move tests for builder inference into the corresponding directory 2020-12-25 11:25:39 +03:00
Dmitry Petrov
9b148325fe Minor: regenerate tests 2020-12-25 09:41:06 +03:00
Dmitry Petrov
9715ae88fe Minor: regenerate tests 2020-12-25 09:15:47 +03:00
Zalim Bashorov
03594baa07 [IR] Improve dumpKotlinLike
* Generate a comment for modules.
* Fix printing supertypes for classes.
* Don't fail while printing constructor call if data's parent isn't IrClass
2020-12-24 20:03:24 +03:00
Zalim Bashorov
f7b0f55532 [JS IR test] Add an ability to setup phases to dump after and phases to validate after in box tests using system properties 2020-12-24 20:03:24 +03:00
Zalim Bashorov
ee60a1a431 [IR] Add an ability to change dump strategy using a system property 2020-12-24 20:03:23 +03:00
Zalim Bashorov
274b09cf36 [JS IR] Support generating JS expression from IrComposite
Except the case when it's empty.
2020-12-24 20:03:23 +03:00
Zalim Bashorov
72593e3d30 [JS IR] Revert jsClass_js-ir.kt to not break compatibility with older compiler versions 2020-12-24 20:03:23 +03:00
Zalim Bashorov
d7e3f826bb [JS IR] Generate jsClass function inside the compiler instead of relying on declaration inside stdlib
We want to make its type parameter reified to do it we have to make it inline and non-external.
But we don't want to inline it in call sites and want prevent using it anywhere except places generated by the compiler.
In user code, including stdlib, we should use `K::class.js` instead.
Separately we have to intrinsify `K::class.js` to reduce overhead.
2020-12-24 20:03:23 +03:00
Zalim Bashorov
df6635085b [JS IR] Replace calls with invalid type arguments for type parameters with call to errorCode function from runtime. 2020-12-24 20:03:22 +03:00
Zalim Bashorov
ff77155b5a [JS IR] A type argument of the jsClass intrinsic must be a class (IrClass) 2020-12-24 20:03:22 +03:00
Zalim Bashorov
c1f6a72ae1 [JS IR] Remove inline properties with reified parameters
RemoveInlineFunctionsWithReifiedTypeParametersLowering -> RemoveInlineDeclarationsWithReifiedTypeParametersLowering
2020-12-24 20:03:22 +03:00
Zalim Bashorov
da8dacb495 [JS IR] run RemoveInlineFunctionsWithReifiedTypeParametersLowering earlier
It's required to avoid extracting local classes declarations and leaking some references to inline function internals.
2020-12-24 20:03:21 +03:00
Zalim Bashorov
bc9828f3f3 [JS IR] Generate a key using hashedMangle for all IR declarations in mapToKey
It is required to avoid "key" clashes and failing with ISE.
2020-12-24 20:03:21 +03:00
Zalim Bashorov
7c5ea414b7 [JS IR] Use mappedNames in NameTable only for REPL
And throw exception for unsupported types in mapToKey
2020-12-24 20:03:21 +03:00
Andrei Klunnyi
faa24e3230 KT-44043 Sealed interfaces: 201/203 compatibility fix 2020-12-24 17:50:47 +01:00
Dmitry Petrov
a1574bf50a JVM box tests for KT-30548 2020-12-24 19:35:36 +03:00
Dmitriy Novozhilov
daa6255ab7 Update testdata of PsiCheckerSealedTest after 07b980fe 2020-12-24 17:53:08 +03:00
Roman Golyshev
f00e5b1992 FIR: Check relativeClassName of found class in JavaSymbolProvider
`ClassId` denotes how class is nested; however, you can find
`foo/bar/Outer.Nested` class by `ClassId(foo/bar/Outer/Nested)`. This
will lead to inconsistencies when working with class symbol later

This is also important to `FirQualifierResolverImpl::resolveSymbol`
which detects correct `ClassId` by traversing all symbol qualifiers

We check only `relativeClassName`, because we want to be able to find
classes without package specified

Also, fix test data of resolve tests that have been passing because of
check absence
2020-12-24 14:25:48 +00:00
Ilya Goncharov
2ce51a4c11 [Gradle, JS] Fix tests with decamelizing names
^KT-43237 fixed
2020-12-24 16:35:29 +03:00
Ilya Goncharov
0bd4de65e1 [Gradle, JS] Fix upper case names in js files, decamelize instead
^KT-43237 fixed
2020-12-24 16:35:29 +03:00
Ilmir Usmanov
9c67d8f89e IC Mangling: Correctly mangle functions with generic return type
if the type's parent is inline class.
 #KT-43050 Fixed
 #KT-26130 Fixed
 #KT-32384 Fixed
2020-12-24 14:29:48 +01:00
Andrei Klunnyi
f8cca288ab KT-44075 Sealed interfaces: New Kotlin Class/File menu update
^KT-44075 Fixed
2020-12-24 13:07:52 +00:00
Dmitriy Dolovov
740b8a9aec [Commonizer] Fix computing outer class type arguments 2020-12-24 15:55:36 +03:00
Dmitriy Novozhilov
8bd4e67341 [Test] Drop obsolete FIR tests 2020-12-24 14:58:06 +03:00
Dmitriy Novozhilov
660c438ebe [Test] Migrate tests of foreign annotations to new infrastructure
This commit includes:
- test runners for foreign annotation tests
- minor changes testdata related to changed directives syntax
- dropping tests with javac integration: old javac tests actually ran
    compiler without javac because of bug in configuration, so some
    nullability annotations features are not supported in javac mode.
    It's fine to drop it since javac mode is not fully supported
    by compiler
2020-12-24 14:58:05 +03:00
Dmitriy Novozhilov
ef3d966d53 [Test] Fix dependencies in task [JPS] Generate All Tests 2020-12-24 14:58:04 +03:00
Dmitriy Novozhilov
8689fc43cd [Test] Move java generation utils to :compiler:tests-compiler-utils module 2020-12-24 14:58:02 +03:00
Dmitriy Novozhilov
cb7b1652e7 [Test] Extract MockLibraryUtil to :compiler:tests-compiler-utils
Also provide MockLibraryUtilExt with bridges to MockLibraryUtil
  with JUnit4Assertions
2020-12-24 14:58:01 +03:00
Dmitriy Novozhilov
eadec08937 [Test] Reformat MockLibraryUtil according to code style 2020-12-24 14:57:59 +03:00
Dmitriy Novozhilov
e287742842 [Test] Add ability to provide additional analysis flags in EnvironmentConfigurator 2020-12-24 14:57:58 +03:00
Dmitriy Novozhilov
c4691de72d [Test] Deprecate AbstractDiagnosticsTest in old test infrastructure 2020-12-24 14:57:57 +03:00
Dmitriy Novozhilov
a9f913a97f [Test] Migrate AbstractDiagnosticsWithJdk15Test to new infrastructure 2020-12-24 14:57:56 +03:00
Dmitriy Novozhilov
02fb11a2cd [Test] Fix double reading of module directives 2020-12-24 14:57:55 +03:00
Dmitriy Novozhilov
0e3ed3fee6 [Test] Remove duplicating code from ClassicFrontend2IrConverter 2020-12-24 14:57:53 +03:00
Denis.Zharkov
1a03d5c93e Fix ISE when inferring type of a property that delegates to itself
^KT-37796 Fixed
2020-12-24 14:06:20 +03:00
Denis.Zharkov
cbb8459e4e Fix AE: No receiver found on incomplete code with $-signs
^KT-24158 Fixed
2020-12-24 14:06:20 +03:00
Denis.Zharkov
77d4a46a6b Fix light classes exception occurring on obfuscated Kotlin libraries
^KT-29454 Fixed
2020-12-24 14:06:20 +03:00
Denis.Zharkov
7b9f6c1560 Fix exceptions caused by cyclic dependency between ModuleDescriptor and JvmBuiltIns
^KT-39105 Fixed
^KT-42001 Fixed

See also EA-216604 and EA-211562
2020-12-24 14:06:20 +03:00
Denis.Zharkov
5a8dc00a0d Rename JvmBuiltInsSettings -> JvmBuiltInsCustomizer 2020-12-24 14:06:19 +03:00
Dmitriy Novozhilov
70ae756083 Revert "[Test] Save TargetBackend instead of BackendKind in TestModule"
This reverts commit 29d923d5
2020-12-24 13:57:02 +03:00
Dmitriy Novozhilov
07b980fea0 [FE] Fix error message of SEALED_INHERITOR_IN_DIFFERENT_PACKAGE diagnostic 2020-12-24 13:47:45 +03:00
Dmitriy Novozhilov
29d923d50d [Test] Save TargetBackend instead of BackendKind in TestModule 2020-12-24 13:44:05 +03:00
Dmitriy Novozhilov
70c4bdf32e [FE] Detect recursion when typealias referenced as annotation in its RHS
#KT-14612 Fixed
2020-12-24 13:44:04 +03:00
Dmitry Petrov
d3349197ba Minor: regenerate tests 2020-12-23 21:50:12 +03:00
Dmitry Petrov
4e261cc358 JVM_IR KT-24258 fix NPE message for delegated properties 2020-12-23 21:50:10 +03:00
Dmitry Petrov
ad8bed078f JVM box tests for KT-24193 2020-12-23 21:50:09 +03:00
Dmitry Petrov
a8d848ccbd JVM box tests for KT-23974 2020-12-23 21:50:08 +03:00
Dmitry Petrov
3f7a776fb8 JVM box tests for KT-21092 2020-12-23 21:50:07 +03:00
Dmitry Petrov
0841a6b0ea irText tests for KT-19306 2020-12-23 21:50:06 +03:00
Dmitry Petrov
9f908cdf7c JVM box tests for KT-16752 2020-12-23 21:50:05 +03:00
Ilmir Usmanov
8bfcef415e Do not generate variables for non-generated fields
Use attributes instead of classes.
 #KT-43048 Fixed
2020-12-23 19:45:15 +01:00
Iaroslav Postovalov
8a7bc2ef6f Rename continuation fields according the convention and count them in IR 2020-12-23 19:45:13 +01:00
Iaroslav Postovalov
cd2b05eb00 Discard misc.xml changes 2020-12-23 19:45:11 +01:00
Iaroslav Postovalov
165ba85337 Remove useless OptIn annotation 2020-12-23 19:45:09 +01:00
Iaroslav Postovalov
b13822bb2d Remove unrelated change 2020-12-23 19:45:07 +01:00
Iaroslav Postovalov
6f34f00c61 Do not generate the field for unused parameters in suspend lambdas 2020-12-23 19:45:04 +01:00
Ilmir Usmanov
f49cf2d5ca IC Mangling: correctly mangle inline default functions
#KT-43682 Fixed
2020-12-23 18:13:09 +01:00
Ilya Kirillov
7c9cf45a3f FIR IDE: fix testdata 2020-12-23 17:16:32 +01:00
Ilya Kirillov
b2b364eca6 FIR IDE: resolve fir file to BODY_RESOLVE when it requested by getOrBuildFir 2020-12-23 17:16:30 +01:00
Ilya Kirillov
fa42f9302e FIR IDE: unmute passing test 2020-12-23 17:16:29 +01:00
Ilya Kirillov
ce77903898 FIR IDE: add deadlock checking for read/write resolve locks 2020-12-23 17:16:28 +01:00
Ilya Kirillov
0ec152e457 FIR IDE: fix deadlock in override check
We should not call withFir nestedly as resolving in read action causing deadlocks
2020-12-23 17:16:26 +01:00
Ilya Kirillov
8a17a16ee2 FIR IDE: consider modification in invalid PSI as OOBM 2020-12-23 17:16:25 +01:00
Ilya Kirillov
d06a5fb413 FIR IDE: disable some script stuff in FIR plugin as causes exceptions 2020-12-23 17:16:23 +01:00
Ilya Kirillov
70b1edb81d FIR IDE: allow using some light classes stuff from EDT :(
IJ Platform can call light classes methods from EDT from random places
2020-12-23 17:16:22 +01:00
Ilya Kirillov
306b46b8f2 FIR IDE: consider FirErrorReferenceWithCandidate as reference with error 2020-12-23 17:16:21 +01:00
Ilya Kirillov
9a86d2e10c FIR IDE: do not mark declaration with some lazy resolve phase if only some children are resolved to that phase
Otherwise, we will not be able to resolve parent one
2020-12-23 17:16:19 +01:00
Ilya Kirillov
1e2536402d FIR: render constructor resolve phase in FirRenderer when renderDeclarationResolvePhase is requested 2020-12-23 17:16:18 +01:00
Ilya Kirillov
85c65e20b3 FIR: add meaningful error message when type ref is unresolved 2020-12-23 17:16:17 +01:00
Ilya Kirillov
6ad396f417 FIR: use transformer creator from existing return type calculator when creating a new one 2020-12-23 17:16:16 +01:00
Ilya Kirillov
68f6e734be FIR IDE: add test case for resolving call as value argument 2020-12-23 17:16:14 +01:00
Ilya Kirillov
af5aa5fa66 FIR IDE: add more info to the call resolve error message 2020-12-23 17:16:13 +01:00
Ilya Kirillov
c5788290f3 FIR IDE: refactor: move designation & transformer creation in lazy resolve to separate functions 2020-12-23 17:16:12 +01:00
Ilya Kirillov
c61b0d1f31 FIR IDE: fix designation collection for lazy resolve 2020-12-23 17:16:11 +01:00
Roman Golyshev
3aef1154c8 FIR IDE: Get rid of FirTransformerProvider class
Instead, create `ScopeSession` by hand and pass it as a parameter when
it is crucial for the performance
2020-12-23 17:16:09 +01:00
Ilya Kirillov
d3cab96ca0 FIR IDE: consider declaration to be lazy resolvable if it has fqName 2020-12-23 17:16:07 +01:00
Ilya Kirillov
8e592bdff0 FIR IDE: invalidate analysis session cache on out of block 2020-12-23 17:16:02 +01:00
Ilya Kirillov
9c26edbaaa FIR IDE: split ValidityToken.isValid into isValid & isAccessible 2020-12-23 17:16:01 +01:00
Ilya Kirillov
a2befd4635 FIR IDE: add missing ClsJavaStubByVirtualFileCache service 2020-12-23 17:16:00 +01:00
Ilya Kirillov
eead868cd2 FIR IDE: use correct out of block modification tracker 2020-12-23 17:15:58 +01:00
Ilya Kirillov
0862928bf7 FIR IDE: move KotlinOutOfBlockModificationTrackerFactory to frontend independent module 2020-12-23 17:15:57 +01:00
Ilya Kirillov
a30d9e0ed3 FIR: add fake source fir element to it parameter symbol 2020-12-23 17:15:56 +01:00
Ilya Kirillov
af0e8b28d5 FIR IDE: add missing statistic extension points 2020-12-23 17:15:55 +01:00
Georgy Bronnikov
b35d4134a7 Psi2IR: workaround for IR-based descriptors
Since KotlinTypes involving IR-Based descriptors are distinct from KotlinTypes
involving original descriptors of the same declarations, subtyping check
breaks in InsertImplicitCasts.
2020-12-23 18:50:53 +03:00
Georgy Bronnikov
99c874ba8a IR: use NullDescriptorRemapper in DeepCopySymbolRemapper 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
c5961da780 IR: remove WrappedDescriptors altogether 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
e9f45e23f2 IR: NullDescriptorsRemapper 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
3683cd0f7b IR: fix IrBasedTypeAliasDescriptor 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
076272f7ca FIR2IR: avoid descriptors computing hashCode
When synthesizing the hashCode function for data classes, descriptors
were used, in partcular, memberScope for primitive classes.
IrBasedDescriptors have no member scope, so we compute the hashCode
function based on IR structures.
2020-12-23 18:50:52 +03:00
Georgy Bronnikov
b07dccb8d7 Fir2IR: remove wrapped descriptors 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
b05400154d IR: remove IrSymbolDeclaration 2020-12-23 18:50:52 +03:00
Georgy Bronnikov
d714adacae IR: removing WrappedDescriptors from symbols 2020-12-23 18:50:51 +03:00
Georgy Bronnikov
989d4350b1 IR: make descriptor optional in IrSymbol 2020-12-23 18:50:51 +03:00
Jinseong Jeon
aaa3f2e2c1 FIR2IR: correct IR origin for substitution overrides
#KT-44054 Fixed
2020-12-23 16:13:05 +03:00
Jinseong Jeon
34dbbdce07 FIR2IR: use lookupTag or class to getLocalClass, not classId
Before this commit, we sometimes tried to fetch anonymous object by id,
getting sometimes a wrong result because it's singleton.
Now we use lookupTag or FIR class itself instead.

#KT-44050 Fixed
2020-12-23 16:12:58 +03:00
Alexander Dudinsky
94315bc4dc Remove mapping to kotlin-ultimate from vsc.xml 2020-12-23 15:04:38 +03:00
Dmitry Petrov
632f5af442 Minor: kt21014.kt - add JVM_TARGET 1.8 2020-12-23 11:25:36 +03:00
Alexander Dudinsky
10a5727260 Merge together MultiplatformHighlighting and MultiplatformAnalysis tests
Basically, the former uses an old quickly-scrapped infrastructure,
which were not applicable for HMPP, so  the latter tests were written.

So, both check for one and the same thing (highlighting in MPP projects),
but MultiplatformAnalysisTest is more modern,
and has a lot of inconvenient stuff in MultiplatformHighlighting fixed
^KT-43116 Fixed
2020-12-23 10:47:18 +03:00
Jinseong Jeon
73576c80e4 FIR2IR: calculate IR parent for Java field ahead
so as to cache type parameters from the parent if the field's return
type is one of type parameters.

#KT-44032 Fixed
2020-12-23 09:10:52 +03:00
Vyacheslav Gerasimov
89577543a2 Build: Disable plugin marker publication for sonatype 2020-12-23 02:58:14 +03:00
Mikhail Glukhikh
107a825c5f Make FileDescriptorForVisibilityCheck subtype of PackageFragmentDescriptor
#KT-20548 Fixed
2020-12-23 00:11:08 +03:00
Dmitry Petrov
3ae8521f12 Minor: drop kt21014.kt (SIGSEGV on HotSpot 6.0_45-b06) 2020-12-22 19:56:54 +03:00
Dmitry Petrov
f647233189 Minor: drop empty bunch file 2020-12-22 16:10:50 +03:00
Dmitry Petrov
796d821776 JVM_IR box tests for JDK9 2020-12-22 16:09:48 +03:00
Dmitry Petrov
c9d330207b JVM_IR no nullability annotations on SAM wrapper constructor parameters 2020-12-22 16:09:46 +03:00
Dmitry Petrov
4780c73e40 Ignore anonymous inner classes in LightAnalysisMode tests 2020-12-22 16:09:45 +03:00
Dmitry Petrov
0dff583070 JVM KT-36984 SAM wrappers are anonymous inner classes 2020-12-22 16:09:45 +03:00
Dmitry Petrov
57dd9fc87a JVM_IR KT-36984 SAM wrappers are anonymous inner classes 2020-12-22 16:09:45 +03:00
Dmitry Petrov
443cd0fc2c Tests for issues fixed in JVM_IR 2020-12-22 16:07:06 +03:00
Denis.Zharkov
5e5b236ef8 Extract record related parts into smaller bunch files for 201 2020-12-22 14:58:05 +03:00
Jinseong Jeon
e05d26b9b0 FIR2IR: cache type parameters in delegated property
#KT-44030 Fixed
2020-12-22 12:05:31 +03:00
Jinseong Jeon
78fa8814c4 FIR: unwrap f/overrides when determining mutability of property reference
#KT-44010 Fixed
2020-12-22 12:04:56 +03:00
Nikolay Krasko
0918e73dff Move wasm tests to JS tests configuration (KTI-419) 2020-12-21 19:59:13 +03:00
Dmitriy Novozhilov
554fa358e8 [FIR] Fix calculating offsets of light tree source elements for local declarations 2020-12-21 18:34:58 +03:00
Dmitriy Novozhilov
298e27bdac [Test] Migrate AbstractExtendedFirDiagnosticsTest to new infrastructure 2020-12-21 18:34:57 +03:00
Dmitriy Novozhilov
a276d05917 [Test] Generate FIR tests with new infrastructure in :analysis-tests module 2020-12-21 18:34:56 +03:00
Dmitriy Novozhilov
537e4f0bb4 [Test] Move existing fir tests on old infrastructure to :legacy-fir-tests module 2020-12-21 18:34:55 +03:00
Dmitriy Novozhilov
1f258c28fc [Test] Extract main compiler test generator to separate project
This is needed because now we have different tests modules with different
  test frameworks (JUnit3 and JUnit5) which has no dependencies between
  each other. So for keeping all test generation config in one place
  we need module which may rely on all independent test modules
2020-12-21 18:34:54 +03:00
Jinseong Jeon
d753d21dee FIR2IR: don't add SAM conversion for explicit subtype cases 2020-12-21 18:01:27 +03:00
Jinseong Jeon
7df289746c FIR: fix invoke lookup for SAM resolution 2020-12-21 18:01:26 +03:00
Jinseong Jeon
3bca6ae893 FIR: allow lower bound of flexible type when finding contributed invoke 2020-12-21 18:01:25 +03:00
Jinseong Jeon
4a24f0fab3 FIR2IR: use FirSamResolverImpl to get function type for possible SAM type 2020-12-21 18:01:23 +03:00
Jinseong Jeon
d5a6991b2d FIR: extend SAM conversion to subtype of functional type 2020-12-21 18:01:22 +03:00
Mikhail Glukhikh
c6a40b2322 Optimize/simplify FirJvmTypeMapper.defaultType 2020-12-21 17:35:51 +03:00
Mikhail Glukhikh
3ab5b57594 Optimize/simplify FirJvmTypeMapper.representativeUpperBound 2020-12-21 17:35:51 +03:00
Mikhail Glukhikh
42b590d07c Optimize/simplify FirSealedClassConstructorCallChecker 2020-12-21 17:35:51 +03:00
Mikhail Glukhikh
c94c71cc50 Optimize/simplify ConeClassLikeLookupTag.getNestedClassifierScope 2020-12-21 17:35:50 +03:00
Mikhail Glukhikh
7add186616 Optimize/simplify FirClass<*>.findNonInterfaceSupertype 2020-12-21 17:35:50 +03:00
Andrei Klunnyi
3e8016ed25 KTIJ-717 [Java side inspection]: "implementation of Kotlin sealed" 2020-12-21 11:44:16 +01:00
Ilya Chernikov
65cf941b9b Remove assertion about dispatch receiver in scripts
#KT-42530 fixed
2020-12-21 09:43:44 +01:00
Ilya Chernikov
0671fd9aaa Support destructuring declarations in scratch files
#KT-25038 fixed
2020-12-21 09:43:44 +01:00
Ilya Chernikov
9ee17cd610 Do not throw assertion on recursion in typealias declaration,
return empty list of descriptors instead, allowing for proper error
reporting later.
#KT-18344 fixed
2020-12-21 09:43:43 +01:00
Ilya Chernikov
02c617468f Add support for a callback on recursion for memoized functions 2020-12-21 09:43:43 +01:00
Alexander Udalov
eef06cded3 JVM IR: output stable ABI binaries by default
#KT-43592 Fixed
2020-12-20 23:14:54 +01:00
Alexander Udalov
e0593ff70f Minor, extract CompilerConfiguration.messageCollector to extension property 2020-12-20 23:14:49 +01:00
Alexander Udalov
691b20a685 JVM IR, FIR: set IR configuration key to true if FIR is enabled 2020-12-20 23:14:41 +01:00
Alexander Udalov
06805ffbaa Change CLI flags for controlling diagnostics for ABI of FIR and JVM IR
- Use a more generic `-Xallow-unstable-dependencies` instead of
  `-Xallow-jvm-ir-dependencies`
- Change `-Xir-binary-with-stable-abi` to `-Xabi-stability=stable`, with
  an additional option to specify `unstable` after a subsequent commit
  where JVM IR becomes stable by default

 #KT-43592
2020-12-20 23:14:32 +01:00
Alexander Udalov
3f517d7e8d Add new metadata flag for class files compiled with FIR
Report a separate error when class files compiled with FIR are in
dependencies, in addition to the one for class files compiled with FE
1.0 + JVM IR.

 #KT-43592
2020-12-20 23:14:30 +01:00
Alexander Udalov
cbd90c3af5 Refactor boolean IR ABI stability flag to enum
Introduce an enum DeserializedContainerAbiStability with two values.
This is needed in order to support another reason for ABI instability in
a subsequent commit, namely "unstable because compiled by FIR".

 #KT-43592
2020-12-20 23:14:12 +01:00
Alexander Udalov
b7d32a8754 Minor, invert analysis flag that allows unstable dependencies 2020-12-20 23:13:50 +01:00
Alexander Udalov
7d37030095 JVM IR, FIR: add JvmBackendExtension instead of MetadataSerializerFactory
This might be a better place for future behavior that should be
abstracted between FE 1.0 and FIR, in JVM IR.
2020-12-20 23:13:48 +01:00
Leonid Startsev
a5ddb1fdf1 Update error about unsupported inline classes
Remove unused declarations
2020-12-19 20:34:45 +03:00
Leonid Startsev
272273baed Support serializable inline classes in IR plugin
as well as standard unsigned types.
2020-12-19 20:34:45 +03:00
Leonid Startsev
631a72d14a Support old serialization runtime versions
(where exception signatures weren't changed)

after f671c27f27
2020-12-19 20:34:11 +03:00
Leonid Startsev
f671c27f27 Adapt serialization exceptions constructor calls in legacy JS
to signature change

(see https://github.com/Kotlin/kotlinx.serialization/pull/1054
and commit eea4ff33a0)
2020-12-19 19:18:15 +03:00
Leonid Startsev
18e7a1485c Additional fix for Compose:
directly search for fields in IR class w/o using the symbol table.
Because Compose copies whole IR, fields got referenced incorrectly.
In the end, bytecode generator thinks that this is a field from other
class and creates a synthetic setter, which is prohibited in Java 9+
(Update to non-static final field ... attempted from a different method than <init>)
2020-12-19 19:18:14 +03:00
Ilmir Usmanov
f922ebbfc3 Value classes: Add JvmInlineValueClasses language feature 2020-12-18 17:53:58 +01:00
Victor Petukhov
48d9812d9e Review fixes around type enhancement and loading type use annotations 2020-12-18 19:32:05 +03:00
Victor Petukhov
9a52863fbd Report warnings about type mismatches based on freshly supported nullability annotations deeply 2020-12-18 19:32:05 +03:00
Victor Petukhov
d6017420de Mark freshly supported annotations to use that mark for reporting corresponding warnings 2020-12-18 19:32:05 +03:00
Victor Petukhov
9693ea19fb Add tests for type enhancement uncluding with compiled java 2020-12-18 19:32:05 +03:00
Victor Petukhov
71ca18e937 Support diagnostic tests with Kotlin against compiled Java 2020-12-18 19:32:05 +03:00
Victor Petukhov
6f8f531d87 Put type enhancement improvements under the compiler flag 2020-12-18 19:32:05 +03:00
Victor Petukhov
857cc92326 Support preference of TYPE_USE annotations to enhance over others like METHOD, FIELD and VALUE_PARAMETER to avoid double applying them in case of arrays: @NotNull Integer [] (both to the array element and to the entire array)
^KT-24392 Fixed
2020-12-18 19:32:04 +03:00
Victor Petukhov
69f31afecc Exclude tests for loading type use annotations and type enhancement based on them to pass using javac and psi class files reading 2020-12-18 19:32:04 +03:00
Victor Petukhov
f389654fea Support type enhancement for super classes' types 2020-12-18 19:32:04 +03:00
Victor Petukhov
276498793f Support enhancement of type parameter's bound for all nullability annotations 2020-12-18 19:32:04 +03:00
Victor Petukhov
c91301d04c Support type use annotations on fields 2020-12-18 19:32:04 +03:00
Victor Petukhov
b0debbe4c9 Add forced mark "isDeprecated" as false for missing types among javac types 2020-12-18 19:32:04 +03:00
Victor Petukhov
8777d28228 Use new jetbrains annotations with type use target for "load java 8" tests 2020-12-18 19:32:04 +03:00
Victor Petukhov
6f64e2c036 Avoid a cycle of analysing of type parameters via checking that it's a type parameter first 2020-12-18 19:32:04 +03:00
Victor Petukhov
a89329e077 Support reading from class files of the type use annotations on type parameters and type arguments
^KT-11454 Fixed
2020-12-18 19:32:03 +03:00
Victor Petukhov
0833719a79 Support annotations on array types
^KT-24392 Fixed
^KT-18768 Fixed
2020-12-18 19:32:03 +03:00
Victor Petukhov
f0ab8bc332 Clean up some code in compiler.resolution.common.jvm 2020-12-18 19:32:03 +03:00
Igor Yakovlev
63aa809280 [FIR IDE] Add fir type annotations test 2020-12-18 14:28:27 +03:00
Igor Yakovlev
c4b708b5dc [FIR IDE] Fixed test data for types 2020-12-18 14:28:27 +03:00
Igor Yakovlev
9e89cfae08 [FIR IDE] Fixed invalid leaks test 2020-12-18 14:28:27 +03:00
Igor Yakovlev
fb94470741 [FIR IDE] Fix resolve value parameter symbol 2020-12-18 14:28:26 +03:00
Igor Yakovlev
8891a337e2 [FIR IDE] Implement type annotations for fir symbols 2020-12-18 14:28:26 +03:00
Igor Yakovlev
9670f67912 [FIR IDE] Make annotations and extension receiver lazy 2020-12-18 14:28:26 +03:00
Jinseong Jeon
9c2d06cf70 FIR: strengthen resolution success check for augmented array set call
This commit removes some false ambiguities &
fixes compilation of tree-generator module with FIR
2020-12-18 14:24:24 +03:00
Simon Ogorodnik
9bf2dfaa02 KT-40200: Fix main function detector in lazy resolve overload resolver 2020-12-18 14:19:56 +03:00
Dmitriy Novozhilov
92adccde47 Probably fix issue with creating module descriptor for SDK twice
During creation and initialization of module descriptor for sdk
  in IdeaResolverForProject.BuiltInsCache.getOrCreateIfNeeded
  AbstractResolverForProject asks for sdk dependency for module
  descriptor for this sdk, so sometimes this module descriptor was
  created twice

#KT-42001 Fixed
EA-211562
2020-12-18 13:40:14 +03:00
Dmitriy Novozhilov
6296f6dc33 [FE] Don't throw assertion in OverrideResolver if directOverridden is empty
Those descriptors may be empty in case user made a mistake and tried to
  delegate implementation of abstract class instead of interface (and
  we don't add functions from abstract class to overriden descriptors
  of fake overrides in case of delegation by)

#KT-40510 Fixed
2020-12-18 13:40:14 +03:00
Jinseong Jeon
dea01125d6 FIR deserializer: keep SourceElement for more precise Fir2IrLazyClass's source 2020-12-18 12:17:23 +03:00
Jinseong Jeon
fe0c25693d FIR2IR: do not convert @ExtensionFunctionType twice 2020-12-18 12:17:21 +03:00
Jinseong Jeon
4608431682 FIR2IR: correct base symbols of fake overrides for delegated member
#KT-43984 Fixed
2020-12-18 11:21:02 +03:00
Jinseong Jeon
44c6ec2c44 FIR checker: make unused checker handle invoke properly
#KT-43688 Fixed
2020-12-18 09:46:39 +03:00
Mikhail Glukhikh
d907c48d9c Allow KtEnumEntry...RefExpression.referencedElement be nullable
This commit fixes KNPE provoked by RemoveExplicitTypeArgumentsIntention
#KT-29735 Fixed
2020-12-18 09:27:18 +03:00
Shagen Ogandzhanian
4f96f9d6a1 [JS IR] Initialize enum fields before accessing them in companion object
see https://youtrack.jetbrains.com/issue/KT-43901
2020-12-18 01:54:59 +01:00
Andrei Klunnyi
3eb0745b58 KTIJ-650 [Code completion]: "sealed interface" is for 1.5+ only 2020-12-17 18:28:04 +00:00
Andrei Klunnyi
27ebb6c946 KTIJ-650 [Code completion]: test framework fix
This commit fixes test infrastructure issue.
Usage of "COMPILER_ARGUMENTS" test-data-instruction resulted in side
effect. Test cases following the one that used it got broken
LanguageVersionSetting - LanguageFeature.MultiPlatformProjects escaped,
languageVersion could be wrong.

Why it happened

KotlinProjectDescriptorWithFacet defines default values
of (language-version, isMultiplatform) settings for the test-case.
The values themselves are stored in KotlinFacetSettings and passed there
only once. After every test-case (if it uses "COMPILER_ARGUMENTS")
infrastructure calls
KotlinLightCodeInsightFixtureTestCaseKt#rollbackCompilerOptions which
resets mentioned values (among others) in KotlinFacetSettings.
Instances of KotlinProjectDescriptorWithFacet are reused hence facet
settings remained reset.
2020-12-17 18:28:03 +00:00
Andrei Klunnyi
efc7ab5023 KTIJ-664 [SealedClassInheritorsProvider]: test fixes 2020-12-17 19:01:49 +01:00
Nikolay Krasko
88a0fe7ec1 Make a longer description for Kotlin Android plugin
Try to overcome `Plugin description must not be generic, please
elaborate.` from the Gradle plugin portal.
2020-12-17 14:30:05 +03:00
Ilya Gorbunov
43c04dfd08 [Wasm] Publish stdlib: remove separate project 2020-12-17 14:13:51 +03:00
Igor Chevdar
be688356c9 [IR] Fixed bug with thread unsafety
There is no need in a singleton here
2020-12-17 14:03:52 +05:00
Igor Chevdar
03693e3d5a [klib] Optimized away some Files.exists() 2020-12-17 13:57:16 +05:00
Dmitriy Novozhilov
f597343d82 [TEST] Fix testdata 2020-12-17 00:33:17 +03:00
Dmitriy Novozhilov
8974d31bb8 [TEST] Fix problem with line separator on windows 2020-12-17 00:33:10 +03:00
Vladimir Dolzhenko
f2fa36f9cb Split modules scan based if facedSettings can affect api/lang level of module
^KTIJ-249 Fixed

Original commit: d280fb1fe466ef7b6ef7559067032033bedefd6e
2020-12-16 21:00:24 +01:00
Dmitriy Novozhilov
e7c4121e67 [TEST] Add muting tests with .fail file for js box tests 2020-12-16 19:52:31 +03:00
Dmitriy Novozhilov
416f17e5ec [TEST] Drop remaining tests of experimental coroutines 2020-12-16 19:52:31 +03:00
Dmitriy Novozhilov
019cb1485e [TEST] Extract language feature regex pattern to :test-infrastructure-utils 2020-12-16 19:52:31 +03:00
Dmitriy Novozhilov
4ed2651c1f [CMI] Rename platforms to attributes in some forgotten places 2020-12-16 19:52:31 +03:00
Dmitriy Novozhilov
e1802fde29 [TD] Update test data after previous commit 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
49d9b85950 [TEST] Migrate AbstractFirDiagnosticsWithLightTreeTest to new test runners
Also this commit adds AbstractTwoAttributesMetaInfoProcessor which can
  be used for reporting diagnostics with two attributes (OI/NI, PSI/Light tree)
2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
7e9deb7602 [FIR] Fix NPE in light tree source utils 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
b048296dca [FIR] Fix calculating offsets for light tree source elements 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
acbc468fdd [FIR] Add light tree mode to FirAnalyzerFacade 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
2aa1cb7451 [TEST] Migrate AbstractDiagnosticsNativeTest to new test runners 2020-12-16 19:52:30 +03:00
Dmitriy Novozhilov
e7f8486078 [TEST] Migrate AbstractDiagnosticsTestWithJvmBackend to new test runners 2020-12-16 19:52:29 +03:00
Dmitriy Novozhilov
71ffaa2d97 [TEST] Migrate AbstractDiagnosticsTestWithJsStdLib to new test runners 2020-12-16 19:52:29 +03:00
Dmitriy Novozhilov
1fe5148f0d [TEST] Extract compiler-specific test utils from :tests-common to new module 2020-12-16 19:52:29 +03:00
Dmitriy Novozhilov
d15c7861b2 [TEST] Invert dependency between :test-generator and :tests-common modules
This is needed to provide ability for declaring new implementations of
  test generators, based on existing infrastructure, which won't add
  dependency on :compiler:tests-common

Also this commit removes implicit dependency on :compiler:tests-common
  from :compiler:tests-common-new
2020-12-16 19:52:29 +03:00
Dmitriy Novozhilov
bc7e18fb8a [TEST] Regenerate tests after previous commit 2020-12-16 19:52:28 +03:00
Dmitriy Novozhilov
9e2d691425 [TEST] Move utils for checking all files presented to KtTestUtil
This is needed to remove dependency on :tests-common from module
  with abstract test generators
2020-12-16 19:52:27 +03:00
Dmitriy Novozhilov
64ce307f7f [TEST] Drop mechanism for muting tests with .mute files
This mechanism is deprecated and replaced with muting in database (.csv files)
2020-12-16 19:52:27 +03:00
Dmitriy Novozhilov
f8ad096abb [TEST] Mute tests in IC JS Klib tests using exclude pattern instead of .mute file 2020-12-16 19:52:27 +03:00
Dmitriy Novozhilov
d9848544dc [TEST] Move auto mute wrapping utils to :compiler:tests-mutes 2020-12-16 19:52:27 +03:00
Dmitriy Novozhilov
8a5fc2ad29 [Build] Split :tests-mutes package to common and TC integration parts
This is needed because of following problem:
- :tests-mutes has `implementation` dependency on khttp library
- khttp has dependency on spek-junit-platform-engine library
- :tests-common had `testCompile` dependency on :tests-mutes which
    added spek library as as a dependency to all modules which depend
    on :tests-common, including :tests-common-new

Then, if project is configured with JPS then if user tries to run all
  tests in directory in module which uses JUnit 5 (like :tests-common-new)
  then spek library will be added to classpath and junit runner takes
  some platform extension from it which causes NoSuchMethodException
  because spek library was compiled against outdated JUnit 5 version
  and current version doesn't have some API.

So splitting :tests-mutes for two parts fixes this issue, because common
  part (:compiler:tests-mutes) no longer depends on khttp, so spek
  library doesn't spreads to all modules
2020-12-16 19:52:26 +03:00
Dmitriy Novozhilov
26d7ea6ce6 [TEST] Migrate AbstractDiagnosticsWithModifiedMockJdkTest to new test runners 2020-12-16 19:52:26 +03:00
Dmitriy Novozhilov
b43fa94cb6 [TEST] Migrate AbstractDiagnosticsWithUnsignedTypes to new test runners 2020-12-16 19:52:26 +03:00
Dmitriy Novozhilov
23e704f361 [TEST] Migrate AbstractDiagnosticsWithExplicitApi to new test runners 2020-12-16 19:52:26 +03:00
Dmitriy Novozhilov
c0e4452cf8 [TEST] Migrate AbstractDiagnosticsWithJdk9Test to new test runners 2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
61302a2e08 [TEST] Migrate duplicating javac tests to new test runners
Also minimize scope of DiagnosticUsingJavac tests to
 `compiler/testData/diagnostics/tests/javac`. This is fine since
 javac compilation mode is still not finished and no one not going to
 support it
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
b44dc55109 [TD] Mute some javac tests or update their testdata
There was a refactoring of AbstractDiagnosticsTest in 9052ef06 which
  contains bug that `setupEnvironment` for AbstractDiagnosticsTestUsingJavac
  was not called, so for last year tests `UsingJavac` had no difference
  with usual diagnostics tests which causes some contradictions in test data
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
8ddf419be5 [Build] Fix gradle tests filter for JUnit 5
There is an a optimization in our `projectTest` config which filters
  out some compiled test classes if they didn't contain specified test
  (if user ran :test task with --tests flag). This optimization for one
  tests left only one .class file which contains test. But JUnit 5 for
  tests in inner classes (with @Nested annotation) requires not only
  target class, but and all it's containers

Test: package.SomeTest$Nested.testMethod
JUnit4: package/SomeTest$Nested.class
JUnit5:
- package/SomeTest.class
- package/SomeTest$Nested.class
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov
1d04fecd29 [TD] Remove some outdated tests with unsupported EXPLICIT_FLEXIBLE directive 2020-12-16 19:52:24 +03:00
Dmitriy Novozhilov
0b0e2c3ad2 [TD] Create real helpers files for coroutines checkers 2020-12-16 19:52:24 +03:00
Dmitriy Novozhilov
710c5ec8cc [TEST] Drop old generated tests which are duplicated by new ones 2020-12-16 19:52:24 +03:00
Dmitriy Novozhilov
6128d5e7f2 [TEST] Generate new tests using new runners and old testdata 2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
d7224ad63e [Build] Add generating and running new compiler tests to gradle 2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
3bd3545a05 [TEST] Add abstract test runners for some of compiler test in new infrastructure
This commit includes runners for FE 1.0 and FIR diagnostics tests and
  JVM black box tests for old backend
2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
32fda13ef9 [TEST] Implement test generators for junit 5 based tests 2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
cb5183ab4d [TEST] Add implementation of new infrastructure services for compiler tests
All of new classes lays in lays in :compiler:tests-common-new module
  which includes classes for FE 1.0 and FIR diagnostics tests and
  JVM black boxtests
2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
dd402b16d9 [TEST] Add core of new tests infrastructure
It contains different abstractions which represents parts of compiler
  pipeline and artifacts produced by them, service structure, handlers
  for analysis of artifacts
2020-12-16 19:52:23 +03:00
Dmitriy Novozhilov
35437e6da9 [FE] Allow explicitly specify dependent modules fin TopDownAnalyzerFacade 2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
c8f3a4802e [TEST] Introduce test-infrastructure-utils module and extract common test utilities here 2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
1c91b74ff0 [CMI] Fix clearing code meta infos from original text 2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
7960182674 [CMI] Fix CodeMetaInfoParser to properly handle nested meta infos
There was a problem with cases like that:
<!FOO!><!BAR!>some text<!><!>
                        ^  ^
                        1  2
(1) is a closing tag for <!FOO!> and (2) is for <!BAR!>, but before the
  fix they were matched contrariwise
2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
c558df5b4a [CMI] Fix rendering metainfos at the end of file 2020-12-16 19:52:22 +03:00
Dmitriy Novozhilov
ceb44ddccd [CMI] Improve CodeMetaInfoRenderer
1. Properly handle meta which start == end
2. Sort metainfos of one range by tag
2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
98a2f29f95 [CMI] Allow using right angle bracket symbol in MetaInfo message 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
09df07349c [CMI] Add ability to replace render configuration of DiagnosticCodeMetaInfo 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
d6ff83c7d8 [CMI] Add ability to copy ParsedCodeMetaInfo 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
3bf60b3acc [CMI] Rename CodeMetaInfo.platforms to attributes 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
ced9a6fe35 [CMI] Replace getTag with tag property in CodeMetaInfo 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
9e31b049fc [CMI] Add additional constructor for DiagnosticCodeMetaInfo 2020-12-16 19:52:21 +03:00
Dmitriy Novozhilov
87a6a66953 [CMI] Parse description of meta info and save it to ParsedCodeMetaInfo 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
2bbab3170f [CMI] Replace StringBuffer with StringBuilder in CodeMetaInfoRenderer 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
25c011ca40 [CMI] Extract core of CodeMetaInfo to :compiler:tests-common 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
4ad9f48642 [CMI] Cleanup code of CodeMetaInfo 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
23c088afd6 [TEST-GEN] Reorganize package structure in :generators:test-generator module 2020-12-16 19:52:20 +03:00
Dmitriy Novozhilov
380e8a3814 [TEST-GEN] Extract run of TestGenerator to top of test generation DSL 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
2a73aaba4d [TEST-GEN] Move all generation data to TestGroup.TestClass 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
c51ea6b142 [TEST-GEN] Create abstract TestGenerator and move current generator logic to TestGeneratorImpl 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
d45fb4dfd8 [TEST-GEN] Extract logic of generating test methods into separate abstraction MethodGenerator 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
2acbe96f15 [TEST-GEN] Convert Test Generation DSL classes from java to kotlin 2020-12-16 19:52:19 +03:00
Dmitriy Novozhilov
31bccb4fb0 [TEST-GEN] Rename .java to .kt 2020-12-16 19:52:18 +03:00
Dmitriy Novozhilov
580d2ed693 [TEST-GEN] Add some comments to TestGenerationDSL 2020-12-16 19:52:18 +03:00
Mikhail Glukhikh
0e43eaa662 Don't call possibleGetterNamesByPropertyName without a reason 2020-12-16 19:50:13 +03:00
Dmitriy Novozhilov
44948aa9a2 [FE] Properly report diagnostics about type arguments of implicit invoke
#KT-40396 Fixed
2020-12-16 17:57:58 +03:00
Dmitriy Novozhilov
329066a4f3 [Parser] Fix parsing of unfinished dot access in string template
Problem appeared in cases like this: "{someVar.}"

#KT-34440 Fixed
2020-12-16 17:57:56 +03:00
Dmitry Petrov
8999fd88b1 JVM_IR KT-43401 KT-43518 fix ACC_STRICT and ACC_SYNCHRONIZED flags 2020-12-16 14:10:36 +03:00
Dmitry Petrov
7ed3860c70 JVM_IR KT-43043 fix nullability annotations for inline class members 2020-12-16 13:43:29 +03:00
Andrei Klunnyi
2b3fc330ad KTIJ-664 [SealedClassInheritorsProvider]: test fixes 2020-12-16 11:35:27 +01:00
Igor Yakovlev
c2bf124d86 [FIR IDE] File symbol scope and symbol test 2020-12-16 12:29:54 +03:00
Igor Yakovlev
2f4842b271 [FIR IDE] Add KtFileScope to support KtFileSymbol 2020-12-16 12:29:54 +03:00
Igor Yakovlev
2fa5ab6e31 [FIR IDE] LC Remove difficult caching from FirLightClassBase 2020-12-16 12:29:54 +03:00
Igor Yakovlev
f282b721bc [FIR IDE] LC Fix test data 2020-12-16 12:29:53 +03:00
Igor Yakovlev
f5d8ae0550 [FIR IDE] LC add caching to light facades 2020-12-16 12:29:53 +03:00
Igor Yakovlev
da54dbba8e [FIR IDE] LC Add callable declarations to KtFileSymbol 2020-12-16 12:29:53 +03:00
Igor Yakovlev
fb63b74b37 [FIR IDE] LC Add KtFileSymbol and fix facade annotations 2020-12-16 12:29:53 +03:00
Igor Yakovlev
46071c1925 [FIR IDE] LC fix annotations with special sites and nullability 2020-12-16 12:29:53 +03:00
Igor Yakovlev
2e7866ca86 [FIR IDE] LC Fix annotations and modifiers for class members 2020-12-16 12:29:52 +03:00
Igor Yakovlev
3019f439fb [FIR IDE] LC More accurate processing for JvmSynthetic and JvmHidden annotations 2020-12-16 12:29:52 +03:00
Igor Yakovlev
3895ad375c [FIR IDE] LC add jvmstatic method into companion object 2020-12-16 12:29:52 +03:00
Victor Petukhov
d32d0a65f0 Revert "Report warning on @JvmStatic in private companion objects"
This reverts commit 9669ab14
2020-12-16 10:24:18 +03:00
Victor Petukhov
94deddef7f Revert "Minor: cover negative cases with test +m"
This reverts commit 04a4f9cd
2020-12-16 10:24:12 +03:00
Ilya Kirillov
5a9ff3471a FIR IDE: fix function targets on context element copy 2020-12-15 22:16:04 +01:00
Ilya Kirillov
67fc1bcb3d FIR IDE: add debug error message when not possible to find fir declarartion by psi 2020-12-15 22:16:03 +01:00
Ilya Kirillov
940ec06f5b FIR IDE: precalculate completion context on dependent analysis session creation 2020-12-15 22:16:02 +01:00
Ilya Kirillov
40b1a4df5a FIR IDE: temp mute failing find usages test 2020-12-15 22:16:01 +01:00
Ilya Kirillov
2d5b23b650 FIR IDE: separate KtExpressionTypeProvider into components 2020-12-15 22:16:00 +01:00
Ilya Kirillov
2101816f03 FIR IDE: add expected type calculation for function calls
does not work in case of incomplete call expression :(
2020-12-15 22:16:00 +01:00
Ilya Kirillov
7be8d69870 FIR IDE: add completion weighers tests for return/if/while 2020-12-15 22:15:59 +01:00
Ilya Kirillov
b16ebe2dc4 FIR IDE: consider if & while conditions expected type as boolean 2020-12-15 22:15:57 +01:00
Ilya Kirillov
c2d83353e8 FIR IDE: introduce builtin types container 2020-12-15 22:15:57 +01:00
Ilya Kirillov
835577383b FIR IDE: introduce expected type provider for return expressions 2020-12-15 22:15:56 +01:00
Ilya Kirillov
299f36183c FIR IDE: add tests for completion weighers from old testdata 2020-12-15 22:15:53 +01:00
Ilya Kirillov
19fff2b1e7 FIR IDE: implement expected type weigher for completion 2020-12-15 22:15:52 +01:00
Ilya Kirillov
c61d4b5f9c FIR IDE: introduce return statement target provider 2020-12-15 22:15:51 +01:00
Ilya Kirillov
a0ed14eafe FIR: use real source element for return statement
fix fir
2020-12-15 22:15:51 +01:00
Andrei Klunnyi
3af0257b38 KTIJ-664 [SealedClassInheritorsProvider]: IDE-specific implementation 2020-12-15 18:43:00 +01:00
Andrei Klunnyi
f02b73103b KTIJ-650 [Code completion]: no "sealed" for classes with modifiers
annotation, data, enum, inner, open - classes supplied with these
modifiers cannot be sealed.

Commit fixes code completion - "sealed" is no longer suggested in
the mentioned case.
2020-12-15 18:43:00 +01:00
Andrei Klunnyi
fe64b13140 KTIJ-650 [Code completion]: support for "sealed interface"
^KTIJ-650 fixed
2020-12-15 18:10:23 +01:00
Svyatoslav Kuzmich
602ed42b99 [Wasm] Move intrinsic generators to generators/wasm
Reason: avoid kotlin-stdlib-gen dependency on kotlinStdlib() via wasm.ir
2020-12-15 19:44:19 +03:00
Jinseong Jeon
efeabac2c5 FIR: do not force coercion-to-Unit for nullable lambda return type
3d7d87ac should have been implemented as aafe41c did.
2020-12-15 17:52:49 +03:00
Jinseong Jeon
6239301f4e FIR: no constraint for coerced-to-Unit last expression of lambda 2020-12-15 17:52:49 +03:00
Jinseong Jeon
4ab0897d7d FIR: pass the explicit expected type to block type
This helps avoid adding redundant return Unit into block.
2020-12-15 17:52:48 +03:00
Jinseong Jeon
0ea6b32c01 NI: allow lower bound of flexible type for coercion-to-Unit
Example from
box/inference/coercionToUnitForLambdaReturnTypeWithFlexibleConstraint

// FILE: TestJ.java
public class TestJ {
  public static <T> In<T> materialize() { return null; }
}

// FILE: test.kt

class In<in T>

fun <T> inferred(e: In<T>?, l: () -> T): T = l()

fun box() {
  inferred(TestJ.materialize<Unit>(), { null })
}

`materialize` has flexible type, both for `In<T>` and `T`.
When analyzing `{ null }`, collected type constraints include:
ft<Unit?, Unit> <: T (from ft<In<ft<Unit, Unit?>>, In<ft<Unit, Unit?>>?>)

By allowing the lower bound of flexible type, FIR resolution can visit
`{ null }` with the expected type Unit, which will lead to proper
coercion to Unit at the end.
2020-12-15 17:52:48 +03:00
Dmitry Petrov
b0f6461fa9 JVM_IR KT-42020 special IdSignature for some fake override members 2020-12-15 12:56:45 +03:00
Jinseong Jeon
12cfba9ca9 FIR BB: remove stale test ignoring tags in old language versions
Since bf06d381 (move old Java nullability assertion tests...),
these tests aren't used by (Fir|Ir)BlackBoxCodegenTest anymore.
2020-12-15 11:52:50 +03:00
Jinseong Jeon
f7ade2b0b8 FIR2IR: introduce implicit casts for extension receivers 2020-12-15 11:52:49 +03:00
Dmitriy Dolovov
6e9ac6b333 [Commonizer] Internal tool for tracking memory usage 2020-12-15 09:48:27 +03:00
Igor Yakovlev
010a290132 [LC] Fix for light classes equivalence 2020-12-15 01:51:23 +03:00
Igor Yakovlev
45112a3c11 [ULC] Fix invalid positive inheritor for self checking
Fixed #KT-43824
2020-12-14 20:34:42 +03:00
Svyatoslav Scherbina
0f4173cdfa Fix running stdlib tests in worker on Native
Add `@SharedImmutable` or `@ThreadLocal` where required.
2020-12-14 19:03:06 +03:00
Ilya Gorbunov
8f4e4a4d40 Specify common sources for stdlib test compilation tasks
Some multiplatform tests are compiled in single-platform projects:
- in kotlin-stdlib-jdk7
- in kotlin-stdlib-jdk8
- in kotlin-stdlib-js-ir. The latter is technically MPP but with a
single platform, so its common sources are not considered as common.

Pass information about common sources to test compilation tasks in order
to use OptionalExpectation annotations there.

Co-authored-by: Svyatoslav Scherbina <svyatoslav.scherbina@jetbrains.com>
2020-12-14 19:03:04 +03:00
Svyatoslav Scherbina
c094d77794 Fix DeepRecursiveFunction in worker on Native
Add `@SharedImmutable` to `UNDEFINED_RESULT` top-level property.
2020-12-14 19:03:03 +03:00
Svyatoslav Kuzmich
b3d8c4a0fc [JS IR] Apply missing property for all tests tasks like jsIrTest and quickTest 2020-12-14 19:00:05 +03:00
Shagen Ogandzhanian
32cc95a3b0 [JS IR] Skip export annotations while generating default stubs 2020-12-14 16:41:27 +01:00
Svyatoslav Kuzmich
7efc95705a [Wasm] Publish stdlib klib to maven 2020-12-14 17:47:19 +03:00
Svyatoslav Kuzmich
d37271bf35 [Wasm] Support packed integer array elements 2020-12-14 14:40:38 +03:00
Svyatoslav Kuzmich
51e8d782b0 [Wasm] Support packed integer class fields 2020-12-14 14:40:38 +03:00
Ilya Gorbunov
28168bf230 Correctly implement specialized MutableEntrySet.contains KT-41278
This is a workaround for the problem KT-43321.

Introduce an intermediate abstract set specialized for Map.Entry elements
and implement 'contains(Map.Entry)' method there.

Then inherit that intermediate set in entrysets of JS HashMap,
JS LinkedHashMap, JVM MapBuilder, that are specialized for
MutableMap.MutableEntry elements, so that no override of 'contains' is
required anymore.

This allows to avoid incorrect special 'contains' bridge being generated
that otherwise rejects all arguments except ones of MutableEntry type.
2020-12-14 12:42:47 +03:00
Ilya Goncharov
0a3f3bef51 [Gradle, JS]Process error output and rethrow errors and warns to console
^KT-43869 fixed
2020-12-14 11:49:40 +03:00
Dmitriy Novozhilov
55b0775565 [FE] Call SealedClassInheritorsProvider only for sealed classes 2020-12-14 10:43:14 +03:00
Andrey Uskov
0a2269cccb Fixed out-of-process compiler execution if project directy is absent
If project directory does not exist and out-of-process execution is used
the file with compiler arguments should be created in project directory
(if exists) or in temp directory.
#KT-43740 Fixed
2020-12-13 20:17:29 +03:00
Andrey Uskov
9be7221efd Clear IC caches if they were not properly closed 2020-12-13 20:17:27 +03:00
Andrey Uskov
7bdd7ce6b8 Reformat DirtyClassesMap 2020-12-13 20:17:24 +03:00
Andrey Uskov
275a02ce88 Fix synchronization when working with IC caches
IC caches could be modified and read from different threads.
In JPS builder these threads are RMI worker (invoked from Compiler
Daemon) and JPS worker thread. Proper synchronization fixes cases
when caches could become broken.
#KT-42265 Fixed
#KT-42194 Fixed
#KT-42265 Fixed
#KT-42937 Fixed
2020-12-13 20:17:22 +03:00
Andrey Uskov
af95b8d1fe Add explicit path sensitivity for InspectClassesForMultiModuleIC
Gradle uses PathSensitivity.ABSOLUTE by default, so this change
just explicitly specifies it in order to avoid warnings.
#KT-43895 Fixed
2020-12-13 20:17:20 +03:00
Andrey Uskov
2e607335db Add tests for incremental compilation of sealed interfaces 2020-12-13 20:17:18 +03:00
Andrey Uskov
36f99156fd IC of sealed classes
Supported case then children of sealed classes could be declared
anywhere in a module. If list of classes implementing sealing class
changes the sealed class and all its inheritors should be recompiled
(now sealed class should be compiled together with children in order
to calculate all possible inheritors at compile time) and and
invalidated (as they could have when operators).
2020-12-13 20:17:16 +03:00
Ilya Kirillov
a0651cdba7 FIR IDE: add Java synthetic properties support for completion 2020-12-12 12:27:48 +01:00
Ilya Kirillov
48b7150566 FIR IDE: split KtPropertySymbol into KtKotlinPropertySymbol and KtJavaSyntheticPropertySymbol 2020-12-12 12:26:56 +01:00
Ilya Kirillov
2201dd5198 FIR: make FirSyntheticPropertiesScope to be name aware 2020-12-12 12:26:56 +01:00
Kristoffer Andersen
8a5f260d04 [IR] Align debugging of suspend lambdas with old BE
The existing backend restores LVs and parameters from the suspend lambda
fields used for spilling between suspension points, hence they are
visible in the debugger as local variables, plain and simple.

This PR introduces the same pattern to the IR backend, to bring the
debugging experience in line with the existing backend.

Both backends are still at the mercy of the liveness analysis
performed in the coroutine transformer where a liveness analysis
minimizes live ranges of entries in the LVT. E.g. an unused parameter
will be dropped entirely.

Adjusted existing test expectations accounting for the differences in
LV behavior.
2020-12-12 11:48:47 +01:00
Dmitriy Dolovov
2be62c13b0 [Commonizer] Minor. Renamings
- Absent* -> Missing*
- Target -> CommonizerTarget
- Result -> CommonizerResult
- Parameters -> CommonizerParameters
2020-12-11 22:15:11 +03:00
Dmitry Petrov
b7330a9e14 JVM_IR KT-43877 fix generic signatures for SAM-converted lambdas 2020-12-11 20:26:29 +03:00
Ilmir Usmanov
dc11c2de77 IC Mangling: Use correct java field type if the type is inline class
in JVM_IR BE.
 #KT-26445
2020-12-11 17:51:39 +01:00
Ilmir Usmanov
2b0a99b7b0 IC Mangling: Use correct java field type if the type is inline class
in old JVM BE.
 #KT-26445
2020-12-11 17:51:37 +01:00
Ilmir Usmanov
69bb65496f IC Mangling: Change test since we pass boxed inline class to java method
#KT-28214
2020-12-11 17:51:34 +01:00
Ilmir Usmanov
cbb8eb494a IC Mangling: Do not mangle functions with inline classes from Java
in JVM_IR BE. Map types to boxed variants, when mapping signatures.
 #KT-26445
2020-12-11 17:51:32 +01:00
Ilmir Usmanov
0cab69a7a0 IC Mangling: Do not mangle functions with inline classes from Java
in old JVM BE. Map types to boxed variants, when mapping signatures.
 #KT-26445
2020-12-11 17:51:30 +01:00
Denis.Zharkov
5aaaa3881d Refine diagnostic text for NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER
^KT-43225 Fixed
2020-12-11 14:22:40 +03:00
Mikhael Bogdanov
b143cb9ae5 Disable new test on WASM 2020-12-11 06:36:42 +01:00
Mads Ager
c922484758 [JVM_IR] Use direct field access to backing fields on current class.
The current backend uses direct field access to the backing field
instead of calling the companion object accessor, which calls
an accessibility bridge, which then gets the field for code such as:

```
class A {
  companion object {
    val s: String = "OK"
  }

  // f uses direct access to the A.s backing field.
  fun f() = s
}
```

This change does the same for the IR backend.
2020-12-11 06:24:55 +01:00
Nikolay Krasko
1d14926444 Re-enable evaluation tests in 201 platform
Revert `[DEBUGGER] Temporary mute AbstractKotlinEvaluateExpressionTest`
(85c59328c7) in 201 bunch.
2020-12-10 22:50:57 +03:00
Vyacheslav Gerasimov
1bc369c63c Build: Enable caching for test task with enabled test distribution
#KTI-112
2020-12-10 22:02:24 +03:00
Jinseong Jeon
8f2ad57f7a FIR: pass elvis expected type to lhs/rhs 2020-12-10 20:52:49 +03:00
pyos
41f56729f9 FIR: serialize correct fqnames for local classes 2020-12-10 20:52:48 +03:00
pyos
12f936f6b7 FIR2IR: do not approximate reified type arguments to super class 2020-12-10 20:52:46 +03:00
Jinseong Jeon
148d540580 FIR checker: make unused checker visit qualified accesses in annotations
#KT-43687 Fixed
2020-12-10 20:52:45 +03:00
pyos
5efe774dba FIR: remap Java meta-annotations to Kotlin equivalents
This is a direct port of JavaAnnotationMapper from the old frontend.
2020-12-10 20:52:43 +03:00
Ilya Kirillov
a9ad85f306 FIR IDE: temporary mute find usages test as it fails because of incorrect resolve of init blocks 2020-12-10 17:55:50 +01:00
Ilya Kirillov
170928f498 FIR IDE: allow type rendering only in analysis session 2020-12-10 17:54:21 +01:00
Ilya Kirillov
f30c6bf86a FIR IDE: rework KtCall to work with error cals 2020-12-10 17:54:20 +01:00
Vyacheslav Gerasimov
e6327ef490 Build: Enable test distribution for :js:js.tests:test task 2020-12-10 19:42:32 +03:00
Vyacheslav Gerasimov
06fd7f8526 Build: Add helper to configure gradle test distribution 2020-12-10 19:42:32 +03:00
Vyacheslav Gerasimov
7bbb738a71 Build: Cleanup :js:js.tests buildscript 2020-12-10 19:42:32 +03:00
Vyacheslav Gerasimov
d43af46bf4 Build: Add V8 engine & repl.js to js tests inputs 2020-12-10 19:42:31 +03:00
Mads Ager
fadedc84db [JVM_IR] Refactor and add bytecode text tests for compose-like code.
Tests that the default argument mask is not in the local variable
table.
2020-12-10 17:22:18 +01:00
Mads Ager
83588e9f22 [JVM_IR] Add tests of Compose-like default argument handling. 2020-12-10 17:22:18 +01:00
Mads Ager
a7efa5c98b [IR] Fix remapping of arguments in LocalDeclarationsLowering.
It only remapped arguments for IrGetValue and not for IrSetValue.
This is hitting Compose which has non-standard default argument
handling.
2020-12-10 17:22:18 +01:00
Ilya Goncharov
167e60b9fb [JS IR] Assert createdOn equals 0 for properties initialization fun for file 2020-12-10 18:07:50 +03:00
Dmitry Petrov
5be28520fc JVM_IR KT-43851 preserve static initialization order in const val read 2020-12-10 17:55:13 +03:00
Dmitry Petrov
b0ef6ee1fc JVM_IR Minor: refactor rawType 2020-12-10 17:55:13 +03:00
Denis.Zharkov
f4a25066a8 Fix freshly added CLI tests for windows agents 2020-12-10 16:15:29 +03:00
Mikhail Glukhikh
dd66da7c65 Optimize FirJavaSyntheticNamesProvider.possibleGetterNamesByPropertyName 2020-12-10 15:29:46 +03:00
Mikhail Glukhikh
6d545fc281 Make FirTowerLevel an abstract class 2020-12-10 15:29:46 +03:00
Mikhail Glukhikh
34d7a7c184 FIR tower levels: inline processElementsByName[AndStoreResult] 2020-12-10 15:29:46 +03:00
Mikhail Glukhikh
af4941b222 [FIR] Drop delayedNode from ControlFlowGraph.orderNodes 2020-12-10 15:29:45 +03:00
Mikhail Glukhikh
7b277600a9 Optimize/simplify loadFunctions(Properties)ByName in FIR deserializer 2020-12-10 15:29:45 +03:00
Mikhail Glukhikh
e51503ab42 Code cleanup: KotlinDeserializedJvmSymbolsProvider 2020-12-10 15:29:45 +03:00
Mikhail Glukhikh
1383e923ea Drop KotlinDeserializedJvmSymbolsProvider.findRegularClass 2020-12-10 15:29:45 +03:00
Mikhail Glukhikh
7e99f0ee23 Optimize ConeInferenceContext.typeDepth a bit 2020-12-10 15:29:44 +03:00
Mikhail Glukhikh
67c7b5ca0a Optimize/simplify FirAbstractImportingScope.getStaticsScope 2020-12-10 15:29:44 +03:00
Mikhail Glukhikh
d90cc452fe Simplify: FirSymbolProvider.getClassDeclaredPropertySymbols 2020-12-10 15:29:44 +03:00
Mikhail Glukhikh
e344d9e438 Drop unused functions from FirBuiltinSymbolProvider 2020-12-10 15:29:44 +03:00
Mikhail Glukhikh
bb0410b143 [FIR] Drop unused utility functions from StandardTypes.kt 2020-12-10 15:29:43 +03:00
Yunir Salimzyanov
f88d51613f Remove old 193 and as40 bunches 2020-12-10 14:57:16 +03:00
Mikhail Glukhikh
bf8de487a0 CliTrace: rewrite smart cast-vulnerable piece of code 2020-12-10 13:02:49 +03:00
LepilkinaElena
c8c83c04c0 [IR] Fix saving function calls during inlining const properties in PropertyAccessorInlineLowering (#3971) 2020-12-10 12:24:23 +03:00
Ilmir Usmanov
dccfb33bcc JVM_IR: Unbox argument of type kotlin.Result
if the argument has different type in parent: either generic or Any.
 #KT-41163 Fixed
 #KT-43536 Fixed
2020-12-10 08:27:32 +01:00
Ilmir Usmanov
775d610045 Value classes: Forbid any identity equality check on value class
#KT-31130 Fixed
2020-12-10 08:24:48 +01:00
Denis.Zharkov
7e088457a2 Temporary clear sinceVersion for ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
^KT-36770 Related
^KT-26245 Related
2020-12-10 10:20:30 +03:00
Dmitriy Novozhilov
dbc85a5f18 [TEST] Fix compilation of CodegenTestsOnAndroidGenerator.kt 2020-12-10 01:31:05 +03:00
Dmitriy Novozhilov
b416c669b0 [TEST] Update testdata due to dropped COMMON_COROUTINE_TEST directive 2020-12-10 01:31:04 +03:00
Dmitriy Novozhilov
aacf934b49 [TEST] Drop machinery about experimental coroutines from compiler tests 2020-12-10 01:31:02 +03:00
Dmitriy Novozhilov
8c4b7ad1e1 [TEST] Drop generating tests for coroutines of Kotlin 1.2 2020-12-10 01:31:01 +03:00
Vyacheslav Gerasimov
0389589d83 Build: Setup inputs and outputs for :js:js-tests:test task properly
All task inputs should be declared and separated from outputs produced
by it (e.g. node modules and js compile outputs) to make gradle test
distribution work
2020-12-10 00:17:27 +03:00
Dmitriy Novozhilov
d5c1e5681c [IR] Don't assume subclasses as part of member scope of sealed class 2020-12-09 22:54:39 +03:00
Dmitriy Novozhilov
b6bd7c48f4 [FE] Rename FreedomForSealedClasses feature with more meaningful name 2020-12-09 22:54:38 +03:00
Dmitriy Novozhilov
77aad06008 [FE] Add bunch files to fix compilation on 201 platform 2020-12-09 22:54:37 +03:00
Dmitriy Novozhilov
3246e6b9ac [IC] Add ability to pass additional compiler args to IC tests
Additional arguments should be declared in `args.txt` file in test
  directory in common CLI arguments format
2020-12-09 22:54:36 +03:00
Dmitriy Novozhilov
57a081c399 [FE] Prohibit inheritance of sealed classes in different module
KT-20423
2020-12-09 22:54:34 +03:00
Dmitriy Novozhilov
f8d6f79c17 [FE] Temporary disable exhaustiveness checker for java sealed classes
KT-43551
KT-41215
2020-12-09 22:54:33 +03:00
Dmitriy Novozhilov
1c9f9130e6 [FE] Prohibit implementing java sealed classes 2020-12-09 22:54:32 +03:00
Dmitriy Novozhilov
6809adee9c [FE] Extract computation of sealed class inheritors into separate component
This is needed to provide more optimal provider in IDE plugin
2020-12-09 22:54:31 +03:00
Dmitriy Novozhilov
c0a1aecf9b [FE] Add test for compiling against library with kotlin sealed classes and interfaces
#KT-20423
#KT-13495
2020-12-09 22:54:30 +03:00
Dmitriy Novozhilov
7897bb6adb [FE] Support sealed classes and interfaces from java
KT-43551
KT-41215
2020-12-09 22:54:29 +03:00
Dmitriy Novozhilov
bdfb71b149 [FE] Add sealed classes related properties to java model 2020-12-09 22:54:28 +03:00
Dmitriy Novozhilov
8e9e34350f [FE] Properly support sealed interfaces in exhaustiveness checker
#KT-20423
2020-12-09 22:54:27 +03:00
Dmitriy Novozhilov
9609954560 [FE] Allow using sealed modifier on interface and compute sealed modality for them
#KT-20423
2020-12-09 22:54:26 +03:00
Dmitriy Novozhilov
d605c7e491 [FE] Prohibit inheritors of sealed classes which are declared in different package
#KT-13495
2020-12-09 22:54:25 +03:00
Dmitriy Novozhilov
e76acc8ee0 [FE] Collect inheritors of sealed classes from new places in computeSealedSubclasses
#KT-13495
2020-12-09 22:54:24 +03:00
Dmitriy Novozhilov
70c61be1ef [FE] Allow declare sealed class inheritors as inner or nested classes
#KT-13495
2020-12-09 22:54:22 +03:00
Dmitriy Novozhilov
f5f1984a60 [FE] Allow declare sealed class inheritors in different files in one module
#KT-13495
2020-12-09 22:54:21 +03:00
Jiaxiang Chen
1a377069dd Allow AnalysisHandlerExtension to provide additional classpath on retry 2020-12-09 22:15:36 +03:00
Jiaxiang Chen
a6cb156ce9 Allow multiple retry for AnalysisHandlerExtension 2020-12-09 22:15:36 +03:00
Dmitry Petrov
313dfaf48c JVM_IR KT-43812 erase generic arguments of SAM wrapper supertype 2020-12-09 20:06:02 +03:00
Mikhail Glukhikh
5daa406cdf Use FirNamedFunctionSymbol in FirScope.processFunctionsByName 2020-12-09 19:53:27 +03:00
Jinseong Jeon
2dfba10d84 FIR: extend suspend conversion to intersection type 2020-12-09 19:53:25 +03:00
Mikhail Glukhikh
42ea4463ee Fix type argument inconsistency in FirResolvedQualifier 2020-12-09 19:53:24 +03:00
Mikhail Glukhikh
d6e144c80e [FIR] Extend callableNames known for JvmMappedScope 2020-12-09 19:53:23 +03:00
Mikhail Glukhikh
94014ba3eb Fir2IrLazyClass: don't generate non-f/o properties from superclass 2020-12-09 19:53:22 +03:00
Mikhail Glukhikh
9b0ada2b0f [FIR2IR] Generate f/o overridden symbol with FakeOverrideGenerator
#KT-43669 Fixed
2020-12-09 19:53:21 +03:00
Mikhail Glukhikh
91834ccf46 Use FirNamedFunctionSymbol in FirSimpleFunction & its inheritors 2020-12-09 19:53:19 +03:00
Mikhail Glukhikh
15021f30ff Use FirNamedFunctionSymbol around processOverriddenFunctions 2020-12-09 19:53:18 +03:00
Alexander Udalov
8fedfd2d2a Minor, add workaround for KT-43812 2020-12-09 19:37:49 +03:00
Dmitriy Novozhilov
2b22cbcdd2 Advance bootstrap to 1.5.0-dev-309 2020-12-09 19:37:47 +03:00
anastasiia.spaseeva
38b59ddabf Wizard: Fix tests 2020-12-09 18:16:07 +03:00
anastasiia.spaseeva
71459db9dd Wizard: Do not add bintray repoitory for eap versions 2020-12-09 18:16:06 +03:00
Denis.Zharkov
2d8a8d252b Add 201 bunch files for JavaClass implementations
In 201, there's an old ASM version and PSI doesn't have record-related API
2020-12-09 16:47:25 +03:00
Denis.Zharkov
5a006a3690 Minor. Specify targetBackend for new IR tests 2020-12-09 16:47:25 +03:00
Denis.Zharkov
92b402759b Report incorrect JVM target only when @JvmRecord is actually used 2020-12-09 16:47:25 +03:00
Denis.Zharkov
920ed558ee Add some tests on corner cases for @JvmRecord 2020-12-09 16:47:25 +03:00
Denis.Zharkov
3aa55620d0 Prohibit explicit j.l.Record supertype even for @JvmRecord 2020-12-09 16:47:25 +03:00
Denis.Zharkov
2b29e70b64 Temporary avoid using constant from the new ASM
To make it compilable with 201 platform
2020-12-09 16:47:25 +03:00
Denis.Zharkov
f399f013dd Temporary add another env variable JDK_15_0 that is set on TC agents 2020-12-09 16:47:24 +03:00
Denis.Zharkov
46c3979acd Separate JVM target option from javac's --enable-preview analogue 2020-12-09 16:47:24 +03:00
Denis.Zharkov
3abd8b1ab2 Adapt CliTests for api requirement of @JvmRecord 2020-12-09 16:47:24 +03:00
Denis.Zharkov
dc1a1c5821 Support cross-module usages of @JvmRecord classes
The problem is that JvmRecord has SOURCE retention
Probably, increasing its retention might be a more reliable solution
(or in some other way serializing that the class is a record)

Just checking supertypes seems like a reasonable approximation:
only records kotlin are allowed to extend j.l.Record.
But the relevant diagnostic has been added only since 1.4.30,
so potentially there could have been exist a non-record class with
such supertype compiled by 1.4.20, but this case seems to be ill-formed
and marginal anyway.

For Java classes, it's irrelevant since they don't have member properties
(only synthetic extensions)

^KT-43677 In Progress
2020-12-09 16:47:24 +03:00
Denis.Zharkov
ac0604377d Minor. Extract runJvmInstance for running BB tests with custom JVM 2020-12-09 16:47:23 +03:00
Denis.Zharkov
6e4f84dddf Add @SinceKotlin("1.5") on JvmRecord annotation 2020-12-09 16:47:23 +03:00
Denis.Zharkov
ddbd62054f Prohibit extending java.lang.Record from non-@JvmRecord classes 2020-12-09 16:47:23 +03:00
Denis.Zharkov
695d0dbfbb Check JvmRecordSupport language feature before generating synthetic properties 2020-12-09 16:47:23 +03:00
Denis.Zharkov
a4bf36aee7 Support @JvmRecord for JVM_IR
^KT-43677 In Progress
2020-12-09 16:47:23 +03:00
Denis.Zharkov
f64980a597 Add check for bytecode target when @JvmRecord is used
^KT-43677 In Progress
2020-12-09 16:47:23 +03:00
Denis.Zharkov
b860a0c664 Separate JvmTarget::bytecodeVersion version into major/minor parts 2020-12-09 16:47:22 +03:00
Denis.Zharkov
c8851c4f75 Prohibit @JvmRecord for non-data classes
^KT-43677 In Progress
2020-12-09 16:47:22 +03:00
Denis.Zharkov
cc0b584445 Adapt test infrastructure to the latest changes
^KT-43677 In Progress
2020-12-09 16:47:22 +03:00
Denis.Zharkov
1d873a1a73 Move earlier generated tests
^KT-43677 In Progress
2020-12-09 16:47:22 +03:00
Denis.Zharkov
033f43794d Prohibit irrelevant fields in @JvmRecord classes
^KT-43677 In Progress
2020-12-09 16:47:22 +03:00
Denis.Zharkov
1b575d7903 Add initial support for @JvmRecord in backend
- Write relevant class files attributes
- Emit property accessors with records-convention: propertyName -> propertyName()

^KT-43677 In Progress
2020-12-09 16:47:21 +03:00
Denis.Zharkov
26d525fa3c Prepare ClassBuilder for record components
^KT-43677 In Progress
2020-12-09 16:29:04 +03:00
Denis.Zharkov
f6a3580c93 Add @JvmRecord diagnostics for open and enums
^KT-43677 In Progress
2020-12-09 16:29:04 +03:00
Denis.Zharkov
bef50c0342 Correct descriptor shape for @JvmRecord annotated classes
This commit adds relevant functions: hashCode, toString, equals
(if the class is not a data class)
And supertype j.l.Record

It only affects descriptor contents, i.e. works for FE

^KT-43677 In Progress
2020-12-09 16:29:04 +03:00
Denis.Zharkov
ca2e199b53 Minor. Move @JvmRecord tests to relevant directory
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
d4de2c4dce Add check that we have JDK 15 in classpath when using @JvmRecord
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
85962d8312 Add check that @JvmRecord classes cannot inherit other classes
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
4f5db241ea Add @JvmRecord annotation and relevant diagnostics
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
059e2aab7a Make BlackBox tests for Java 9 generated 2020-12-09 16:29:03 +03:00
Denis.Zharkov
5d05419016 Add simple JDK15 BlackBox test
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
513f7177ca Support loading Java records
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Denis.Zharkov
f25b7672a7 Introduce FULL_JDK_15 TestJdkKind 2020-12-09 16:29:03 +03:00
Denis.Zharkov
430da22b4b Setup 15_PREVIEW LanguageLevel for Java sources in CLI
It's necessary to read preview-features related Java PSI parts
It should be OK to set it unconditionally because we don't compile Java
sources, only obtain declaration structure from them
2020-12-09 16:29:02 +03:00
Ilya Goncharov
ff52a3f867 [Gradle, JS] Null library and libraryTarget when they are null
^KT-43842 fixed
2020-12-09 15:59:40 +03:00
Svyatoslav Kuzmich
d4233f3f0e [Wasm] Use Wasm GC arrays instead of JS arrays
JS arrays was a workaround for lack of arrays in Firefox Wasm GC prototype
Now with V8 as a test runner we can use proper arrays
2020-12-09 15:56:45 +03:00
Svyatoslav Kuzmich
d15af70a3e [Wasm] Refactoring: replace "struct types" with "GC types"
In preparation for adding array types
2020-12-09 15:56:45 +03:00
Svyatoslav Kuzmich
4bb163fd1f [Wasm IR] Add missing GC and function reference instructions 2020-12-09 15:56:44 +03:00
Svyatoslav Kuzmich
6063353b64 [Wasm] Generate stdlib WasmOp based on WasmOp from Wasm IR 2020-12-09 15:56:44 +03:00
Mikhael Bogdanov
1cfb81455c Generate correct names for companion @JvmStatic accessors in annotation class
#KT-31389 Fixed
2020-12-09 13:26:14 +01:00
Alexander Udalov
3e0efeef31 JVM IR: add test for complex generic diamond hierarchy
This is a test for KT-43832, which is fixed in the previous commit.
2020-12-09 10:52:18 +01:00
Alexander Udalov
3370fa03d7 Revert "JVM IR: remove obsolete isDefaultImplsBridge in findInterfaceImplementation"
This reverts commit d41d1bf64d.
2020-12-09 10:52:18 +01:00
Dmitry Petrov
69c88a8a0a PSI2IR KT-41284 use getters for open data class property values
'allopen' compiler plug-in can make data classes and their members open,
which is a compilation error in usual case, but makes sense for Spring
and other frameworks that generate proxy-classes.
2020-12-09 10:29:09 +03:00
Ilmir Usmanov
d8d30263d3 IC Mangling: search parents for method if descriptor is fake override
Otherwise, the compiler generates call using old mangling scheme
because classfile does not contain the method.
2020-12-09 07:34:29 +01:00
Alexander Dudinsky
e089e3606f Disable testSingleAndroidTarget while OOM investigation in progress KT-43755 2020-12-09 09:27:34 +03:00
Nikolay Krasko
df9ecb0f4a Dependency of js tests generation on compiler test data generation (KTI-404)
There was an error during "Generate Compiler Tests" execution:

Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: compiler\testData\codegen\box\ranges\expression\inexactDownToMinValue.kt

The error was probable caused by parallel execution of tasks:compiler:generateTests and :js:js.tests:generateTests.

Exception could occur when GenerateRangesCodegenTestData.main(args) has
just removed directory with test data for regeneration but
:js:js.tests:generateTests had already seen files present.

 #KTI-404 Fixed
2020-12-09 00:58:07 +03:00
Ilya Kirillov
0ca7c50452 FIR IDE: refactor, separate resolveSimpleNameReference into functions 2020-12-08 22:26:24 +01:00
Mads Ager
717e087fd9 [JVM] Do not collaps unrelated locals in state machine transform. 2020-12-08 18:12:19 +01:00
Mads Ager
1bb864bbb0 [JVM] Add tests that expose problem with locals collapsing.
The collapsing happens during suspend function state machine
transformation.
2020-12-08 18:12:19 +01:00
Nikolay Krasko
8e38f9d176 Stop mangle common project descriptor in GenerateTestSupport tests
Use custom project descriptor instead.

Mitingate flaky failures:

ERROR: Save settings failed
java.lang.RuntimeException: java.io.IOException: Cannot save /test_path/test.ipr.
Unable to open the file for writing.
  at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:116)
  at com.intellij.util.lang.CompoundRuntimeException.throwIfNotEmpty(CompoundRuntimeException.java:106)
  at com.intellij.configurationStore.SaveResult.throwIfErrored(SaveResult.kt:59)
  at com.intellij.configurationStore.ComponentStoreImpl.save$suspendImpl(ComponentStoreImpl.kt:152)
  at com.intellij.configurationStore.ComponentStoreImpl$save$1.invokeSuspend(ComponentStoreImpl.kt)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
  at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
  at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
  at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
  at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
  at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
  at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
  at com.intellij.configurationStore.StoreUtil$Companion.saveSettings(storeUtil.kt:44)
  at com.intellij.configurationStore.StoreUtil.saveSettings(storeUtil.kt)
  at com.intellij.openapi.project.impl.ProjectImpl.save(ProjectImpl.java:157)
  at org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest$setUpTestSourceRoot$1.invoke(AbstractGenerateTestSupportMethodActionTest.kt:22)
  at org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest$setUpTestSourceRoot$1.invoke(AbstractGenerateTestSupportMethodActionTest.kt:20)
2020-12-08 18:52:38 +03:00
Nikolay Krasko
b0347c3822 Stable order of generation and errors in ConvertSealedClassToEnumIntention 2020-12-08 18:52:36 +03:00
Mikhail Zarechenskiy
2ad4824eb0 Fix exception on resolving collection literal inside lambda
#KT-31907 Fixed
 #EA-90906 Fixed
2020-12-08 12:55:25 +03:00
Mikhael Bogdanov
c5015c9294 Don't recognize IrVariable as declaration scope in inlining
#KT-42815 Fixed
2020-12-08 06:16:12 +01:00
Ilmir Usmanov
7f51f57998 Generate correct $default method for actual suspend function
In order to do this, we need to get initial expect suspend function
before generating default value parameters checks.
 #KT-43587 Fixed
2020-12-08 04:36:38 +01:00
Ilmir Usmanov
0dc5f3ac00 IC: call JvmDefault method of inline class using boxed receiver
#KT-43698 Fixed
2020-12-08 04:33:36 +01:00
Ilya Kirillov
d6330337a9 FIR IDE: introduce param for enabling disabled tests 2020-12-07 17:46:46 +01:00
Ilya Kirillov
a671054fa3 FIR IDE: change until-build to 203.* in plugin.xml 2020-12-07 17:45:22 +01:00
Vyacheslav Gerasimov
b6d80a1149 Build: Fix kotlin-compiler-internal-test-framework empty sources jar
Should also pack pack test source set from :compiler:tests-common
2020-12-07 19:16:43 +03:00
Nikolay Krasko
1d51dffd76 Reminder about -Pidea.fir.plugin=true for running fir-idea tests 2020-12-07 18:42:36 +03:00
Zalim Bashorov
e5c62c3838 [JS] Disable special checks in labeled-block-to-do-while 2020-12-07 17:27:24 +03:00
Zalim Bashorov
7ca54ec405 [JS IR] unmute test arraySort.kt 2020-12-07 17:27:23 +03:00
Zalim Bashorov
4c69f78de8 [JS] Replace J2V8 based ScriptEngine with a process-based version
The main advantage of this is that we can use a newer and official build of V8.
Also, with new infra, we can use other JS engines.

Other changes:
 * ScriptEngine API is simplified and documented.
 * Introduce ScriptEngineWithTypedResult with typed `eval`, mostly for JsReplEvaluator and JsScriptEvaluator.
 * J2V8 version is completely removed.
 * Use new ScriptEngineV8 everywhere by default.
 * System property `kotlin.js.useNashorn` switches to Nashorn in all tests.
2020-12-07 17:27:23 +03:00
Zalim Bashorov
39cc149da0 [JS] Revert disabling running ES6 tests on all platforms except linux
Revert "[JS TESTS] Emulate failing of non-run tests"

This reverts commit 2fd69218

Revert "[JS TESTS] Don't run ES6 test on win & mac till j2v8 issue is fixed."

This reverts commit 08624165

Revert "[JS TESTS] Add EP to disable run test on specific platform"

This reverts commit 50162265
2020-12-07 17:27:23 +03:00
Zalim Bashorov
2cb4a4906f [JS] Remove j2v8 from dependencies 2020-12-07 17:27:22 +03:00
Zalim Bashorov
f4431a21fc [JS] Make all JS test tasks depending on setupV8 2020-12-07 17:27:22 +03:00
Zalim Bashorov
9cc3725db1 [JS] Move JS engines download and setup code higher to use it from other tasks 2020-12-07 17:27:21 +03:00
Zalim Bashorov
bc4c2349c0 [JS] Extract engine setup related code from wasmTest 2020-12-07 17:27:21 +03:00
Zalim Bashorov
70eb3d2486 [JS] BasicBoxTest.kt: cleanup 2020-12-07 17:27:20 +03:00
Zalim Bashorov
f573b81456 [JS] Minor: fix typo in AntTaskJsTest 2020-12-07 17:27:20 +03:00
Mikhael Bogdanov
b8903f8cf8 Enable kotlin-annotation-processing-cli tests on TC 2020-12-07 12:38:12 +01:00
Ivan Gavrilovic
078aa18479 Fix KAPT cli tests on windows
- Fix line separator issue
- Always quote args with delimiters (=, :)
- fix one of args files by removing obsolete stdlib reference
- Fix kotlinc.bat to ensure lazy evaluation of additional classpath
2020-12-07 12:36:59 +01:00
Ilya Goncharov
82ad230e0d [Gradle, JS] Add nodeArgs to NodeJsExec
^KT-43793 fixed
2020-12-07 13:08:47 +03:00
Jinseong Jeon
cdfe1771d9 FIR DFA: reimplement type OR operation to its original semantics
#KT-43569 Fixed
2020-12-07 10:50:19 +03:00
Jinseong Jeon
16b9312695 FIR DFA: refactor type statements manipulation 2020-12-07 10:50:19 +03:00
Jinseong Jeon
7ea58adc50 FIR: reproduce KT-43569 2020-12-07 10:50:19 +03:00
Nikita Bobko
0d8cdb7bdb Fix double registered "com.intellij.psi.classFileDecompiler" for 203 platform
This commit addresses 1243c641296e74a572a4f274df72a4cda60635c6 in intellij
In intellij they added registration of "com.intellij.psi.classFileDecompiler" in
`JavaCoreApplicationEnvironment`. And because the `KotlinCoreApplicationEnvironment` inherits
`JavaCoreApplicationEnvironment` we don't need to register this EP ourselves.

This commit fixes in 203 tests + 1.4.30 compiler:
```
java.lang.RuntimeException: Duplicate registration for EP 'com.intellij.psi.classFileDecompiler': first in com.intellij.openapi.extensions.DefaultPluginDescriptor@44f464d1, second in PluginDescriptor(name=org.jetbrains.kotlin, id=org.jetbrains.kotlin, path=/home/builduser/.m2/repository/org/jetbrains/kotlin/kotlin-compiler-for-ide/1.4.30-M1-30/kotlin-compiler-for-ide-1.4.30-M1-30.jar, version=1.2)
	at com.intellij.openapi.components.ComponentManager.createError(ComponentManager.java:167)
	at com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.registerExtensionPoints(ExtensionsAreaImpl.java:262)
	at com.intellij.ide.plugins.PluginManagerCore.registerExtensionPointAndExtensions(PluginManagerCore.java:1334)
	...
```
2020-12-07 10:18:38 +03:00
Nikolay Krasko
5f91f79382 Remove usage of idea file systems for checking js libraries
The removed code is probably an outdated code from the age when Kotlin
compiler was using VirtualFiles for operating. Previously the links were
stored and passed further, but now it is only some additional check
(files are unused after the check) with an implicit dependency to
IDEA internals.

The deleted check could probably be responsible for handling references
to JS libraries because of the working compiler daemon.

The code was spotted during an investigation for the
2bf22caeb7 commit (there's a detailed
description in the commit message).
2020-12-05 22:22:30 +03:00
Jinseong Jeon
c959ad7911 FIR checker: revisit per-label iterations to avoid !! 2020-12-05 12:26:05 +03:00
Jinseong Jeon
762e315ce3 FIR checker: deprecate path-insensitive data collection 2020-12-05 12:25:59 +03:00
Jinseong Jeon
168503573a FIR checker: make unused checker path-sensitive 2020-12-05 12:25:55 +03:00
Jinseong Jeon
3d7d87ace5 FIR: keep nullability of lambda return type 2020-12-05 12:25:50 +03:00
Mikhael Bogdanov
28a1d1ceac Disable test on Windows
#KTI-405
2020-12-05 07:18:45 +01:00
Alexander Udalov
c87edc44f3 Fix compilation error in :noarg-ide-plugin
Was overlooked in a06bffc4b9.
2020-12-05 00:59:18 +01:00
Ilmir Usmanov
69be56d042 Value classes: Forbid cloneable value classes
#KT-43741 Fixed
2020-12-04 23:27:46 +01:00
Alexander Udalov
25c228297a JVM IR: support noarg compiler plugin
#KT-41265 Fixed
2020-12-04 22:12:58 +01:00
Alexander Udalov
a06bffc4b9 Noarg: prohibit noarg for inner and local classes
Report warning if old JVM backend is used, and error for JVM IR, which
is supposed to be enabled as default in the next Kotlin release.

 #KT-43725 Fixed
2020-12-04 22:12:58 +01:00
Alexander Udalov
a343fffe9e Noarg: somewhat refactor tests
Extract method that registers components, merge abstract test classes
into one file.
2020-12-04 22:12:57 +01:00
Alexander Udalov
b10e206144 IR: minor, deduplicate unbound symbol in error message 2020-12-04 22:12:57 +01:00
Nikolay Krasko
bf4f2605d4 Mark FirPsiCheckerTestGenerated.Regression.testJet53 as FLAKY 2020-12-04 19:42:17 +03:00
Vyacheslav Gerasimov
7354bcbc99 Build: Publish kotlin-compiler-internal-test-framework maven artifact 2020-12-04 19:15:12 +03:00
Mads Ager
5d9e86863a [IR] Make isHidden and isAssignable explicit on IrValueParameter.
There were a couple of places where they were confused and
isAssignable was passed as a positional parameter in the position
of isHidden.
2020-12-04 17:04:45 +01:00
Dmitry Petrov
3dbe02b7fe JVM_IR KT-43109 generate internal bridge for custom internal 'toArray'
Also add some tests for internal collection stubs.
2020-12-04 18:57:10 +03:00
Ilya Gorbunov
149bcc2d22 Revert using regex Pattern in String.replace
Use String.indexOf(..., ignoreCase) instead in all branches to preserve
compatibility with behavior before 1.4.20 that used String.split which
essentially relied on that String.indexOf

#KT-43745 Fixed
2020-12-04 17:43:54 +03:00
Jinseong Jeon
5167d69b7c FIR checker: introduce member property checker 2020-12-04 16:58:30 +03:00
Nikolay Krasko
2bf22caeb7 Revert "Keep application environment alive between JPS tests"
This reverts commit 175dd567

The revert fixes the flaky behaviour on Windows in jps-plugin tests.

java.lang.RuntimeException: java.nio.file.FileSystemException:
tempdir_path\jps-build\jslib-example.jar:
The process cannot access the file because it is being used by another process.

Can be reproduced when running KotlinJpsBuildTest after IncrementalJsJpsTestGenerated.

1. IncrementalJsJpsTestGenerated sets KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
2. KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY disables environment clean-up.
3. No disposeApplicationEnvironment() call also means no ZipHandler.clearFileAccessorCache()
4. There's jslib-example.jar opening in JsConfig.checkLibFilesAndReportErrors()
5. File handler is not closed and tests fails in tearDown()

Affected tests:
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibraryCustomOutputDir
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibraryAndErrors
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibrary
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithLibraryNoCopy
KotlinJpsBuildTest.testKotlinJavaScriptProjectWithTwoModulesAndWithLibrary
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibraryCustomOutputDir
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibraryAndErrors
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibrary
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithLibraryNoCopy
KotlinJpsBuildTestIncremental.testKotlinJavaScriptProjectWithTwoModulesAndWithLibrary
2020-12-04 14:09:36 +03:00
Nikolay Krasko
2d8bdcbc9b Minor: use unique temp directories in jps-build tests 2020-12-04 14:09:36 +03:00
Igor Yakovlev
1ee0892f73 [ULC] Fix NPE on generating data class ctor parameters 2020-12-04 13:07:20 +03:00
Ilmir Usmanov
f43899086a Value Classes: Forbid var properties with value class receivers 2020-12-04 09:45:56 +01:00
Ilmir Usmanov
19b16da183 Minor. Add test to check value classes 2020-12-04 09:19:05 +01:00
Ilmir Usmanov
0d55c9108d IC: Forbid inner classes inside inline classes
#KT-43067 Fixed
2020-12-04 05:45:53 +01:00
Ilmir Usmanov
15c325cf10 Value classes: Allow nested inline classes 2020-12-04 05:45:51 +01:00
Vyacheslav Gerasimov
235813736e Build: Set file access rights explicitly in kotlin-stdlib-js jar
Workaround for #KTI-401. Since gradle 6.6 ant.replaceregexp call sets
incorrect access rights `-rw-------` instead of `-rw-r--r--`
2020-12-04 01:47:18 +03:00
Mikhail Glukhikh
4626f21c58 Record type arguments for FirResolvedQualifier 2020-12-03 19:33:51 +03:00
Mikhail Glukhikh
68d271fc91 Move FirModifierList inside FirModifierChecker to reduce its scope 2020-12-03 19:33:51 +03:00
Mikhail Glukhikh
94ddb71213 [FIR] Simplify UnusedChecker & delete FirSourceChildren.kt 2020-12-03 19:33:51 +03:00
Mikhail Glukhikh
8abf27898d Simplify FirMemberDeclaration.implicitModality 2020-12-03 19:33:51 +03:00
Mikhail Glukhikh
5fbdc0af5e [FIR] Introduce & use MODALITY_MODIFIER positioning strategy 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
54f9edb597 Simplify RedundantVisibilityModifierChecker 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
b1c9d4b046 [FIR] Introduce & use VISIBILITY_MODIFIER positioning strategy 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
7f1b539011 [FIR] Simplify CanBeValChecker.getDestructuringChildrenCount 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
3877933913 [FIR] Adapt VAL_OR_VAR strategy & use it in CanBeValChecker 2020-12-03 19:33:50 +03:00
Mikhail Glukhikh
ea7d738ee1 [FIR] Introduce & use SourceElementPositioningStrategies.OPERATOR 2020-12-03 19:33:49 +03:00
Mikhail Glukhikh
c9806c5af9 [FIR] Simplify RedundantExplicitTypeChecker 2020-12-03 19:33:49 +03:00
Ilmir Usmanov
516fce37db Value classes: Allow unsigned arrays in annotations
including varargs, apparently.
So, we allow unsigned types and unsigned arrays in annotations,
but disallow user-defined inline classes.
 #KT-23816 Fixed
2020-12-03 17:22:08 +01:00
Alexander Udalov
a9c072f826 Regenerate compiler tests 2020-12-03 17:02:35 +01:00
Dmitry Petrov
caea0a9df0 JVM_IR KT-43721 coerce intrinsic result to corresponding unsigned type 2020-12-03 16:44:26 +03:00
Mads Ager
c776fcbd00 [JVM_IR] Fix incorrect name in inner class attributes. 2020-12-03 13:41:36 +01:00
Mads Ager
fae5b8da4b [JVM] Do not put the name of default lambda parameter in LVT.
If we do, the local variable table will not make sense. As as
example:

```
inline fun foo(getString: () -> String = { "OK" }) {
  println(getString())
}

inline fun bar() {
}

fun main() {
    bar()
    foo()
}
```

leads to the following bytecode:

```
  public static final void main();
    descriptor: ()V
    flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL
    Code:
      stack=2, locals=4, args_size=0
         0: iconst_0
         1: istore_0
         2: nop
         3: nop
         4: iconst_0
         5: istore_1
         6: nop
         7: ldc           #53                 // String OK
         9: astore_2
        10: iconst_0
        11: istore_3
        12: getstatic     #30                 // Field java/lang/System.out:Ljava/io/PrintStream;
        15: aload_2
        16: invokevirtual #36                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
        19: nop
        20: return
      LineNumberTable:
        line 9: 0
        line 13: 2
        line 10: 3
        line 14: 4
        line 15: 6
        line 16: 7
        line 17: 19
        line 11: 20
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            2       1     0 $i$f$bar   I
            6      14     1 $i$f$foo   I
            4      16     0 getString$iv   Lkotlin/jvm/functions/Function0;
```

The `getString$iv` local should not be there. It has been inlined away.
Leaving it in the local variable table leads to inconsistent locals
info. Local 0 contains an int but we declare a local of type
Function0.
2020-12-03 13:41:36 +01:00
Dmitriy Dolovov
e5c46a86aa [Commonizer] Minor. Rename file 2020-12-03 15:33:26 +03:00
Dmitriy Dolovov
daf42c1ee6 [Commonizer] Remove unnecessary nullability at CirKnownClassifiers.commonDependeeLibraries 2020-12-03 15:33:20 +03:00
Vladimir Dolzhenko
984b3c2f30 Fix to address platform expectation for project path
Project path has to be absolute
2020-12-03 12:35:31 +01:00
Dmitriy Dolovov
68f8e88d8b [Commonizer] Introduce various types of classifier caches
- New CirCommonizedClassifiers and CirForwardDeclarations caches
- New CirProvidedClassifiers cache with classifier names loaded from arbitrary modules
- CirClassifiersCache is replaced by CirKnownClassifiers umbrella
- Replace the remaining usages of 'isUnderStandardKotlinPackages' by delegation to
  CirKnownClassifiers.commonDependeeLibraries
2020-12-03 13:11:40 +03:00
Dmitriy Dolovov
dce3d4d1b7 [Commonizer] Rename InputTarget and OutputTarget
Rename target classes to better reflect their meaning:
- InputTarget -> LeafTarget
- OutputTarget -> SharedTarget
2020-12-03 13:11:33 +03:00
Dmitriy Dolovov
b0ff3e7e5e [Commonizer] More fine-grained control of commonized module dependencies
- Reduce usage of 'isUnderStandardKotlinPackages' check in commonizer source code
- Rely on common module dependencies supplied via commonizer Parameters which not only
  Kotlin standard library but may also include common fragments of other libraries
2020-12-03 13:11:27 +03:00
LepilkinaElena
9d749feb64 Fix gradle test for endorsed libraries in K/N (#3953) 2020-12-03 12:57:02 +03:00
Victor Petukhov
d25ad269e0 Reuse captured arguments for flexible type's bounds properly, by equality of type constructors modulo mutability and type argument
^KT-43630 Fixed
2020-12-03 11:13:41 +03:00
Victor Petukhov
9f58e4bcfe Add FlexibleTypeBoundsChecker which can answer the question: "can two types be different bounds of the same flexible type?"; and provide the base bound for the given bound.
For instance: `MutableList` and `List` may be within the same flexible type.
2020-12-03 11:13:39 +03:00
Victor Petukhov
1ccbb09029 Fix formatting in flexibleTypes.kt 2020-12-03 11:13:38 +03:00
Shagen Ogandzhanian
8e5bcd349e [JS IR] Respect JsExport while assigning stable names
see https://youtrack.jetbrains.com/issue/KT-43404
2020-12-02 22:21:16 +01:00
Alexander Udalov
6b649d02d3 JVM IR: fix visibility/modality of $suspendImpl methods
#KT-43614 Fixed
2020-12-02 20:53:55 +01:00
Alexander Udalov
8ce2e4654b JVM IR: allow custom toArray to have any array type
To avoid breaking Java source compatibility. This problem can be fixed
later once JVM IR is stabilized.

 #KT-43111 Fixed
2020-12-02 20:53:47 +01:00
Dmitry Petrov
e6a3e38c4d JVM_IR no static inline class members for Kotlin JvmDefault methods
KT-43698 KT-43051
2020-12-02 20:04:13 +03:00
Ivan Gavrilovic
11673bd09c KAPT: add tests for processed types, remove dead code, simplify logic
Add integration test which checks if only types can be
reprocessed in an incremental round. Also, remove unused
`invalidateTypesForFiles` method.

Furthermore, clarify that types that are reprocessed
(i.e types from .class files) are not necessarily
aggregating types, but simply types that should be reprocessed.

Test: KaptIncrementalWithIsolatingApt.testClasspathChangesCauseTypesToBeReprocessed
2020-12-02 16:55:50 +01:00
Ivan Gavrilovic
08a2b47c77 Incremental KAPT: fix typo and do check processed sources on
clean build
2020-12-02 16:55:49 +01:00
Ivan Gavrilovic
0522583602 Incremental KAPT: add test for isolating AP with classpath origin
Add a regression test for KT-34340 that allows APs to have
classpath types as origins.
2020-12-02 16:55:49 +01:00
Ivan Gavrilovic
05e47da458 Incremental KAPT: simplify impacted types computation
Process aggregating types first, and when computing impacted types
compute isolating generated impacted by classpath changes first.
2020-12-02 16:55:49 +01:00
Ivan Gavrilovic
c7e5beece5 Use types are origins for incremental KAPT and track generated source
This change introduces tracking of generated sources structure in order
to e.g track classpath changes impacting generated sources. This fixes KT-42182.

Also, origin tracking for isolating processors is now using types, allowing
for origin elements from classpath. This fixes KT-34340. However, classpath
origin is used only to invalidate generated files when the type changes and
processing will not be requested for that type. This is in line with the
incap spec.
2020-12-02 16:55:49 +01:00
Shagen Ogandzhanian
d512158c25 [JS IR] Remove redundant guard assertion for extension funs with default params
Introduce corresponding test
See https://youtrack.jetbrains.com/issue/KT-41076
2020-12-02 16:45:12 +01:00
Alexander Udalov
a917ebd11e JVM IR: use origin to detect property/typealias $annotations methods
Now that DEFAULT_IMPLS origins for methods do not exist after previous
commits, the name heuristic is no longer needed.
2020-12-02 15:54:15 +01:00
Alexander Udalov
c7c793c724 JVM IR: do not use origin DEFAULT_IMPLS_BRIDGE(_TO_SYNTHETIC)
Instead, check that origin of the parent class is DEFAULT_IMPLS. Also,
add a separate origin SUPER_INTERFACE_METHOD_BRIDGE for interface
methods with bodies that are copied to classes.
2020-12-02 15:54:14 +01:00
Alexander Udalov
d41d1bf64d JVM IR: remove obsolete isDefaultImplsBridge in findInterfaceImplementation 2020-12-02 15:54:14 +01:00
Alexander Udalov
be03bc477d JVM IR: do not use origin DEFAULT_IMPLS_WITH_MOVED_RECEIVERS(_SYNTHETIC)
Instead, check that origin of the parent class is DEFAULT_IMPLS.
2020-12-02 15:54:14 +01:00
Alexander Udalov
988cc52174 JVM IR: do not use origin DEFAULT_IMPLS_BRIDGE_FOR_COMPATIBILITY(_SYNTHETIC)
It was only used to generate deprecation in codegen, but it's annotated
with `javaLangDeprecatedConstructorWithDeprecatedFlag`, and a similar
annotation for IrField results in ACC_DEPRECATED. Adapt codegen to
generate this flag for functions too.
2020-12-02 15:54:13 +01:00
Ilya Goncharov
697b2b02f1 [JS IR] Add properties lazy initialization with multiple modules
[JS IR] Move tests into compiler/testData

[JS IR] Add cyclic dependencies with lazy property initialization

[JS IR] Add test on not initialization in case of call non properties (classed, objects, enum classes, const vals)

[JS IR] Add initialization through top level

[JS IR] Ignore enum getInstance function in property lazy initialization

[JS IR] Use let function with useful result instead of pure apply and also

[JS IR] Remove duplicated tests in js.translator
2020-12-02 17:35:30 +03:00
pyos
6cb573cb45 [FIR] Import parents of companion objects first
Otherwise, information about members moved from companion objects to the
parent class (e.g. on JVM, companion object fields -> static fields in
parent class) will be incorrect.
2020-12-02 15:29:42 +03:00
Igor Yakovlev
4d7b6c022b [FIR IDE] LC Anonymous to SuperClass type substitution 2020-12-02 15:13:09 +03:00
Igor Yakovlev
842d31d04e [FIR IDE] Fix HL API test data
Ignore failed tests
Set passing test to comparison mode
Fix testdata for symbols
Fix invalid LAZINESS parameter reading from testdata
2020-12-02 15:13:09 +03:00
Igor Yakovlev
7cbcde77dd [FIR IDE] LC More accurate fields visibility and modality 2020-12-02 15:13:08 +03:00
Igor Yakovlev
a7d7aa123e [FIR IDE] LC minor refactorings 2020-12-02 15:13:08 +03:00
Igor Yakovlev
a1603716ed [FIR IDE] LC Add anonymous objects support
+minor fixes
2020-12-02 15:13:08 +03:00
Igor Yakovlev
5630667320 [FIR IDE] LC better support for JvmMultiFileClass annotation 2020-12-02 15:13:08 +03:00
Igor Yakovlev
56c3faee00 [FIR IDE] LC Fix generating unique field names 2020-12-02 15:13:08 +03:00
Igor Yakovlev
18e5af37ff [FIR IDE] LC Fixed incorrect JvmOverloads 2020-12-02 15:13:07 +03:00
Igor Yakovlev
535aa1e9e0 [FIR IDE] LC expand typealiases for applied annotations 2020-12-02 15:13:07 +03:00
Igor Yakovlev
229c6f97ac [FIR IDE] LC Fixed nullability for getters 2020-12-02 15:13:07 +03:00
Igor Yakovlev
aff90b335c [FIR IDE] LC Implement special keywords like transient, volatile, synchronized, strictfp 2020-12-02 15:13:07 +03:00
Igor Yakovlev
6aff96a401 [FIR IDE] Remove extra analyzing for local declarations 2020-12-02 15:13:07 +03:00
Igor Yakovlev
3fc424246b [FIR IDE] LC basic support for type arguments
+ small fixes for deprecation, etc.
2020-12-02 15:13:06 +03:00
Igor Yakovlev
2a8f783393 [FIR IDE] HL API Better support of nullability and modality 2020-12-02 15:13:06 +03:00
Igor Yakovlev
4c69043a15 [FIR IDE] Move refactoring and minor bugfixing for modality, jvmname, etc. 2020-12-02 15:13:06 +03:00
Igor Yakovlev
3e3ec5fc69 [FIR IDE] Supporting member scopes in EnumEntries 2020-12-02 15:13:06 +03:00
Igor Yakovlev
fdaf31dbf3 [FIR IDE] Fix typemapping for FirTypeAliasSymbol 2020-12-02 15:13:05 +03:00
Igor Yakovlev
aae0081f3f [FIR IDE] Fixed invalid HL API getters request 2020-12-02 15:13:05 +03:00
Mikhail Glukhikh
2429f429c5 [FIR] Set isStubTypeEqualsToAnything = true for inference as in FE 1.0
#KT-43616 Fixed
2020-12-02 14:49:08 +03:00
Mikhail Glukhikh
eae8821dec FIR Java: unbind possible named annotation cycle 2020-12-02 14:48:46 +03:00
Nikolay Krasko
2ffedd2731 Fix Daemon compiler tests on Windows
In 202 platform tearDown tries to remove temporary directory, but this
fails on Windows, because while Daemon is active directory can't be
deleted.
2020-12-02 14:23:32 +03:00
Georgy Bronnikov
8a969dab7d Bugfix for FIR 2020-12-02 09:47:34 +03:00
Georgy Bronnikov
b23d7a79b0 IR: get rid of WrappedDescriptorWithContainerSource 2020-12-02 09:47:34 +03:00
Georgy Bronnikov
c0cd9064d7 IR: IrMemberWithContainerSource 2020-12-02 09:47:34 +03:00
Georgy Bronnikov
14b773c1fd JVM_IR: do not rely on DescriptorWithContainerSource in InlineCodegen 2020-12-02 09:47:34 +03:00
Ilmir Usmanov
f0a787551a Value classes: Raise retention of @JvmInline to RUNTIME
so it will be visible by reflection
2020-12-01 23:45:50 +01:00
Ilmir Usmanov
129de76288 Value classes: Generate @JvmInline annotation for inline classes
but not for value classes.
Since inline classes and value classes share the same flag, we use
presence of the annotation to distinguish them.
2020-12-01 23:45:47 +01:00
Dmitry Petrov
ae8abd1832 Minor: ignore nestedBigArityFunCalls.kt in WASM 2020-12-01 19:43:52 +03:00
Dmitry Petrov
1412ee96f8 JVM_IR KT-43524 static wrappers for deprecated accessors are deprecated 2020-12-01 19:43:52 +03:00
Dmitry Petrov
e96fc74ffa JVM_IR KT-43519 no delegates for external funs in multifile facades
Also add ABI tests for @JvmStatic/JvmOverloads + 'external'.
2020-12-01 19:43:52 +03:00
Dmitry Petrov
2b4564059e JVM_IR KT-43459 fix $annotations method receiver type 2020-12-01 19:43:51 +03:00
Dmitry Petrov
85b5948931 JVM_IR KT-43051 no static inline class members for default Java methods 2020-12-01 19:43:51 +03:00
Dmitry Petrov
4c3ffc3451 JVM_IR KT-41911 process big arity 'invoke' arguments recursively 2020-12-01 19:43:51 +03:00
Georgy Bronnikov
b0e2d5637d Mute a test for WASM 2020-12-01 18:37:55 +03:00
Georgy Bronnikov
bb4950a021 Regenerate LightAnalysis tests 2020-12-01 16:01:48 +03:00
Dmitriy Novozhilov
91bccad72b [JS] Fix path of generated js tests 2020-12-01 15:43:25 +03:00
Mikhail Glukhikh
7550a1870b [FIR2IR] Make checks about f/o accessors necessity more precise
#KT-43342 Fixed
2020-12-01 14:23:19 +03:00
Ilya Goncharov
b179b567a9 [Gradle, JS] Add test on resolution of js project with directory dependency
^KT-43668 fixed
2020-12-01 14:12:39 +03:00
Alexander Udalov
2fdc2dfaaf JVM IR: fix regression in JvmStatic-in-object lowering for properties
References to properties with JvmStatic getter were not handled in
MakeCallsStatic (by overwriting dispatchReceiver with null) because the
property itself was not considered static.

 #KT-43672 Fixed
2020-12-01 11:54:45 +01:00
Georgy Bronnikov
4607eca987 JVM_IR: bug fix in classFileContainsMethod
The old test sequence failed for toplevel functions because of file
class wrappers, so that the second branch was never invoked.
2020-12-01 13:15:51 +03:00
Roman Golyshev
f50480d258 FIR IDE: Fix resolving of nested types in type references 2020-12-01 09:24:20 +00:00
Roman Golyshev
94a5379631 FIR IDE: Add tests for resolving from nested types references
Some of those tests are failing in the FIR IDE
2020-12-01 09:24:20 +00:00
Alexander Udalov
19ca9c0fde Enable JVM IR for bootstrap in the project 2020-11-30 22:09:24 +01:00
Alexander Udalov
606de26646 JVM IR: fix generation of equals/hashCode for fun interfaces over references
... in case `-Xno-optimized-callable-references` is enabled. Before this
change, the generated abstract equals/hashCode methods were considered
as accidental overrides because they did not have equals/hashCode from
the supertype in the overriddenSymbols list.

 #KT-43666 Fixed
2020-11-30 19:15:20 +01:00
pyos
50ae360ff9 FIR2IR: fix the way annotations are moved to fields
1. When an annotation has multiple targets, the priority goes like this:
    constructor parameter (if applicable) -> property -> backing field.

 2. The argument to `kotlin.annotation.Target` is a vararg, so that
    should be handled as well.

 3. `AnnotationTarget.VALUE_PARAMETER` allows receivers, constructor
    parameters, and setter parameters, while `AnnotationTarget.FIELD` allows
    both backing fields and delegates.

Known issue: java.lang.annotation.Target is not remapped to the Kotlin
equivalent, so things are still broken for pure Java annotations.
2020-11-30 20:29:18 +03:00
Andrei Klunnyi
4817d5e01d KTIJ-585 [Gradle Runner]: main() cannot be launched from AS 4.1
Android gradle-project model differs from what we have for pure Java
and MPP. It's the reason why application classpath cannot be collected
correctly.
Until universal solution is provided delegation to gradle is put under
the registry flag. If disable platform runner is used as before.
2020-11-30 15:44:37 +00:00
Ilya Goncharov
995d96e5a3 [JS IR] Use one concat elements for non vararg and vararg arguments
^KT-42357 fixed
2020-11-30 17:34:44 +03:00
Ilya Goncharov
67e4b0948e [JS IR] Constructor call with vararg invoking with apply
[JS IR] Nullize external empty varargs

[JS IR] Concat varargs with array of nonVarargs arguments

^KT-42357 fixed
2020-11-30 17:33:28 +03:00
Ilya Goncharov
ac42dcd8da [JS IR] Add test for external fun vararg
[JS IR] Add tests with empty vararg and default arg before it

[JS IR] Ignore backend in tests instead of target backend

[JS IR] Add function with named spread operator

[JS IR] Remove ignoring of current js backend in jsExternalVarargFun

[JS IR] Add with arguments after vararg

^KT-42357 fixed
2020-11-30 17:33:07 +03:00
Ilya Goncharov
e7789d2e30 [Gradle, JS] Add filter on file on fileCollectionDependencies because Gradle can't hash directory
^KT-43668 fixed
2020-11-30 17:04:30 +03:00
Dmitry Petrov
96ed99d62e JVM_IR KT-40305 no nullability assertions on built-in stubs 2020-11-30 15:49:02 +03:00
Dmitry Petrov
b2aed536c9 JVM_IR KT-39612 process subexpressions recursively in 'name' lowering 2020-11-30 15:49:02 +03:00
Dmitry Petrov
3b604cfa7f JVM_IR KT-32701 generate multiple big arity invokes, report error later 2020-11-30 15:49:02 +03:00
Dmitry Petrov
a157b58c61 JVM_IR KT-43610 keep track of "special bridges" for interface funs 2020-11-30 15:49:01 +03:00
Dmitriy Novozhilov
c43db2ee8d [TEST] Inherit UpdateConfigurationQuickFixTest from KotlinLightPlatformCodeInsightFixtureTestCase
This is needed for proper test muting
2020-11-30 15:39:05 +03:00
Alexander Udalov
7d9eeb6847 Minor, add workaround for KT-42137 2020-11-30 12:44:42 +01:00
Alexander Udalov
e1d54bf99f Minor, add workaround for KT-43666 2020-11-30 12:37:27 +01:00
Mikhael Bogdanov
ad579de328 Don't run KaptPathsTest.testSymbolicLinks test on Windows 2020-11-30 12:17:00 +01:00
Dmitriy Novozhilov
d706a7ff74 Build: mute failing tests
Those tests are failing only on windows agents after
  switch to 202 platform
2020-11-30 13:40:29 +03:00
pyos
1cccf2645f FIR: serialize HAS_CONSTANT at least for const properties
Non-const properties may need them too with if the 1.4 feature
NoConstantValueAttributeForNonConstVals is disabled.
2020-11-30 13:05:28 +03:00
Mikhail Glukhikh
04d9afe83e FIR Java: add workaround for classId = null in JavaAnnotation 2020-11-30 13:05:27 +03:00
Mikhail Glukhikh
feb13f98c0 [FIR2IR] Handle Java annotation parameter mapping properly
#KT-43584 Fixed
2020-11-30 13:05:26 +03:00
Mikhail Glukhikh
9b30655d66 [FIR] Load Java annotations named arguments properly (see KT-43584) 2020-11-30 13:05:23 +03:00
Roman Golyshev
e6f380182a Revert "FIR IDE: Add tests for resolving from nested types references"
This reverts commit e127ea3d
2020-11-30 12:37:40 +03:00
Roman Golyshev
f8b6559b6a Revert "FIR IDE: Fix resolving of nested types in type references"
This reverts commit dba14ba9
2020-11-30 12:37:26 +03:00
Roman Golyshev
dba14ba995 FIR IDE: Fix resolving of nested types in type references 2020-11-30 09:26:15 +00:00
Roman Golyshev
e127ea3dad FIR IDE: Add tests for resolving from nested types references
Some of those tests are failing in the FIR IDE
2020-11-30 09:26:15 +00:00
Mikhael Bogdanov
8a00470b40 Enable kotlin-annotation-processing-base tests on TC 2020-11-30 10:06:22 +01:00
Sergey Bogolepov
29bed39a54 Bump to native version version with watchos_x64 enabled 2020-11-30 14:01:12 +07:00
Sergey Bogolepov
37ee2cbe53 [KT-43276] Update tests to support watchos_x64 2020-11-30 14:01:12 +07:00
Sergey Bogolepov
d6f54a7730 [KT-43276] Fix watchos target shortcut. 2020-11-30 14:01:12 +07:00
Sergey Bogolepov
f3424a98b7 generateMppTargetContainerWithPresets: remove unneeded hack 2020-11-30 14:01:12 +07:00
Sergey Bogolepov
e39560b134 [KT-43276] Add watchos_x64 target 2020-11-30 14:01:12 +07:00
Ilya Gorbunov
0634351fbc Introduce pathString/absolute/absolutePathString
Rename invariantSeparatorsPath to invariantSeparatorsPathString
to have more consistent names of methods returning path strings.

KT-19192
2020-11-29 17:46:47 +03:00
Ilya Gorbunov
84f5a294f7 Allow passing null parent directory to createTempFile/Directory
null signifies the default temp directory.

KT-19192
2020-11-29 17:46:47 +03:00
Ilya Gorbunov
64d85f259c Relax writeText/appendText parameter type to CharSequence
KT-19192
2020-11-29 17:46:47 +03:00
Pavel Punegov
2ee8bf7dde Add fastutil dependency for 202 and higher platforms 2020-11-28 14:26:01 +03:00
Dmitriy Novozhilov
f668e906cc Build: unmute passed tests 2020-11-28 14:26:01 +03:00
Dmitriy Novozhilov
e7d305b97a Build: mute failing stepping tests 2020-11-28 14:26:00 +03:00
Dmitriy Novozhilov
78c786de46 Build: Mute failing goto declaration tests 2020-11-28 14:26:00 +03:00
Dmitriy Novozhilov
33b545aea7 Build: Mute failing gradle import with android tests 2020-11-28 14:25:59 +03:00
Dmitriy Novozhilov
85c59328c7 [DEBUGGER] Temporary mute AbstractKotlinEvaluateExpressionTest 2020-11-28 14:25:59 +03:00
Vladimir Dolzhenko
3d33ea7da8 Use absolute paths to locate existed projects to open in AbstractConfigureKotlinTest 2020-11-28 14:25:58 +03:00
Vladimir Dolzhenko
124888eb43 Revert back AddFunctionParametersFix test data output for 201- 2020-11-28 14:25:58 +03:00
Dmitriy Novozhilov
e251a9be14 Build: fix finding layout-api jar in parcelize box test due to platform change 2020-11-28 14:25:57 +03:00
Dmitriy Novozhilov
cc1a0bf6d7 [FE] Update testdata 2020-11-28 14:25:57 +03:00
Vladimir Dolzhenko
17e6e88176 Fixed AddFunctionParametersFix test data output 2020-11-28 14:25:57 +03:00
Dmitriy Novozhilov
406e863a73 [FE] Fix creating location of compiler errors in CLI 2020-11-28 14:25:56 +03:00
Dmitriy Novozhilov
dc364b8be4 Remove useless @author comment 2020-11-28 14:25:56 +03:00
Vladimir Dolzhenko
95e5ea4840 temporary ignore/disable tests 2020-11-28 14:25:55 +03:00
Dmitriy Novozhilov
02f71a63b8 [FE] Disable SKIP_DEBUG flag when building java model from binaries
This is needed to avoid skipping jvm annotations with names of
  function parameters
2020-11-28 14:25:55 +03:00
Dmitriy Novozhilov
bf1abed246 Build: add shadowing processor for core.xml in embeddable compiler 2020-11-28 14:25:54 +03:00
Dmitriy Novozhilov
ad953b6285 Build: remove redundant bunch TODO's 2020-11-28 14:25:54 +03:00
Dmitriy Novozhilov
986ab9cb54 Build: remove useless .as40 files 2020-11-28 14:25:54 +03:00
Dmitriy Novozhilov
1b559fe676 Don't set KOTLIN_BUNDLED in unit tests 2020-11-28 14:25:53 +03:00
Dmitriy Novozhilov
7396abf5a4 Build: add fastutil dependency to scripting tests 2020-11-28 14:25:53 +03:00
Dmitriy Novozhilov
5ab9710cc5 Remove ./local directory from CodeConformanceTest 2020-11-28 14:25:52 +03:00
Dmitriy Novozhilov
d3ef0eb519 Build: register missing TreeAspect service in KtParsingTestCase 2020-11-28 14:25:52 +03:00
Dmitriy Novozhilov
68719831ee Build: update asm version in kotlinp 2020-11-28 14:25:52 +03:00
Dmitriy Novozhilov
dc35a13008 Build: remove useless bunch files 2020-11-28 14:25:51 +03:00
Dmitriy Novozhilov
46fcc7d59d Build: fix registration of ClassFileDecompilers extension 2020-11-28 14:25:51 +03:00
Dmitriy Novozhilov
48cbb74a01 Build: drop deprecated extension point used in test of old j2k 2020-11-28 14:25:50 +03:00
Dmitriy Novozhilov
d887814cc5 Build: fix compilation of :libraries:tools:kotlin-maven-plugin-test 2020-11-28 14:25:50 +03:00
Dmitriy Novozhilov
4779092ba5 Build: fix API differences between 201 and 202 in idea performance tests 2020-11-28 14:25:49 +03:00
Dmitriy Novozhilov
2a053c214d Build: fix API differences between 201 and 202 in scratch tests 2020-11-28 14:25:49 +03:00
Dmitriy Novozhilov
d50d56f68c Build: fix API differences between 201 and 202 in NewKotlinFileAction 2020-11-28 14:25:49 +03:00
Dmitriy Novozhilov
e4e28a5495 Build: update grovy dependencies in :compiler:tests-spec 2020-11-28 14:25:48 +03:00
Dmitriy Novozhilov
07dd9179e8 Build: change 202 platform version 2020-11-28 14:25:48 +03:00
Dmitriy Novozhilov
eeb9b3214c Switch to 202 platform 2020-11-28 14:25:19 +03:00
Ilya Muradyan
89bba93615 Introduce GetScriptingClassByClassLoader interface
It is needed to override default JVM behaviour
2020-11-28 09:44:06 +01:00
Ilya Muradyan
65ce7cd0c2 Fix path for Windows in Fibonacci test 2020-11-28 09:44:06 +01:00
Ilmir Usmanov
78e607c6b0 Value classes: Support @JvmName annotation on functions with inline
classes in signatures, but not on methods of inline classes.
2020-11-28 00:34:04 +01:00
Ilmir Usmanov
871912f257 Value Classes: Increase BINARY_STUB_VERSION after decompiler changes 2020-11-27 23:52:09 +01:00
Ilmir Usmanov
05c4dfef3d Value classes: Use 'value' keyword instead of 'inline' in stub dumps 2020-11-27 23:52:08 +01:00
Ilmir Usmanov
9b9c43b702 Value classes: Change relevant diagnostic to say 'value class'
instead of 'inline class'
2020-11-27 23:52:08 +01:00
Ilmir Usmanov
ca3e7cf1a7 Value classes: Report lacking @JvmInline only on JVM backend
Report when @JvmInline is applied on non-value class.
2020-11-27 23:52:07 +01:00
Ilmir Usmanov
92f1681de0 Value classes: treat @JvmInline value classes as inline classes
Report error on value classes without @JvmInline annotation.
Do not check for @JvmInline annotation in value classes since
it breaks reflection.
2020-11-27 23:52:06 +01:00
Ilmir Usmanov
6c68660ffd Value classes: Render 'value' before class 2020-11-27 23:52:06 +01:00
Ilmir Usmanov
f158411f9a Value classes: Increase JVM metadata version to distinguish
between inline and value classes.
2020-11-27 23:52:05 +01:00
Ilmir Usmanov
361ed117bb Value classes: Add isValue property to class descriptors
Reuse isInline flag in proto and IR.
Check metadata version on deserialization.
2020-11-27 23:52:05 +01:00
Ilmir Usmanov
8eff3a6bb3 Value classes: Increase stub version due to changes in the parser 2020-11-27 23:52:04 +01:00
Ilmir Usmanov
11b2a07a59 Value classes: Support 'value' modifier in parser 2020-11-27 23:52:04 +01:00
Ilya Kirillov
d5979ffded FIR IDE: add tests for checking module invalidation 2020-11-27 23:14:57 +01:00
Ilya Kirillov
2fb4a917f6 FIR IDE: fix module invalidation algorithm 2020-11-27 23:14:57 +01:00
Ilya Kirillov
519f1549f0 FIR IDE: separate logic of TestProjectStructure from AbstractFirMultiModuleLazyResolveTest 2020-11-27 23:14:56 +01:00
Ilya Kirillov
3515cd546d FIR IDE: use PersistentMap to store FromModuleViewSessionCache mappings
Needed to ensure safe pub of map
2020-11-27 23:14:56 +01:00
Ilya Kirillov
76c0dc7dba FIR IDE: add property support for incremental analysis 2020-11-27 20:41:38 +01:00
Ilya Kirillov
953dba808b FIR IDE: move withFirDeclaration to LowLevelFirApiFacade 2020-11-27 20:41:37 +01:00
Ilya Kirillov
b4d63b9b13 FIR IDE: add docs for LowLevelFirApiFacade functions 2020-11-27 20:41:35 +01:00
Ilya Kirillov
93648e6cd3 FIR IDE: use mor specific exception in EntityWasGarbageCollectedException 2020-11-27 20:41:33 +01:00
Ilya Kirillov
65a7ee5012 FIR IDE: remove duplicating withFirResolvedToBodyResolve 2020-11-27 20:41:32 +01:00
Ilya Kirillov
3141fead0d FIR IDE: get rid of LowLevelFirApiFacade object 2020-11-27 20:41:31 +01:00
Dmitry Petrov
a206eca164 JVM_IR KT-43611 report signature clash on private interface members 2020-11-27 18:54:09 +03:00
Dmitriy Novozhilov
fd935b7c54 [TEST] Move generated js compiler tests to test-gen directories 2020-11-27 18:07:47 +03:00
Ilya Goncharov
77ed51b3ab [JS IR] Add message for for enabling option for overwriting reachable nodes
[JS IR] Disable rewriting of EXPECTED_REACHABLE_NODES by default, add system property to enable this behaviour
2020-11-27 17:26:07 +03:00
Dmitriy Novozhilov
908732b3c1 [TEST] Move generated visualizer tests to test-gen directories 2020-11-27 12:55:48 +03:00
Dmitriy Novozhilov
eca769f8e4 [TEST] Move generated fir tests to test-gen directories 2020-11-27 12:55:48 +03:00
Dmitriy Novozhilov
1ee38286a8 [TEST] Move generated compiler tests to test-gen directory 2020-11-27 12:55:45 +03:00
Ilmir Usmanov
524419a2fe IC Mangling: Use new mangling scheme for range tests 2020-11-27 10:56:07 +03:00
Georgy Bronnikov
6381d97aab JVM_IR: compute classId on IR structures 2020-11-27 10:56:07 +03:00
Dmitry Petrov
ee1e05fedd KT-42151 fix type arguments in local class constructor reference types 2020-11-26 18:40:49 +03:00
Mikhael Bogdanov
b2b8562f92 Properly extract JVM version in kapt
#KT-41788
2020-11-26 15:13:06 +01:00
Ilmir Usmanov
9ed5b8f870 IC & Coroutines: Do not box suspend operator fun invoke receiver
if it is called using parens and not by calling 'invoke' method.

Use underlying type when calling continuation constructor if suspend
function is method inside inline class.

 #KT-43505 Fixed
 #KT-39437 Fixed
2020-11-26 15:08:56 +01:00
Ilmir Usmanov
4e334217a8 IC & Coroutines: Unbox inline class parameter of suspend lambda
inside 'create' if 'create' overrides 'create' from
BaseContinuationImpl. In other words, unbox the parameter if 'create'
accepts only one parameter.

 #KT-43249 Fixed
 #KT-43533 Fixed
2020-11-26 15:08:54 +01:00
Ilmir Usmanov
eba260f681 IC & Coroutines: Unbox inline classes of suspend lambdas
inside 'invoke' if 'create' does not override 'create' from
BaseContinuationImpl. In other words, when suspend lambda accepts more
than one parameter (including receiver).

Do that only if we do not generate bridge 'invoke' method, since
inline classes are unboxed in the bridge.

Use mangled name for 'create' function in this case inside 'invoke'.

 #KT-43249 In progress
 #KT-39847 Fixed
 #KT-38937 Fixed
2020-11-26 15:08:51 +01:00
Mikhail Glukhikh
0a0b5b5d2b [FIR DFA] Don't consider anonymous object as stable initializer to bind
#KT-43332 Fixed
2020-11-26 16:29:06 +03:00
Mikhail Glukhikh
1dc897346c [FIR] Fix WRONG_IMPLIES_CONDITION problem in DFA model 2020-11-26 16:28:56 +03:00
Ilya Gorbunov
7fd96f5773 Fix annotation spelling in docs
KT-43586
2020-11-26 15:37:22 +03:00
Dmitriy Novozhilov
db9f301eed [FE] Make DiagnosticFactory.name not null 2020-11-26 11:54:15 +03:00
Dmitriy Dolovov
94ce56bfdc Minor. Add words to project dictionary 2020-11-26 10:57:16 +03:00
Dmitriy Dolovov
c741284458 [Commonizer] Stricter processing of forward declarations 2020-11-26 10:57:11 +03:00
Dmitriy Dolovov
eca231a01d [Commonizer] Extract CIR classifiers cache from the root node 2020-11-26 10:57:05 +03:00
Dmitriy Dolovov
8d9abed3dc [Commonizer] Minor. More specific upper bounds for CirNodeWithClassId 2020-11-26 10:56:59 +03:00
Mikhail Glukhikh
d4b0bf4ad8 [FIR] Make DEFAULT positioning strategy public, drop duplicated one 2020-11-26 08:37:51 +03:00
Mikhail Glukhikh
97c1a3f270 Simplify FirSupertypeInitializedWithoutPrimaryConstructor checker 2020-11-26 08:37:51 +03:00
Mikhail Glukhikh
bf2b318bee Simplify FirSupertypeInitializedInInterfaceChecker 2020-11-26 08:37:51 +03:00
Mikhail Glukhikh
12726cd366 FIR light builder: use type reference node as FirTypeRef source 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
d5f17ea41c Simplify FirDelegationInInterfaceChecker 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
b673996586 Simplify source operations in FirAnnotationArgumentChecker 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
1c71e64f58 [FIR] Create string interpolating call even for single argument
Before this commit, questionable optimization existed which
unwrapped string interpolating call with single argument to this argument.
However, this led to source element loss and the necessity of sub-hacks.
In this commit we dropped this optimization (anyway user can remove
this single-expression string template in code if needed) to keep
source elements intact.
2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
915a66f4fa [FIR] Introduce & use "multiplexing" SourceElementPositioningStrategy 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
f3334b03c4 FIR checkers: simplify FirSupertypeInitializedWithoutPrimaryConstructor 2020-11-26 08:37:50 +03:00
Mikhail Glukhikh
58301d8820 FIR exposed visibility checkers: use positioning strategy 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
f095a33970 FIR checkers: extract getChildren(), simplify findSuperTypeDelegation() 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
1e3621a896 FIR checkers: simplify hasPrimaryConstructor by source element check 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
0838ab7fe7 FIR checkers: simplify hasVal / hasVar source element checks 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
c6b703b598 Simplify LighterASTNode.toFirLightSourceElement 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
037c505069 Unbind general FirDiagnostic from PsiFile & PsiElement 2020-11-26 08:37:49 +03:00
Mikhail Glukhikh
68b748e164 Rename DebugInfoUtil.java to DebugInfoUtil.kt, same with AnalyzingUtils 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
6f8947dd04 Extract UnboundDiagnostic, DiagnosticFactory/Renderer to frontend-common 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
52a07e31c7 [FIR] Remove D_I_EXPRESSION_TYPE from qualified calls in spec test data
In FIR, the source of FirFunctionCall is set to call's selector.
In practice, sometimes (e.g. for DEBUG_INFO_CALL)
we expect the selector as the source,
and sometimes (e.g. for DEBUG_INFO_EXPRESSION_TYPE)
we expect the whole qualified call as the source.
Also, some diagnostics, like REDUNDANT_CALL_OF_CONVERSION_METHOD,
are expected to be reported on a selector, not on a whole call.
At this moment we ignore the problem & just don't support
DEBUG_INFO_EXPRESSION_TYPE for qualified calls.
2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
558ac1678e Create FIR fake source element for checked safe call subject 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
2592eed0e7 [FIR TEST] More precise control of source kind in createDebugInfo 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
82c5cefba9 Update test data in FIR diagnostic spec tests 2020-11-26 08:37:48 +03:00
Mikhail Glukhikh
e7e162c7eb [FIR TEST] Filter some particular tokens during createDebugInfo 2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
c602ccb33e Create FIR fake source element for vararg argument expression 2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
fa3f805573 Support FirDiagnostic.isValid properly
Diagnostic is considered valid in this commit if it's reported on
a syntactically non-erroneous element without erroneous last child
2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
c7ae176ae4 [FIR] Inherit FIR with parameter renderer from the old parameter renderer 2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
3dec848c03 [FIR] Implement light tree DECLARATION_NAME & SIGNATURE strategies 2020-11-26 08:37:47 +03:00
Mikhail Glukhikh
42c59f7383 [FIR] Enhance light tree DEFAULT strategy for objects to cover header only 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
d844b33b1c [FIR] Implement light tree CONSTRUCTOR_DELEGATION_CALL strategy
Default strategy sometimes delegates to the CONSTRUCTOR_DELEGATION_CALL
strategy, so we add it in this commit to process some related cases
properly.
2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
8320a2966a [FIR] Implement light tree VAL_VAR strategy as an example 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
1795c4f3e5 Implement common Diagnostic(Factory/Renderer) in related FIR classes 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
d47e16331c Convert DiagnosticFactory.java to Kotlin 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
84f3a4ba9d Rename DiagnosticFactory.java to DiagnosticFactory.kt 2020-11-26 08:37:46 +03:00
Mikhail Glukhikh
9040999b55 Convert Diagnostic.java to Kotlin 2020-11-26 08:37:45 +03:00
Mikhail Glukhikh
b6cfcc6cad Rename Diagnostic.java to Diagnostic.kt 2020-11-26 08:37:45 +03:00
Mikhail Glukhikh
d942780c14 [FIR] Introduce LightTreePositioningStrategy 2020-11-26 08:37:45 +03:00
Mikhail Glukhikh
1cb2aeaeff FirSourceElement: introduce common 'treeStructure' property 2020-11-26 08:37:45 +03:00
Mikhail Glukhikh
3a2b15521b FirSourceElement: introduce common 'lighterASTNode' property 2020-11-26 08:37:45 +03:00
Zalim Bashorov
6abd656116 [IR] dumpKotlinLike: update testdata after rebase 2020-11-26 00:15:26 +03:00
Zalim Bashorov
0d5a0b207e [IR] KotlinLikeDumper: add a note about some conventions used for TODO comments 2020-11-26 00:15:25 +03:00
Zalim Bashorov
c004269547 [IR] KotlinLikeDumper: unify and add more comments for the cases when used a syntax which is invalid in Kotlin 2020-11-26 00:15:24 +03:00
Zalim Bashorov
5a755054f8 [IR] dumpKotlinLike: add a comment about some conventions which could be unclear 2020-11-26 00:15:22 +03:00
Zalim Bashorov
69f0f4ef19 [IR] update testdata: unify printing custom/non-standard modifiers 2020-11-26 00:15:21 +03:00
Zalim Bashorov
90fdfbde68 [IR] KotlinLikeDumper: unify printing custom/non-standard modifiers 2020-11-26 00:15:19 +03:00
Zalim Bashorov
57cb8f97e9 [IR] update testdata: don't use "D" suffix on double constants 2020-11-26 00:15:18 +03:00
Zalim Bashorov
73771a3513 [IR] KotlinLikeDumper: don't use "D" suffix on double constants 2020-11-26 00:15:17 +03:00
Zalim Bashorov
7df6575a18 [IR] update testdata: unify representation for error nodes 2020-11-26 00:15:16 +03:00
Zalim Bashorov
ef9a901635 [IR] KotlinLikeDumper: unify representation for error nodes 2020-11-26 00:15:15 +03:00
Zalim Bashorov
f8690d0395 [IR] KotlinLikeDumper: minor, collapse an if to helper function and add few more todos 2020-11-26 00:15:14 +03:00
Zalim Bashorov
c68040753d [IR] dumpKotlinLike: add testdata for FIR tests 2020-11-26 00:15:13 +03:00
Zalim Bashorov
d7bd4240e1 [IR] dumpKotlinLike: don't crash when type argument is null 2020-11-26 00:15:12 +03:00
Zalim Bashorov
dec067af8c [IR] stop overwriting testdata for dumpKotlinLike and use assertEqualsToFile 2020-11-26 00:15:11 +03:00
Zalim Bashorov
43ee50b91d [IR] update testdata after rebase 2020-11-26 00:15:10 +03:00
Zalim Bashorov
2773e4baca [IR] KotlinLikeDumper.kt -> dumpKotlinLike.kt 2020-11-26 00:15:09 +03:00
Zalim Bashorov
36591ba5f7 [IR] KotlinLikeDumper: replace all usages of commentBlockH with commentBlock 2020-11-26 00:15:07 +03:00
Zalim Bashorov
ad0f154ed1 [IR] add new testdata after rebase 2020-11-26 00:15:07 +03:00
Zalim Bashorov
f9fe82e735 [IR] KotlinLikeDumper: process specially when IrElseBranch's condition is not true constant 2020-11-26 00:15:05 +03:00
Zalim Bashorov
503370c9c2 [IR] update testdata: escape special symbols in Char and String constant values 2020-11-26 00:15:04 +03:00
Zalim Bashorov
0f10b5eb9e [IR] KotlinLikeDumper: escape special symbols in Char and String constant values 2020-11-26 00:15:03 +03:00
Zalim Bashorov
92dda5cd92 [IR] KotlinLikeDumper.kt: cleanup 2020-11-26 00:15:02 +03:00
Zalim Bashorov
5b0efe2b64 [IR] KotlinLikeDumper: rearrange methods 2020-11-26 00:15:01 +03:00
Zalim Bashorov
d9dbc01c3e [IR] KotlinLikeDumper: p.print("") -> p.printIndent() 2020-11-26 00:15:00 +03:00
Zalim Bashorov
c7d9b7adbe [IR] KotlinLikeDumper: rearrange methods 2020-11-26 00:14:59 +03:00
Zalim Bashorov
76e959ef8c [IR] KotlinLikeDumper: minor, update some comments 2020-11-26 00:14:58 +03:00
Zalim Bashorov
e94528fe0d [IR] update testdata: print class name for callable references without receivers 2020-11-26 00:14:57 +03:00
Zalim Bashorov
b6e37c1f89 [IR] KotlinLikeDumper: print class name for callable references without receivers 2020-11-26 00:14:56 +03:00
Zalim Bashorov
2dbd784a6a [IR] update testdata: print else -> ... 2020-11-26 00:14:55 +03:00
Zalim Bashorov
14dabed85a [IR] KotlinLikeDumper.kt: move branch support to corresponding visit* methods 2020-11-26 00:14:54 +03:00
Zalim Bashorov
8f155c23a0 [IR] update testdata: better support for callable references 2020-11-26 00:14:53 +03:00
Zalim Bashorov
0d3d61862b [IR] KotlinLikeDumper: better support for callable references 2020-11-26 00:14:52 +03:00
Zalim Bashorov
87eb06a21f [IR] update testdata: improve annotations rendering in case when argument was not provided and there is default value 2020-11-26 00:14:51 +03:00
Zalim Bashorov
a34a311e86 [IR] update testdata: support annotations on parameters 2020-11-26 00:14:50 +03:00
Zalim Bashorov
182cb52bdb [IR] KotlinLikeDumper: various changes for value and type params
* support annotations on value parameters
* support new value parameter flags -- hidden, assignable
* extract and reuse logic for value and type parameters
2020-11-26 00:14:49 +03:00
Zalim Bashorov
5cb2572c60 [IR] update testdata: better support for enum and object accesses 2020-11-26 00:14:48 +03:00
Zalim Bashorov
1fd12b7b8a [IR] KotlinLikeDumper: better support for enum and object accesses 2020-11-26 00:14:47 +03:00
Zalim Bashorov
635cb44bf3 [IR] update testdata: support IrDynamic* nodes 2020-11-26 00:14:46 +03:00
Zalim Bashorov
82839e6a67 [IR] KotlinLikeDumper: support IrDynamic* nodes 2020-11-26 00:14:45 +03:00
Zalim Bashorov
cdc74304c7 [IR] add testdata for irJsText 2020-11-26 00:14:44 +03:00
Zalim Bashorov
68b17fe55b [IR] KotlinLikeDumper: add more visit* to implement 2020-11-26 00:14:43 +03:00
Zalim Bashorov
4fb762e019 [IR] update testdata: minor updates for error nodes 2020-11-26 00:14:41 +03:00
Zalim Bashorov
b129788823 [IR] KotlinLikeDumper: minor updates for error nodes 2020-11-26 00:14:40 +03:00
Zalim Bashorov
a128cdc99c [IR] KotlinLikeDumper: add more TODOs and remove some obsolete ones 2020-11-26 00:14:39 +03:00
Zalim Bashorov
bf20720590 [IR] KotlinLikeDumper: reformat 2020-11-26 00:14:38 +03:00
Zalim Bashorov
ad5df79e39 [IR] KotlinLikeDumper: merge Break & Continue 2020-11-26 00:14:36 +03:00
Zalim Bashorov
64b42401a1 [IR] update testdata: print a parameter in catch 2020-11-26 00:14:34 +03:00
Zalim Bashorov
2775c89ebb [IR] KotlinLikeDumper: print a parameter in catch 2020-11-26 00:14:33 +03:00
Zalim Bashorov
5c8a93c7ff [IR] update testdata: support labels on loops, break & continue 2020-11-26 00:14:32 +03:00
Zalim Bashorov
9daa86c1a2 [IR] KotlinLikeDumper: support labels on loops, break & continue 2020-11-26 00:14:31 +03:00
Zalim Bashorov
21da2b0350 [IR] update testdata: print whole string concatenation at one line 2020-11-26 00:14:30 +03:00
Zalim Bashorov
91c9d9d25c [IR] KotlinLikeDumper: print whole string concatenation at one line 2020-11-26 00:14:29 +03:00
Zalim Bashorov
a6b408978f [IR] update testdata: super and receiver for field accesses 2020-11-26 00:14:28 +03:00
Zalim Bashorov
029ee6f2e7 [IR] KotlinLikeDumper: super and receiver on field accesses 2020-11-26 00:14:27 +03:00
Zalim Bashorov
0bf587ad4b [IR] KotlinLikeDumper: deduplicate code between IrDelegatingConstructorCall and IrEnumConstructorCall 2020-11-26 00:14:26 +03:00
Zalim Bashorov
e56787c0b0 [IR] update testdata: IrInstanceInitializerCall 2020-11-26 00:14:25 +03:00
Zalim Bashorov
26dd009713 [IR] KotlinLikeDumper: change rendering for IrInstanceInitializerCall 2020-11-26 00:14:24 +03:00
Zalim Bashorov
ab8188b032 [IR] update testdata: removed extra indentation for function expressions 2020-11-26 00:14:23 +03:00
Zalim Bashorov
cf5ba82453 [IR] KotlinLikeDumper: don't indent function expressions 2020-11-26 00:14:22 +03:00
Zalim Bashorov
5500b014f5 [IR] update testdata: better support for IrEnumConstructorCall and IrEnumEntry 2020-11-26 00:14:21 +03:00
Zalim Bashorov
602f0ddbc8 [IR] update testdata after using maxBlankLines=1 for Printer 2020-11-26 00:14:20 +03:00
Zalim Bashorov
6e318893f6 [IR] KotlinLikeDumper: support for IrEnumConstructorCall and better rendering for IrEnumEntry 2020-11-26 00:14:18 +03:00
Zalim Bashorov
b518c19b38 [IR] update testdata: support for IrDelegatingConstructorCall 2020-11-26 00:14:17 +03:00
Zalim Bashorov
84d6e43590 [IR] update testdata: print arguments for annotations 2020-11-26 00:14:16 +03:00
Zalim Bashorov
2a19dc32f2 [IR] update testdata: better support for IrConstructorCall 2020-11-26 00:14:15 +03:00
Zalim Bashorov
197f5ca885 [IR] update testdata: better support for IrCall 2020-11-26 00:14:13 +03:00
Zalim Bashorov
ef2adfa835 [IR] KotlinLikeDumper: better support for calls and annotations
* IrCall
* IrConstructorCall
* IrDelegatingConstructorCall
* print arguments for annotations
2020-11-26 00:14:12 +03:00
Zalim Bashorov
fc5c674c60 [IR] update testdata 2020-11-26 00:14:11 +03:00
Zalim Bashorov
6a1ab1b325 [IR] KotlinLikeDumper: WIP
* rearrange some declarations
* add space for before "BLOCK"
* add comment for "RETURNABLE BLOCK"
2020-11-26 00:14:10 +03:00
Zalim Bashorov
0294ff4f10 [IR] add TODO to RenderIrElement 2020-11-26 00:14:09 +03:00
Zalim Bashorov
a5b224fda1 [IR] add new testdata after rebase 2020-11-26 00:14:07 +03:00
Zalim Bashorov
3b1a6389ab [IR] update testdata after rebase 2020-11-26 00:14:06 +03:00
Zalim Bashorov
1c6c996084 [IR] KotlinLikeDumper: fixes after rebase 2020-11-26 00:14:05 +03:00
Zalim Bashorov
7abd09ce96 [IR] initial version of dumpKotlinLike 2020-11-26 00:14:04 +03:00
Zalim Bashorov
8d5facb15f [IR] add testdata for dumpKotlinLike 2020-11-26 00:14:03 +03:00
Zalim Bashorov
d2022ab115 [IR] hack AbstractIrTextTestCase to test dumpKotlinLike 2020-11-26 00:14:01 +03:00
Vyacheslav Gerasimov
6241f9be2d Build: Fix ide plugin maven artifacts publication 2020-11-25 22:44:46 +03:00
Mikhael Bogdanov
8f187f328a Switch ASM artifact 2020-11-25 19:57:06 +01:00
Sergey Shanshin
b5143ba2ab Optimize check for missing fields in deserialization (#3862)
Fixes Kotlin/kotlinx.serialization#662 Kotlin/kotlinx.serialization#657
2020-11-25 21:50:42 +03:00
Svyatoslav Kuzmich
f9503efb74 [JS IR] Make WITH_RUNTIME imply KJS_WITH_FULL_RUNTIME
There is a lot of intersection between these
2020-11-25 21:22:39 +03:00
Bingran
b0ebb02b6f Fix more deprecated configurations and disable fail mode for some tests 2020-11-25 20:56:11 +03:00
Bingran
858f73124d Update settings script properly, more tests with warning-mode=fail
For some test class where most of the sub tests are able to run
warning-mode=fail, we should not disable that warning mode for all
sub tests in that class.
2020-11-25 20:56:11 +03:00
Bingran
52c22d891f MPP plugin: add expectedBy deps to "api" configuration
Currently, KotlinPlatformJvmPlugin and KotlinPlatformJsPlugin are
adding expectedBy deps to "compile" configuration which is deprecated
by Gradle. This PR fixes that by replacing "compile" with "api" which
is what we are doing in KotlinPlatformAndroidPlugin.

This PR also makes integration tests running with warning-mode=fail by
default and fixes most of the integration tests. For the remaining tests
to be fixed, we make them run with warning-mode=summary and will fix
them incrementally in following PRs.
2020-11-25 20:56:11 +03:00
Hung Nguyen
4bf63a9539 Sort class members to ensure deterministic builds
Class methods and fields are currently sorted at serialization (see
DescriptorSerializer.sort) and at deserialization (see
DeserializedMemberScope.OptimizedImplementation#addMembers). Therefore,
the contents of the generated stub files are sorted in incremental
builds but not in clean builds.

The consequence is that the contents of the generated stub files may not
be consistent across a clean build and an incremental build, making the
build non-deterministic and dependent tasks run unnecessarily (see
KT-40882).

To work around that, this commit sorts class methods and fields when
outputting stub files.

Bug: KT-40882 (there are actually 2 issues in here; this commit fixes
     the first one)
Test: New DeterministicBuildIT + Updated existing test expectation files
2020-11-25 20:51:09 +03:00
Igor Chevdar
07a797cc3a [IR] Fixed bug with type parameters of referenced constructor 2020-11-25 21:27:09 +05:00
Kevin Bierhoff
c90546104e Uast: partial fix for reified functions resolve (#3923, KT-41279)
doesn't take into account compiled reified functions from jars
2020-11-25 18:21:14 +03:00
Dmitry Petrov
7cc6204d6b Minor: update testData 2020-11-25 17:31:47 +03:00
Dmitry Petrov
e5dce9f994 KT-42933 inline class backing field can't be static 2020-11-25 17:31:46 +03:00
Dmitry Petrov
f6abc5c3cf KT-43286 use JVM 1.8 intrinsics for coercible unsigned values only 2020-11-25 17:31:46 +03:00
Dmitry Petrov
498047e64e KT-43562 don't remap static inline class funs as special builtins 2020-11-25 17:31:46 +03:00
Sergey Shanshin
f6c7372089 Fix serializing properties with custom accessors (#3907)
Fixes Kotlin/kotlinx.serialization#956
2020-11-25 17:06:10 +03:00
pyos
7327c20200 FIR: add a resolution mode for property delegates
Like function arguments, they are context-dependent, but unlike function
arguments, callable references should be resolved eagerly as if they are
explicit receivers.
2020-11-25 16:55:10 +03:00
Jinseong Jeon
0a5b899aab FIR: more comprehensive substitution of stub types after builder inference 2020-11-25 16:55:09 +03:00
Jinseong Jeon
30c97e6cb4 FIR: update unsubstituted return types in builder
#KT-43340 Fixed
2020-11-25 16:55:09 +03:00
Jinseong Jeon
d58e5b1d95 Remove unnecessary semi-colons 2020-11-25 16:55:09 +03:00
Jinseong Jeon
a0dd62f8c5 Remove unnecessary expression 2020-11-25 16:55:09 +03:00
Jinseong Jeon
dfc5059d6b FIR: reproduce KT-43340 2020-11-25 16:55:08 +03:00
Andrei Klunnyi
c13650fd79 KT-43511 [Gradle Runner]: run task is not created for top level modules 2020-11-25 11:10:22 +00:00
Vladimir Dolzhenko
25a631a1ca Improved IDE performance tests vega specs 2020-11-25 10:08:57 +01:00
Ilya Kirillov
dcdd69d039 Invalidate caches before resolve in AbstractPerformanceHighlightingTest 2020-11-25 09:18:19 +01:00
Victor Petukhov
04846ca47a Rework checking constraints by presented OnlyInputTypes annotation in accordance with changed incorporation mechanism 2020-11-25 11:15:23 +03:00
Victor Petukhov
0857b9c9e7 Rethink constraints incorporation
Namely, remove incorporation “otherInsideMyConstraint” to eliminate
constraint system redundancy and produce a potentially very large number
 of constructs.
Instead, introduce not so “spreadable” incorporation during variable
fixation (equality constraint with result type into other constraints).
^KT-41644 Fixed
^KT-42195 Fixed
^KT-42920 Fixed
^KT-42791 Fixed
^KT-41741 Fixed
2020-11-25 11:15:20 +03:00
Victor Petukhov
616e40f879 Reuse equality constraints during simplification in adding constraints 2020-11-25 11:15:19 +03:00
Ilmir Usmanov
aabe709079 Value classes: Add @JvmInline annotation to stdlib 2020-11-25 01:08:31 +01:00
Andrey Uskov
a7100134a0 Don't mark testJsTestOutputFileInProjectWithAndroid as flaky in 202 2020-11-24 23:05:55 +03:00
Mikhail Glukhikh
ee40b3a4a4 Drop redundant fields around AbstractFir2IrLazyFunction 2020-11-24 17:50:12 +01:00
Mikhail Glukhikh
fda5ee7d06 Fir2IrLazyPropertyAccessor: make inline iff FIR accessor is inline 2020-11-24 17:50:12 +01:00
Mikhail Glukhikh
d27a0c91f6 Extract AbstractFir2IrLazyFunction (base for accessor & simple function) 2020-11-24 17:50:12 +01:00
Mikhail Glukhikh
c03fa59a63 Introduce Fir2IrLazyPropertyAccessor 2020-11-24 17:50:12 +01:00
Alexander Udalov
7117932623 JVM IR: handle JvmStatic in object as module phase
This allows to get rid of the situation where a JvmStatic function in
object can be seen in different states in different lowerings: unlowered
with a dispatch receiver parameter, declaration is lowered but calls are
not, and both declaration and calls are lowered.

Now it works like this:
1) JvmStatic functions in objects coming from dependencies are always
   loaded as lowered, without the extra dispatch receiver parameter. In
   psi2ir this is done via JVM-specific extension; in fir2ir it's done
   in place (but probably should be extracted to extension too).
2) Functions from sources are created as unlowered by both psi2ir and
   fir2ir, and are lowered in a module-wide phase at the beginning of
   JvmLower.
3) Calls to all JvmStatic functions from objects (from sources and
   dependencies) are lowered in the same phase at the beginning of
   JvmLower.

This ensures that all lowerings after the module-wide phase
`jvmStaticInObjectPhase`, which include all per-file phases, see all
JvmStatic functions in objects without the additional dispatch receiver
parameter, and calls do not have dispatch receiver either.

The only issue with this approach is that function/property reference
representation in reflection needs to have that dispatch receiver
parameter, and that is achieved via a hack in those lowerings, which
seems not too out of place anyway, given that they're handled specially
in kotlin-reflect as well.
2020-11-24 17:50:11 +01:00
Alexander Udalov
0a00cbefaf JVM IR: minor, refactor replaceThisByStaticReference
Allow to replace "this" references not only inside IrBody, but inside
any IrElement. This will be useful in JvmStatic in object lowering where
we want not only to replace usages inside the function body, but also in
default values of its parameters.
2020-11-24 17:50:11 +01:00
Margarita Bobova
ebb545a9fb Split ChangeLog file to files by major releases 2020-11-24 18:46:44 +03:00
Margarita Bobova
71d3d8bffc Add ChangeLog for 1.4.20 2020-11-24 18:46:44 +03:00
Leonid Startsev
b1c355e7eb Directly search in IrClass for declarations to fill bodies with plugin
because some other compiler plugins (Compose) copy/rewrite IR declarations
completely, and in the end, functions that are present in the final IR tree
do not have bodies.

Correctly create IrProperty and IrField when they were absent from the
descriptors (in case for private serializer properties)

Do not use symbol table because 'declare' API is not available in plugins.

Fixes https://github.com/JetBrains/compose-jb/issues/46
2020-11-24 18:40:10 +03:00
Ilya Goncharov
5efefabb93 [JS IR] webpackConfigAppliers as internal to not break Gradle lambda serialization in some cases
[JS IR] Add synthetic config and webpack config is nested object

^KT-43535 fixed
2020-11-24 17:49:33 +03:00
Mikhael Bogdanov
42a9d64578 Track binary output class names 2020-11-24 15:20:12 +01:00
Mikhael Bogdanov
6748560184 Proper support of aggregated processors 2020-11-24 15:20:12 +01:00
Ilya Goncharov
f382a55b17 [JS IR] Add EXPECTED_REACHABLE_NODES for JS tests of external tail args 2020-11-24 16:34:27 +03:00
Sergey Shanshin
176071b7db Add support of nullable serializers to UseSerializers annotation (#3906)
Fixes Kotlin/kotlinx.serialization#984
2020-11-24 16:34:02 +03:00
sebastian.sellmair
6c7247cbd3 syncKotlinAndAndroidSourceSets: Don't register Kotlin source dirs in Android java source dirs 2020-11-24 13:16:11 +00:00
sebastian.sellmair
2286498d8d Share defaultSourceFolder logic between syncKotlinAndAndroidSourceSets.kt and KotlinSourceSetFactory.kt 2020-11-24 13:16:10 +00:00
sebastian.sellmair
7c7eada452 Add comment about unsupported associate compilations to functionalTest source files 2020-11-24 13:16:10 +00:00
sebastian.sellmair
3f98e2974c Expand AndroidSourceSet#kotlinSourceSet to AndroidSourceSet#kotlinSourceSetOrNull 2020-11-24 13:16:09 +00:00
sebastian.sellmair
3e5cbf324d syncKotlinAndAndroidSourceSets.kt: Cover flavors with tests 2020-11-24 13:16:09 +00:00
sebastian.sellmair
cdfbbca580 Also register shaders for kotlin source sets 2020-11-24 13:16:08 +00:00
sellmair
2c325c45e2 Register Kotlin MPP source sets in AGP
^KT-43391 fixed
2020-11-24 13:16:07 +00:00
Dmitry Petrov
3a166f3592 KT-43525 forbid @JvmOverloads on mangled funs and hidden constructors 2020-11-24 16:06:20 +03:00
Alexander Udalov
ca78261d7f Minor, fix "unknown -Xstring-concat mode" error message 2020-11-24 11:50:31 +01:00
Alexander Udalov
ed481add08 Fix performance regression in KotlinSuppressCache.isSuppressedByAnnotated
After a seemingly innocent refactoring in 61548a0a36, we've lost the
optimization that was enabled by the suppressorAbove logic in
isSuppressedByAnnotated.
2020-11-24 11:49:31 +01:00
Ilya Goncharov
efee3ea648 [JS IR] - Remove file lowering declarations from lowering phases
- rename fileToPurenessInitializers onto fileToInitializerPureness
- remove redundant check on top-level property

[JS IR] Rename initialis* to initializ* for consistency

[JS IR] Move propertyLazyInitialization property to context from configuration

[JS IR] Add test on lazy initialization properties order

[JS IR] Add multi module for lazy initialization of properties

[JS IR] Move tests onto js.translator

[JS IR] Rename fileToInitializerPureness according to context name

^KT-43222 fixed
2020-11-24 12:33:44 +03:00
Ilya Goncharov
1b5ebd83de [JS IR] Lazy initialisation is optional for tests
^KT-43222 fixed
2020-11-24 12:33:43 +03:00
Ilya Goncharov
a2d41b86bf [JS IR] Add compiler argument about lazy initialisation
^KT-43222 fixed
2020-11-24 12:33:43 +03:00
Ilya Goncharov
fcb3ee5e45 [JS IR]Add check on pureness to not calculate fields to expression twice
^KT-43222 fixed
2020-11-24 12:33:42 +03:00
Ilya Goncharov
aa0f9dc1e2 [JS IR] Don't target exact wasm backend
^KT-43222 fixed
2020-11-24 12:33:42 +03:00
Ilya Goncharov
c224394dfc [JS IR] Return with createdOn hack
^KT-43222 fixed

[JS IR] Not create initialisation function for file if there were attempt to create it earlier

^KT-43222 fixed

[JS IR] Pureness for PIR and memoize file fields pureness

^KT-43222 fixed
2020-11-24 12:33:42 +03:00
Ilya Goncharov
8b4d42e70a [JS IR] Add initialisation call for functions in method
^KT-43222 fixed
2020-11-24 12:30:37 +03:00
Ilya Goncharov
06b276f9c3 [JS IR] Migrate on body lowering pass and declaration transformer
^KT-43222 fixed
2020-11-24 12:30:21 +03:00
Ilya Goncharov
99d0740234 [JS IR] Ignore JS_IR backend in top level side effect properties
^KT-43222 fixed
2020-11-24 12:30:04 +03:00
Ilya Goncharov
d6bc309c94 [JS IR] Eager initialisation for all pure properties
^KT-43222 fixed
2020-11-24 12:29:48 +03:00
Ilya Goncharov
3da9761f37 [JS IR] Add test on lazy initialisation
^KT-43222 fixed
2020-11-24 12:29:28 +03:00
Ilya Goncharov
f4c1e52338 [JS IR] Continuation parameter in main through accessor
^KT-43222 fixed
2020-11-24 12:29:11 +03:00
Ilya Goncharov
34ee146148 [JS IR] Internal visibility for init fun
^KT-43222 fixed
2020-11-24 12:28:57 +03:00
Ilya Goncharov
07b6ef65a3 [JS IR] Init delegated properties as usual
^KT-43222 fixed
2020-11-24 12:28:07 +03:00
Ilya Goncharov
841118a64d [JS IR] Add init properties call to top level functions
^KT-43222 fixed
2020-11-24 12:27:51 +03:00
Ilya Goncharov
5746a7c4fc [JS IR] Only consider top level properties
^KT-43222 fixed
2020-11-24 12:27:36 +03:00
Ilya Goncharov
0dc4f51d74 [JS IR] Add init function call into first step of property accessor
^KT-43222 fixed
2020-11-24 12:27:20 +03:00
Ilya Goncharov
71bfed3253 [JS IR] From searcher get only properties, mutate in lowering
^KT-43222 fixed
2020-11-24 12:27:04 +03:00
Ilya Goncharov
42e1a3280b [JS IR] Add guard into init properties function
^KT-43222 fixed
2020-11-24 12:25:38 +03:00
Ilya Goncharov
d752b7439e [JS IR] Add init function for properties
^KT-43222 fixed
2020-11-24 12:25:24 +03:00
Alexander Likhachev
003ea4bcdf [Gradle, MPP] Make metadata jar task cc-compatible with warnings
#KT-43329 Fixed
2020-11-24 11:33:20 +03:00
Shagen Ogandzhanian
3282e092d8 [JS] Don't fail on recursive upper bounds while resolving JsExports
Fixes https://youtrack.jetbrains.com/issue/KT-42112
2020-11-23 18:01:00 +01:00
Jinseong Jeon
f9a032dbfa FIR2IR: add AnnotationGenerator to Fir2IrComponents 2020-11-23 19:36:11 +03:00
Jinseong Jeon
eff4cec3e0 FIR2IR: convert annotations on delegated members 2020-11-23 19:36:10 +03:00
pyos
d980074624 FIR: deserialize the fun interface flag 2020-11-23 19:36:09 +03:00
pyos
20c7c4881d FIR: fix @JvmPackageName
A single `JvmGeneratorExtensions` instance should be passed around.
2020-11-23 19:36:08 +03:00
Shagen Ogandzhanian
2d4e9af289 [JS IR] Throw exception if test class or test method has explicit parameter
resolves https://youtrack.jetbrains.com/issue/KT-41032
2020-11-23 15:47:32 +01:00
Ilya Kirillov
c4a8d1c3a1 FIR: use java functional interface as a source of sam function call 2020-11-23 15:31:31 +01:00
Ilya Kirillov
7b1eef136e FIR IDE: introduce KtFirCollectionLiteralReference 2020-11-23 15:31:30 +01:00
Ilya Kirillov
bac5ebcb12 FIR IDE: use custom thread local value for storing KtFirScopeProvider
java.lang.ThreadLocal stores value maps in corresponding threads
which causes memory leaks
2020-11-23 15:31:29 +01:00
Ilya Kirillov
b31def0bae FIR IDE: invalidate analysis session on project roots change 2020-11-23 15:31:26 +01:00
Ilya Kirillov
be95d067f3 FIR IDE: add KotlinOutOfBlockPsiTreeChangePreprocessor 2020-11-23 15:31:24 +01:00
Ilya Kirillov
7a86ca632d FIR IDE: fix collecting diagnostics for anonymous object declaration 2020-11-23 15:31:20 +01:00
Ilya Kirillov
7061608567 FIR IDE: introduce common function to mute tests 2020-11-23 15:31:14 +01:00
Ilya Kirillov
e4d2e38ea2 FIR IDE: fix reference resolving of qualified expression with nested classes 2020-11-23 15:31:11 +01:00
Ilya Kirillov
164f4d14d7 FIR IDE: do not collect diagnostics for generated declarations 2020-11-23 15:31:08 +01:00
Ilya Kirillov
60cc30286c FIR IDE: update file structure testdata after structure elements classes rename 2020-11-23 15:31:05 +01:00
Ilya Kirillov
75990f7619 FIR IDE: fix tesdata 2020-11-23 15:31:02 +01:00
Ilya Kirillov
7320620285 FIR IDE: add local visibility to symbols 2020-11-23 15:30:58 +01:00
Ilya Kirillov
5fdcc4bb83 FIR IDE: refactor KotlinFirModificationTrackerService 2020-11-23 15:30:55 +01:00
Ilya Kirillov
112f6771eb FIR IDE: fix compilation 2020-11-23 15:30:51 +01:00
Ilya Kirillov
65b5e4b62b FIR IDE: make some session components to be non-thread local
To avoid memory leaks
2020-11-23 15:30:47 +01:00
Ilya Kirillov
c3caa3a137 FIR IDE: clean AbstractFirReferenceResolveTest 2020-11-23 15:30:42 +01:00
Ilya Kirillov
3174eb4b09 FIR IDE: do not get ktDeclaration for FirFile 2020-11-23 15:30:39 +01:00
Ilya Kirillov
ff7857a812 FIR IDE: refactor, simplify structure element class names 2020-11-23 15:30:37 +01:00
Ilya Kirillov
15277c0974 FIR IDE: introduce memory leak checking in symbols test 2020-11-23 15:30:36 +01:00
Ilya Kirillov
11e94c1de1 FIR IDE: fix building of local declaration symbols 2020-11-23 15:30:29 +01:00
Ilya Kirillov
e78e26234b FIR IDE: do not store cone session in every KtFirType 2020-11-23 15:30:24 +01:00
Ilya Kirillov
e54d16e7e4 FIR IDE: fix fir declaration leak in symbols 2020-11-23 15:30:20 +01:00
Ilya Kirillov
b01ee163d1 FIR IDE: wrap KotlinDeserializedJvmSymbolsProvider into thread safe cache
This is needed by the two reasons:
- KotlinDeserializedJvmSymbolsProvider does not cache all symbols by itself
and as KtSymbol's holds fir elements under via weak refs, this weak refs
may be garbage collected
- KotlinDeserializedJvmSymbolsProvider is not thread safe
2020-11-23 15:30:17 +01:00
Ilya Kirillov
911662bc2f FIR IDE: introduce out of block modification tracker tests 2020-11-23 15:30:14 +01:00
Ilya Kirillov
da7b12f7e1 FIR IDE: introduce ProjectWideOutOfBlockKotlinModificationTrackerTest 2020-11-23 15:30:12 +01:00
Ilya Kirillov
880e76b203 FIR IDE: introduce FIR IDE specific out of block modification tracker 2020-11-23 15:30:07 +01:00
Ilya Kirillov
6c1faec171 FIR IDE: introduce file structure tests 2020-11-23 15:30:05 +01:00
Ilya Kirillov
7c912cd3e4 FIR IDE: introduce FileElementFactory 2020-11-23 15:30:02 +01:00
Ilya Kirillov
315629c99b FIR IDE: refactor lock provider 2020-11-23 15:29:59 +01:00
Ilya Kirillov
559b07d78a FIR IDE: fix memory leak in scope provider 2020-11-23 15:29:58 +01:00
Ilya Goncharov
64895fe7da [JS IR] Test with js specific moved to js.translator
- Move js function from `main` to separate js file

^KT-40090 fixed
2020-11-23 16:05:33 +03:00
Ilya Goncharov
fe3030c432 [JS IR] Drop last null arguments in calls of external functions
^KT-40090 fixed
2020-11-23 16:05:19 +03:00
Ilya Goncharov
5c731c6c04 [JS IR] Add test in external js fun with default args
^KT-40090 fixed
2020-11-23 16:05:02 +03:00
Jinseong Jeon
8eb2ae18dc FIR checker: refactor EventOccurrencesRange accumulation 2020-11-23 14:54:19 +03:00
Jinseong Jeon
b9d3578a86 FIR checker: refactor ControlFlowInfos whose key is EdgeLabel 2020-11-23 14:54:19 +03:00
Jinseong Jeon
b6a4c279a4 FIR checker: refactor ControlFlowInfos whose value is EventOccurrencesRange 2020-11-23 14:54:19 +03:00
Jinseong Jeon
cf8f5b0912 FIR checker: make calls effect analyzer path-sensitive 2020-11-23 14:54:18 +03:00
Dmitry Petrov
2662679579 KT-43399 properly erase extension receiver type in property$annotations 2020-11-23 13:58:52 +03:00
Dmitry Petrov
551d0c1b64 JVM_IR KT-43440 private-to-this default interface funs are private 2020-11-23 13:56:17 +03:00
Dmitry Petrov
bf7fdcda6e KT-42909 fix missing loop variable in 'withIndex' ranges 2020-11-23 13:56:17 +03:00
Ilya Matveev
a9c9406a55 [Gradle, K/N] Set LIBCLANG_DISABLE_CRASH_RECOVERY=1 for cinterop
Issue #KT-42485 Fixed
2020-11-23 10:49:12 +00:00
Alexander Anisimov
37197a95cd Update ReadMe.md 2020-11-23 13:14:26 +03:00
Kristoffer Andersen
18612c1ef0 [JVM+IR] Rebase LVT test of destructuing in lambda params
The debug experiece of destructuring patterns in lambdas is different
across the two backends due to the IR backend moving local variables
to fields.

However, since the destructuring variable is never actually visible in
the debugger (no linenumbers in the live range of the variable), and
the variable is never used for anything other than hiding it from the
debugger, we propose that it is not actually necessary to include it
in the LVT (and in fact, could be left out of the LVT on the old
backend).
2020-11-23 10:54:04 +01:00
Ivan Gavrilovic
ccc272c49f KT-43489: KGP - Avoid storing build history mapping in a property
If tasks are created eagerly, it is possible for this
mapping to be initalized too early. This causes incremental
compilation to fail, as it will contain mappings only for
projects that have been evaluated thus far.

Fixes KT-43489
2020-11-23 11:45:46 +03:00
Alexander Anisimov
2c28e6556b Add JetBrains to the first part of text 2020-11-23 11:14:52 +03:00
Hollow Man
926dc085da Fix typo
inferrred -> inferred
2020-11-21 14:00:28 +01:00
Vyacheslav Gerasimov
3351887ae5 Build: Upgrade GE plugin to 3.5 2020-11-20 20:15:27 +03:00
LepilkinaElena
dd9c0c5c6e Use separate logic for filtering and skipping in collectAndFilterRealOverrides [KT-43487] (#3921) 2020-11-20 19:10:41 +03:00
Alexander Udalov
362775b6b6 JVM IR: minor, improve exception message 2020-11-20 12:43:47 +01:00
Dmitry Petrov
b495fd542f JVM, JVM_IR: KT-42281 proper array->primitive coercion 2020-11-20 14:33:20 +03:00
Dmitry Petrov
e59c8e0a5c JVM_IR KT-42137 bridges are not generated for fake overrides 2020-11-20 14:33:20 +03:00
Roman Artemev
5d5473ef08 [IR BE] Drop unused context member 2020-11-20 12:04:18 +03:00
Roman Artemev
51cff97b78 [JS IR BE] Drop implicit declaration file 2020-11-20 12:03:05 +03:00
Jinseong Jeon
67604551c5 FIR: reuse visibility checker when determining immutable property reference 2020-11-20 10:48:13 +03:00
Jinseong Jeon
463d53ee5c FIR: handle reference to property with invisible setter 2020-11-20 10:48:13 +03:00
Ilya Gorbunov
b2b2629e79 Use new kotlin.io.path API in tests 2020-11-20 09:03:25 +03:00
Ilya Gorbunov
d38e145529 Use new kotlin.io.path API in generators 2020-11-20 09:03:13 +03:00
Ilya Gorbunov
dce3e57685 Use NIO Files for creating temp files: idea plugin 2020-11-20 06:09:37 +03:00
Ilya Gorbunov
090b562db7 Use NIO Files for creating temp files: scripting, daemon, main-kts 2020-11-20 06:09:37 +03:00
Ilya Gorbunov
c9bbdf6575 Use NIO Files for creating temp files: build tools 2020-11-20 06:09:36 +03:00
Nikolay Krasko
30bb7d19c0 Revert "Build: Temporary disable capturing inputs for tasks"
Now GE server is updated and should process scans with inputs faster.

This reverts commit e331e80b
2020-11-19 23:59:16 +03:00
Nikolay Krasko
e8af601cea Mute very flaky FirPsiCheckerTestGenerated.Regression.testJet53
A very probable failure that can be reproduced locally:

```
ERROR: While resolving call checkSubtype#<R|kotlin/collections/List<kotlin/Int>?|>(Collections#.emptyList#<R|kotlin/Int|>())
java.lang.RuntimeException: While resolving call checkSubtype#<R|kotlin/collections/List<kotlin/Int>?|>(Collections#.emptyList#<R|kotlin/Int|>())
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer.transformFunctionCall(FirExpressionsResolveTransformer.kt:282)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFunctionCall(FirBodyResolveTransformer.kt:114)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFunctionCall(FirBodyResolveTransformer.kt:30)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFunctionCall(FirTransformer.kt:957)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFunctionCall(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.expressions.FirFunctionCall.accept(FirFunctionCall.kt:31)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.fir.visitors.FirTransformerUtilKt.transformSingle(FirTransformerUtil.kt:12)
	at org.jetbrains.kotlin.fir.declarations.impl.FirPropertyImpl.transformInitializer(FirPropertyImpl.kt:104)
	at org.jetbrains.kotlin.fir.declarations.impl.FirPropertyImpl.transformInitializer(FirPropertyImpl.kt:34)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer.transformChildrenWithoutAccessors(FirDeclarationsResolveTransformer.kt:278)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer.access$transformChildrenWithoutAccessors(FirDeclarationsResolveTransformer.kt:42)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer.transformProperty(FirDeclarationsResolveTransformer.kt:132)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformProperty(FirBodyResolveTransformer.kt:254)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.access$transformProperty$s1271549241(FirImplicitBodyResolve.kt:116)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer$transformProperty$1.invoke(FirImplicitBodyResolve.kt:143)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer$transformProperty$1.invoke(FirImplicitBodyResolve.kt:116)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.computeCachedTransformationResult(FirImplicitBodyResolve.kt:169)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.transformProperty(FirImplicitBodyResolve.kt:142)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer.transformProperty(FirImplicitBodyResolve.kt:116)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitProperty(FirTransformer.kt:753)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitProperty(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.declarations.FirProperty.accept(FirProperty.kt:53)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.visitNoTransform(FirBodyResolveTransformer.kt:358)
	at org.jetbrains.kotlin.idea.fir.low.level.api.trasformers.FirDesignatedImplicitTypesTransformerForIDE.transformDeclarationContent(FirDesignatedImplicitTypesTransformerForIDE.kt:42)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:66)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:30)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:801)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.declarations.FirFile.accept(FirFile.kt:32)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.visitNoTransform(FirBodyResolveTransformer.kt:358)
	at org.jetbrains.kotlin.idea.fir.low.level.api.trasformers.FirDesignatedImplicitTypesTransformerForIDE.transformDeclarationContent(FirDesignatedImplicitTypesTransformerForIDE.kt:42)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:66)
	at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer.transformFile(FirBodyResolveTransformer.kt:30)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:801)
	at org.jetbrains.kotlin.fir.visitors.FirTransformer.visitFile(FirTransformer.kt:140)
	at org.jetbrains.kotlin.fir.declarations.FirFile.accept(FirFile.kt:32)
	at org.jetbrains.kotlin.fir.FirElement$DefaultImpls.transform(FirElement.kt:29)
	at org.jetbrains.kotlin.fir.FirPureAbstractElement.transform(FirPureAbstractElement.kt:11)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver$runLazyResolvePhase$$inlined$runPhaseWithCustomResolve$3.run(utils.kt:82)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:188)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.runLazyResolvePhase(FirLazyDeclarationResolver.kt:246)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.runLazyResolveWithoutLock(FirLazyDeclarationResolver.kt:127)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.lazyResolveDeclaration(FirLazyDeclarationResolver.kt:63)
	at org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver.lazyResolveDeclaration$default(FirLazyDeclarationResolver.kt:39)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.createDeclarationStructure(FileStructure.kt:131)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.createStructureElement(FileStructure.kt:171)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.access$createStructureElement(FileStructure.kt:29)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure$getStructureElementForDeclaration$structureElement$1.apply(FileStructure.kt:48)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure$getStructureElementForDeclaration$structureElement$1.apply(FileStructure.kt:29)
	at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1853)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.getStructureElementForDeclaration(FileStructure.kt:46)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.getStructureElementFor(FileStructure.kt:42)
	at org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.FileStructure.getAllDiagnosticsForFile(FileStructure.kt:71)
	at org.jetbrains.kotlin.idea.fir.low.level.api.diagnostics.DiagnosticsCollector.collectDiagnosticsForFile(DiagnosticsCollector.kt:27)
	at org.jetbrains.kotlin.idea.fir.low.level.api.FirModuleResolveStateImpl.collectDiagnosticsForFile$idea_fir_low_level_api(FirModuleResolveStateImpl.kt:63)
	at org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacade.collectDiagnosticsForFile(LowLevelFirApiFacade.kt:93)
	at org.jetbrains.kotlin.idea.frontend.api.fir.components.KtFirDiagnosticProvider.collectDiagnosticsForFile(KtFirDiagnosticProvider.kt:26)
	at org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.collectDiagnosticsForFile(KtAnalysisSession.kt:63)
	at org.jetbrains.kotlin.idea.fir.highlighter.KotlinHighLevelDiagnosticHighlightingPass.doCollectInformation(KotlinHighLevelDiagnosticHighlightingPass.kt:36)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:52)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:442)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1106)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:435)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:434)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:410)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:168)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:168)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:408)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:171)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:163)
```
2020-11-19 23:58:02 +03:00
Steven Schäfer
7bfe2c0bbc JVM IR: Update test expectation for testSamAdapterAndInlineOnce
...and remove redundant bytecode text tests.
2020-11-19 19:46:49 +01:00
Steven Schäfer
8574cb4466 JVM IR: Don't generate line numbers and null checks in SAM wrapper constructors 2020-11-19 19:46:49 +01:00
Steven Schäfer
68e2d0d245 JVM IR: Generate synthetic final implementation methods in SAM wrappers 2020-11-19 19:46:49 +01:00
Steven Schäfer
a475fa2a21 JVM IR: Use raw types in SAM wrappers 2020-11-19 19:46:49 +01:00
Steven Schäfer
999151abac JVM IR: Generate SAM wrapper fields as synthetic final 2020-11-19 19:46:49 +01:00
Steven Schäfer
ec1d42e92b JVM IR: Generate SAM wrapper classes as non-synthetic 2020-11-19 19:46:49 +01:00
Steven Schäfer
36711a768b JVM IR: Use inline SAM wrappers inside of inline lambdas 2020-11-19 19:46:49 +01:00
Alexander Udalov
f2b8c67962 Fix JvmTarget6OnJvm11 tests after 7b5544ebd3 2020-11-19 18:49:55 +01:00
Ilmir Usmanov
c22071566e IC mangling: Use old mangling scheme when LV is 1.3
Add integration test to check, that nothing is broken with LV 1.3.
2020-11-19 17:39:34 +01:00
Ilmir Usmanov
7ee35af721 IC mangling: Use correct mangling scheme when
checking for duplicate signatures.
2020-11-19 17:39:33 +01:00
Ilmir Usmanov
7761d30365 Minor. Add test to check fallback 2020-11-19 17:39:33 +01:00
Ilmir Usmanov
7a18ab9094 IC mangling: Generate version requirements to properties as well
Generate the requirements at JVM only.
2020-11-19 17:39:32 +01:00
Ilmir Usmanov
0d79ed1077 Minor. Update test data 2020-11-19 17:39:32 +01:00
Ilmir Usmanov
9070d6d581 IC mangling: Use old mangling scheme in stdlib 2020-11-19 17:39:31 +01:00
Ilmir Usmanov
89d45bf909 IC mangling: Use old mangling scheme in FIR tests
instead of ignoring them.
This affects all unsigned tests.
2020-11-19 17:39:31 +01:00
Ilmir Usmanov
2cd9016016 IC mangling: Replace compiler hack with configuration flag 2020-11-19 17:39:30 +01:00
Ilmir Usmanov
bc1b6fef1f IC mangling: Generalize mangling algorithm between two backends 2020-11-19 17:39:29 +01:00
Ilmir Usmanov
b33774e5f2 IC mangling: Use empty list as a separator in the new mangling scheme 2020-11-19 17:39:28 +01:00
Ilmir Usmanov
20e7a77b78 IC mangling: Write version 1.4.30 requirement to functions with new mangling 2020-11-19 17:39:28 +01:00
Ilmir Usmanov
2829d37cf5 IC mangling: Use old mangling scheme for stdlib
This way, new stdlib can still be usable in 1.4.20
2020-11-19 17:39:27 +01:00
Ilmir Usmanov
488d4ab018 IC mangling: Use '_' instead of 'x' as a placeholder before hashing 2020-11-19 17:39:27 +01:00
Ilmir Usmanov
f7164404c9 IC mangling: Ignore FIR tests 2020-11-19 17:39:26 +01:00
Ilmir Usmanov
23184bae05 IC mangling: JVM_IR: Fallback to old mangling rules
if classfile does not contain functions mangled in the new way.
2020-11-19 17:39:26 +01:00
Ilmir Usmanov
546eea1982 IC mangling: Old JVM BE: Fallback to old mangling rules
if classfile does not contain functions mangled in the new way.
2020-11-19 17:39:25 +01:00
Ilmir Usmanov
c62093f54c IC mangling: Change mangling rules
1. Use 'x' for each parameter, which is not an inline class, every
possible clash is handled by signature rather than name. This change
makes more API changes binary-compatible. So, the changes are in line
with the vision of inline classes are value classes, like primitives.

2. Take return type into account when mangling a function if the return
type is inline class. Otherwise, boxing bridge will not be generated,
which leads to CCE at runtime.
2020-11-19 17:39:24 +01:00
Alexander Udalov
d21a01ef59 IR: improve "no such .. argument slot" exception message
Include the symbol signature, if it's available.
2020-11-19 16:34:03 +01:00
Kirill Shmakov
8ede19811d Make mpp tests gutters aware of different platforms run
Behaviour is similar to the test suite gutters:
- simple triangle when there is no history
- triangle + red circle if some runs failed
- triangle + green circle if all runs passed

^KMM-100 Fixed.
2020-11-19 17:20:06 +03:00
Dmitriy Dolovov
0d50ccc42d [Commonizer] Fix: Lost nullability in commonized type aliases 2020-11-19 16:47:24 +03:00
Dmitry Petrov
e17158d961 JVM_IR KT-42758 don't use 'this' for object self-reference by name 2020-11-19 16:34:04 +03:00
Dmitry Petrov
118a7d4e34 JVM_IR KT-43242 generate switch subject as primitive 'int' 2020-11-19 16:34:04 +03:00
Andrei Klunnyi
05ddbeab0a KT-42561 [Gradle Runner]: run task is created for extra modules
Approach to take classpath from 'project.sourceSets' failed because it
was applied to extra modules - those without java like plugins
(extending project model with 'sourceSets').

This commit specifies criterion of gradle-project selection - the one to
create run task for.
    
^KT-42561 fixed
2020-11-19 12:47:39 +00:00
LepilkinaElena
b0c74c841e Remove extra copyOf calls during filtering in collectRealOverrides (#3916) 2020-11-19 09:53:25 +03:00
Alexander Udalov
7b5544ebd3 Use -source/target 1.6 for Java sources in codegen tests
In cases when the test has the JVM_TARGET directive, use that one for
Java compilation as well.

Otherwise, for box tests, the corresponding test in `JvmTarget6OnJvm6`
(module `:compiler:tests-different-jdk`) will fail. However, it affects
all codegen tests, so fix a bunch of them which use Java 8+ features to
explicitly compile with JVM target 1.8. In particular, this obsoletes
the SKIP_JDK6 directive in those tests because "JVM_TARGET: 1.8" also
skips it for JDK 6.

The check for IS_SOURCE_6_STILL_SUPPORTED is needed in order to still be
able to run tests in the project while only having a single JDK > 11
installed, and having all of the env vars JDK_16, JDK_17, JDK_18
pointing to that JDK.
2020-11-18 18:43:43 +01:00
Mads Ager
7b4e0b2f5d [JVM_IR] Deal with lowering ordering issues for JvmStatic function references.
Do not destructively update the @JvmStatic function, instead
create a copy on first access, and replace the original with
the copy in the jvm static lowering. This ensures that the original
function is seen in other lowerings independently of file lowering
order.
2020-11-18 17:13:00 +01:00
Dmitry Petrov
3d2f5f4bc1 KT-42018 explicitly cast inline class values in safe-as 2020-11-18 18:51:15 +03:00
Kristoffer Andersen
edd3b457d4 [JVM+IR] Migrate/improve receiver mangling test suite 2020-11-18 15:18:10 +01:00
Kristoffer Andersen
5967e8295e [IR] Align captured receiver variable naming with old BE 2020-11-18 15:18:10 +01:00
Vladimir Dolzhenko
7732fc38e0 Add more IDE performance tests vega chart specs 2020-11-18 14:31:56 +01:00
Mikhail Glukhikh
bcf6980f67 [FIR2IR] Fix CCE in FirTypeRef.canBeNull 2020-11-18 16:26:13 +03:00
Mikhail Glukhikh
91738b7f88 [FIR] Fix broken IDE test data 2020-11-18 16:05:50 +03:00
Dmitry Petrov
ca41f733b6 KT-41841 no delegate to private $default fun in multifile facade 2020-11-18 15:04:39 +03:00
Jinseong Jeon
9a99af53ba FIR JVM: correct signature conversion for array
#KT-43339 Fixed
2020-11-18 13:06:51 +03:00
Jinseong Jeon
77ce5ea15d FIR Java: handle primitive void return type for synthetic setter 2020-11-18 13:06:50 +03:00
Jinseong Jeon
5c61079d75 FIR: reproduce KT-43339 (Throwable.stackTrace) 2020-11-18 13:06:49 +03:00
Jinseong Jeon
4cb32cd38a FIR2IR: add implicit NOT_NULL cast for @FlexibleNullability type 2020-11-18 13:06:48 +03:00
Mikhail Glukhikh
b658e99f91 FIR Java: simplify flexible nullability manipulations 2020-11-18 13:06:47 +03:00
Jinseong Jeon
fc7f589caa FIR Java: record Java types with flexible nullability 2020-11-18 13:06:46 +03:00
Jinseong Jeon
1f48092ec1 FIR Java: convert more annotations to @EnhancedNullability 2020-11-18 13:06:45 +03:00
Alexander Gorshenev
01ef41ab17 No need to explicitly deprecate -Xdisable-fake-override-validator
A warning is produced automagically
2020-11-18 12:46:40 +03:00
Alexander Gorshenev
f42b902bc8 Made -Xfake-override-validator off by default
Deprected -Xdisable-fake-override-validator
2020-11-18 12:46:40 +03:00
Steven Schäfer
4e03b1e05f JVM: Allow the JvmSynthetic annotation on file classes (KT-41884) 2020-11-17 22:06:19 +01:00
Dmitriy Dolovov
66bc142f92 [Commonizer] Empty sources/javadocs Jars 2020-11-17 19:02:18 +03:00
Dmitry Petrov
a27c6b77cf KT-43370 ACC_DEPRECATED on property accessors implemented by delegation 2020-11-17 18:16:37 +03:00
Dmitriy Novozhilov
986bdd1099 Build: replace usages of kotlin.build.useIR with kotlinBuildProperties.useIR 2020-11-17 18:14:09 +03:00
Dmitriy Novozhilov
c625a83ab5 Build: replace usages of idea.fir.plugin with kotlinBuildProperties.useFirIdeaPlugin 2020-11-17 18:14:08 +03:00
Dmitriy Novozhilov
1a3727a17c Build: advance kotlin-build-gradle-plugin version in build files 2020-11-17 18:14:08 +03:00
Dmitriy Novozhilov
f531612aa4 Build: update kotlin-build-gradle-plugin version 2020-11-17 18:14:08 +03:00
Dmitriy Novozhilov
bab08c29be Build: add several FIR flags to kotlin-build-gradle-plugin 2020-11-17 18:14:08 +03:00
Alexander Udalov
8160f579d3 Build: add useIR/useIRForLibraries to kotlin-build-gradle-plugin 2020-11-17 18:14:07 +03:00
Nikolay Krasko
e331e80b5d Build: Temporary disable capturing inputs for tasks
We are suffering from the increasing build scan queue. Try to help
the server to overcome it.
2020-11-17 15:08:44 +03:00
Ivan Gavrilovic
33a0ec9b4f KGP: Clean up configurations setup
KAPT classpath now uses extendsFrom in order to
resolve all configurations as a single graph.

Also, use Configuration.extendsFrom instead of
DependencyHandler.add that is being deprecated
in Gradle 6.7.
2020-11-17 10:44:15 +03:00
Ivan Gavrilovic
519aeeb644 KT-40140: Task configuration avoidance for Android projects
When adding Java sources to Kotlin task, avoid
force-configuring source-generating tasks in AGP.

Fixes https://youtrack.jetbrains.com/issue/KT-40140.

Test: ConfigurationAvoidanceIT.testAndroidUnrelatedTaskNotConfigured
2020-11-17 10:43:48 +03:00
Yan Zhulanow
d376585821 IDE dependencies: Publish kotlin-coroutines-experimental-compat library 2020-11-17 10:29:21 +03:00
Vyacheslav Gerasimov
d7474bb2f7 Build: Use only @Exported & whitelisted classes for tools.jar api
This makes it stable between JDK vendors and versions
2020-11-17 01:21:00 +03:00
Alexander Likhachev
ac851523d8 [Gradle, MPP] Make KotlinCompileCommon task cc-compatible with warnings
Kotlin options are accessed via compilation. Compilation field is marked as transient and so not available after deserializing task from Gradle configuration cache.
Accessing 'isCompatibilityMetadataVariantEnabled' property via project in tasks 'onlyIf' causes Gradle to project instance serialization attempt that fails
(#KT-43141, #KT-43329) Fixed
2020-11-17 00:52:30 +03:00
Denis Zharkov
c6f46598ca Set TARGET_BACKEND to JVM for failing irrelevant tests 2020-11-16 22:20:44 +03:00
Martin Petrov
68fdeaf865 Produce deterministic jar files.
This resets all timestamps present in jars produced by kotlinc.

This is important for build systems like bazel that rely on
deterministic outputs.

Before:

```
$ kotlinc ~/test.kt -d /tmp/a.jar
$ kotlinc ~/test.kt -d /tmp/b.jar
9ab80cd40c9293a7a66adf1154d4e6e9aa92d5b0  /tmp/a.jar
1ba022697317f796bd123fb4dc95418a18bcb51a  /tmp/a.jar
6d2a2683470c24928f3fbd6768a4c57f55b0d196  /tmp/b.jar
$ unzip -l /tmp/a.jar
Archive:  /tmp/a.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
       75  09-25-2020 16:48   META-INF/MANIFEST.MF
      683  09-25-2020 16:48   TestKt.class
       28  09-25-2020 16:48   META-INF/main.kotlin_module
---------                     -------
      786                     3 files
```

After:

```
$ kotlinc ~/test.kt -d /tmp/a.jar
$ kotlinc ~/test.kt -d /tmp/b.jar
$ shasum /tmp/a.jar /tmp/b.jar
9ab80cd40c9293a7a66adf1154d4e6e9aa92d5b0  /tmp/a.jar
9ab80cd40c9293a7a66adf1154d4e6e9aa92d5b0  /tmp/b.jar
$ unzip -l /tmp/a.jar
Archive:  /tmp/a.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
       75  12-31-1969 19:00   META-INF/MANIFEST.MF
      590  12-31-1969 19:00   TestKt.class
       36  12-31-1969 19:00   META-INF/main.kotlin_module
---------                     -------
      701                     3 files
```

See https://github.com/JetBrains/kotlin/pull/3226 for a similar change.
2020-11-16 19:25:20 +01:00
Alexander Udalov
a3830b2611 JVM IR: copy corresponding property+annotations for DefaultImpls methods
Instead of using methodSignatureMapper which was an obsolete hack to
make accessor names "getFoo" instead of "<get-foo>".

In particular, this keeps the `@Deprecated` annotation on the
corresponding property, which results in ACC_DEPRECATED in codegen.

 #KT-43326 Fixed
2020-11-16 19:15:49 +01:00
Alexander Udalov
5212ae6bbd JVM IR: keep property annotations for inline class replacements
In particular, `@Deprecated` is not lost anymore and accessors of
deprecated property are generated with ACC_DEPRECATED just as in the old
backend.

 #KT-43327 Fixed
2020-11-16 19:15:49 +01:00
Alexander Udalov
4ca60a2d7d Fix warnings and some inspections in buildSrc 2020-11-16 19:15:43 +01:00
Denis Zharkov
22109e97d6 FIR: Unmute passing FirPsiCheckerTestGenerated.testJet53 2020-11-16 15:50:39 +03:00
Denis Zharkov
14305d1eba FIR: Simplify callable references resolution
Also that fixes some bugs
2020-11-16 15:50:39 +03:00
Denis Zharkov
387fd895a6 FIR: Drop unused FirComposedSuperTypeRef 2020-11-16 15:50:39 +03:00
Denis Zharkov
ad35723f56 FIR: Simplify super-qualified calls resolution 2020-11-16 15:50:39 +03:00
Denis Zharkov
d4c7d4fc7c FIR: Fix callable references resolution with stub receivers
Use stubReceiver as a receiver for fake calls

See issues KT-43358 KT-43359 KT-43378
2020-11-16 15:50:39 +03:00
Denis Zharkov
f97cc0b62d FIR: Rework receivers processing in resolution
- Put extensionReceiver to candidate even if it's explicit (for sake of clarity)
- Split CheckReceiver (dispatch part should only check nullability)
2020-11-16 15:50:39 +03:00
Denis Zharkov
e2099a0307 FIR: Fix false-positive successful resolution of call with lambda receiver
Do not try to integrate/postpone receiver expression to the base system
Receiver should be resolved independently anyway
2020-11-16 15:50:39 +03:00
Denis Zharkov
396e799e5d FIR: Fix resolution for type-alias based SAM 2020-11-16 15:50:39 +03:00
Denis Zharkov
4c9a4548f2 FIR: Fix overrides binding for Java inheritor
`overriddenMembers` contract requires original (non-enhanced) function
See other usages

Ignored tests have been working accidentally

^KT-43289 Open
2020-11-16 15:50:39 +03:00
Denis Zharkov
855af08f7c Regenerate tests 2020-11-16 15:50:39 +03:00
Mikhail Glukhikh
4f7b45dfcc Fir2IrTypeConverter: simplify captured type cache 2020-11-16 15:14:26 +03:00
Jinseong Jeon
cb77b76c0d FIR2IR: convert recursive captured type properly
#KT-43346 Fixed
2020-11-16 15:14:24 +03:00
Mikhail Glukhikh
8ecf056927 [FIR2IR] Enter scope a bit earlier in createIrPropertyAccessor 2020-11-16 14:44:43 +03:00
Mikhail Glukhikh
59c86bcdc4 [FIR2IR] Provide more information for errors inside convertToIrSetCall 2020-11-16 14:44:42 +03:00
Mikhail Glukhikh
9de244515e Upgrade coroutines: 1.3.7 -> 1.3.8 2020-11-16 14:29:58 +03:00
Dmitry Petrov
93f868fb96 KT-43196 member extension property can't be "primary" in inline class 2020-11-16 13:54:19 +03:00
Vladimir Dolzhenko
b6f958f856 Do not queue bg task under read action
Relates to #EA-218701
2020-11-16 09:25:08 +00:00
Dmitriy Dolovov
6e7b5a55b3 kotlinx-metadata: Don't write flags for absent property accessors 2020-11-13 22:54:34 +03:00
Dmitriy Novozhilov
a6cbae9719 [FIR] Rename FirErrors.SYNTAX_ERROR to SYNTAX 2020-11-13 16:19:30 +03:00
Dmitriy Novozhilov
2f5b231d50 [FIR] Add default renderers to FirDiagnosticFactories 2020-11-13 16:19:30 +03:00
Dmitriy Novozhilov
dc662efcf4 [FIR] Introduce FirDiagnosticRenderers 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
ed0e5adce7 [FIR] Make FirAnalyzerFacade returns diagnostics grouped by fir file 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
dabc259ae8 [FIR] Make diagnostics collectors returns List instead of Iterable 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
20453bf0d8 [FIR] Get rid of FirSessionProvider.project property 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
82a2ecfe14 [FIR] Cleanup creating sessions in CLI FIR compiler 2020-11-13 16:19:29 +03:00
Dmitriy Novozhilov
3aa8b09e31 [FIR] Add configurable language version settings to FirSessionFactories 2020-11-13 16:19:29 +03:00
Dmitry Petrov
5d76df6e1a KT-43045 mangle function name for fake override with default impl 2020-11-13 16:15:29 +03:00
Mads Ager
1ecf5943ab [JVM_IR] Determine correct type of empty varargs array.
When calling vararg methods with a generic vararg type without
passing explicit parameters, we have to allocate an empty array
of the right type. We failed to do so previously, as we did
not take the type arguments for the dispatch receiver into
account.
2020-11-13 12:13:53 +01:00
Georgy Bronnikov
ffc003c051 IR: copy IrProperty's attributes in deepCopyWithSymbols 2020-11-13 11:44:35 +03:00
Yan Zhulanow
7b98876475 Parcelize: Fix typo in diagnostic message (KT-43290) 2020-11-13 17:37:21 +09:00
Dmitriy Novozhilov
e3bfb9245c [FIR] Rename nested directory with testdata to innerClasses
This is needed to avoid clashing name of generated test class (`Nested`)
  with annotation @Nested from JUnit 5
2020-11-13 10:36:39 +03:00
Dmitriy Novozhilov
419f54259c [TEST] Change semantics of CHECK_TYPE directive and update testdata
Previously helpers from checkType.kt was in special package, and
  if directive was enabled then test runner (`AbstractDiagnosticTest`)
  injected additional imports to test files and removed them after test
  was completed.
It's very hard to support such behavior in new test infrastructure so
  there was a decision about changing `CHECK_TYPE`:
1. All helpers from `checkType.kt` now stays in default package
2. `CHECK_TYPE` only adds `checkType.kt` to set of analyzed files
      and don't modify their content

For test which are written in default package (most of tests actually)
  there are no changes. On the other hand if there is a test where dev
  want to use checkType functions in testfile with some package then he
  should explicitly import functions which he needed (`checkSubtype`,
  `checkType`, `_`)
2020-11-13 10:36:12 +03:00
Dmitry Petrov
653b26174b KT-43006 don't generate no-arg constructor with inline class parameters 2020-11-13 09:59:34 +03:00
Georgy Bronnikov
364773bf0f IR: fix IrClassSymbol.starProjectedType 2020-11-12 21:49:11 +03:00
Dmitriy Dolovov
f5329b6f1d [Commonizer] Don't publish sources and javadocs 2020-11-12 17:23:52 +03:00
Dmitriy Novozhilov
15cc979378 [FIR] Add enter contract node as exit for exceptional path to avoid compiler crashing
This fixes crashing test
 `FirDiagnosticsTestSpecGenerated.NotLinked.Contracts.Declarations.ContractBuilder.Common.Neg.test17`
2020-11-12 14:46:39 +03:00
Dmitriy Novozhilov
87380d1913 [FIR] Don't assume that exit lambda node is target for exceptional exit for inplace lambdas
#KT-39709 Fixed
#KT-43156 Fixed
2020-11-12 14:46:38 +03:00
Jinseong Jeon
440cf78884 FIR CFG: add more uncaught exception paths 2020-11-12 14:46:37 +03:00
Jinseong Jeon
7b06885348 FIR checker: reproduce KT-43156 2020-11-12 14:46:36 +03:00
Dmitriy Novozhilov
f4347a60c2 [FIR] Fix typo 2020-11-12 14:46:35 +03:00
Mikhail Glukhikh
3c48f2eb68 [FIR] Handle isProp/setProp synthetic pair properly in Java use-site scope 2020-11-12 13:37:38 +03:00
Mikhail Glukhikh
2725930460 [FIR] Code cleanup in JavaClassUseSiteMemberScope 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
fb961f7070 [FIR] Copy also synthetic setter during fake override generation 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
22fb620344 [FIR Java] Copy also synthetic setter during enhancement 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
e0abf3a62c [FIR Java] More precise synthetic setter search in use-site scope
In this commit we detect both Java void & Kotlin Unit return types
2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
c515af4373 Fir2IrDeclarationStorage: extract common getIrCallableSymbol 2020-11-12 13:37:37 +03:00
Mikhail Glukhikh
b90391ced4 [FIR2IR] Implement getIrConstructorSymbol like getIrFunctionSymbol 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
0cc57fc90c Fir2IrDeclarationStorage: reorder functions slightly 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
90f135dc3e [FIR2IR] Use computeDeclarationOrigin in getIrPropertySymbol 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
6c1f5a4513 [FIR2IR] Cache functions/properties both by symbol & signature 2020-11-12 13:37:36 +03:00
Mikhail Glukhikh
92840b8ec5 FirTypeIntersectionScope: fix typo in name 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
5b947144d4 FirTypeIntersectionScope: don't create in no-supertypes situation 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
8ace0d9ad1 [FIR] Replace local types with Any in deserializer 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
744918fb47 [FIR] Cleanup ConeIntegerLiteralTypeImpl 2020-11-12 13:37:35 +03:00
Mikhail Glukhikh
0d03e5f235 [FIR] Simplify constructStarProjectedType 2020-11-12 13:37:34 +03:00
Mikhail Glukhikh
af52232058 [FIR2IR] Use proper lookup tags in data class member generator 2020-11-12 13:37:34 +03:00
Mikhail Glukhikh
7905bc8632 Forbid creation of local ConeClassLikeLookupTagImpl 2020-11-12 13:37:34 +03:00
Bingran
5dc7964137 Optimize the way of enabling "--warning-mode=fail"
Make sure project directory is cleaned up after testing
This change is a "follow-up" PR of
https://github.com/JetBrains/kotlin/pull/3804.
2020-11-12 11:13:56 +03:00
Dmitriy Dolovov
e5539b9a9e Gradle, Native: Log raw and transformed args in KotlinToolRunner, p.2 2020-11-12 10:40:33 +03:00
Ilya Gorbunov
4767696840 Qualify replacement expression with receiver to workaround KT-42874 2020-11-12 05:29:39 +03:00
Andrey Uskov
e0655b2f96 Unmute fixed android importing tests in platform 202 2020-11-12 00:24:50 +03:00
Andrey Uskov
a0d5af8dd1 Execute gutters calculation in read action in tests 2020-11-12 00:24:44 +03:00
Andrey Uskov
e5be9601e6 Disable indexation ExternalSystem tests 2020-11-12 00:24:43 +03:00
Andrey Uskov
9318d401f7 Fix test runtime dependencies in NativeImportingTests 2020-11-12 00:24:42 +03:00
Andrey Uskov
dea383460e Add dependency on platform-images in tests 2020-11-12 00:24:41 +03:00
Yan Zhulanow
5f7d7ff9c7 Parcelize: Activate checkers only when the plugin is enabled for module (KT-43291) 2020-11-12 05:38:27 +09:00
Ilya Kirillov
9d207c2cf5 FIR IDE: temporary mute some not passing tests 2020-11-11 21:02:34 +03:00
Ilya Kirillov
3e43efb93e FIR IDE: fix working with copied file in completion 2020-11-11 21:02:33 +03:00
Igor Yakovlev
0d59656532 FIR IDE: Add resolving KtParameter in FirLazyDeclarationResolver 2020-11-11 21:02:31 +03:00
Dmitriy Novozhilov
345a0d3f89 [FIR] Implement writeGenericType in FirJvmTypeMapper 2020-11-11 21:02:31 +03:00
Ilya Kirillov
9350f7aff9 FIR IDE: remove unused method in light classes with compilation error 2020-11-11 21:02:29 +03:00
Ilya Kirillov
b42bed7b3c FIR IDE: make some access to FIR elements under read locks, resolve under write locks 2020-11-11 21:02:28 +03:00
Ilya Kirillov
12ed92cd49 FIR IDE: allow getting parent declaration for Java one 2020-11-11 21:02:27 +03:00
Ilya Kirillov
cbd1ec35ce FIR IDE: lazy resolve property accessors 2020-11-11 21:02:26 +03:00
Ilya Kirillov
fbc6f1b10f FIR IDE: introduce SOURCE_MEMBER_GENERATED declaration kind 2020-11-11 21:02:24 +03:00
Ilya Kirillov
7dcda00e1d FIR IDE: do not fail on invalid code 2020-11-11 21:02:22 +03:00
Ilya Kirillov
c646cb3d7e FIR IDE: fix deadlock in getter symbol resolve 2020-11-11 21:02:21 +03:00
Ilya Kirillov
171157ff78 FIR IDE: allow reference resolving from EDT
It may be called from some other subsystems like Find usages.
Throwing PCE every time we try to resolve some reference from EDT
may result endless try to resolving
2020-11-11 21:02:19 +03:00
Igor Yakovlev
b742a475ff [FIR IDE] Initial FIR LightClass implementation 2020-11-11 21:02:18 +03:00
Igor Yakovlev
c881cf7af6 [FIR IDE] Add when branch for new symbols in FunctionCallHighlightingVisitor 2020-11-11 21:02:14 +03:00
Igor Yakovlev
b423da106f [FIR IDE] Add fir data into symbols to support FIR LC 2020-11-11 21:02:09 +03:00
Ilya Kirillov
3d93503894 FIR IDE: introduce analyze function for with by existing module resolve state 2020-11-11 21:02:07 +03:00
Igor Yakovlev
dbb54c87bc [FIR IDE] Add Fir lightclasses tests and fix FindUsages tests 2020-11-11 21:02:00 +03:00
Igor Yakovlev
3cefef03ff Move refactoring for ifTrue and ifFalse extensions 2020-11-11 21:01:58 +03:00
Ilya Kirillov
a42674ef0e FIR IDE: add hack to allow access symbols on edt 2020-11-11 21:01:57 +03:00
Igor Yakovlev
97f062cb2a [FIR IDE] Add FirJvmTypeMapper to Ide components factory 2020-11-11 21:01:56 +03:00
Igor Yakovlev
36ffde5ca8 [FIR] Implement isArrayOrNullableArray for ConeTypeContext 2020-11-11 21:01:55 +03:00
sebastian.sellmair
06cb64bb51 Allow open callable members in expect interfaces
#KT-42094 fixed
2020-11-11 17:41:59 +00:00
Dmitriy Dolovov
bf0156f7c6 Native, Gradle IT: Fix GeneralNativeIT.testNativeArgsWithSpaces() 2020-11-11 20:29:36 +03:00
Dmitriy Dolovov
0fe842c38f Gradle, Native: Log raw and transformed arguments in KotlinToolRunner 2020-11-11 20:29:31 +03:00
Dmitriy Dolovov
ee7f3b1bfe Native: Use NIO Files.createTemp*() in favor of File.createTemp*() extension functions 2020-11-11 20:29:25 +03:00
Dmitry Petrov
47e2656ca9 JVM_IR keep track of original overrides at collection stubs generation
KT-43068
2020-11-11 18:35:41 +03:00
Yan Zhulanow
65d8e5a615 Don't publish kotlin-dist-for-ide in publishIdeArtifacts as it's now published alone 2020-11-11 18:12:26 +03:00
Roman Artemev
01f3c06ec9 Add test for KT-40412 2020-11-11 17:00:25 +03:00
Alexander Udalov
116606ecd2 JVM IR: fix class kind of created java.lang.Deprecated symbol
If it isn't ANNOTATION_CLASS, the newly added code in
`FunctionCodegen.isDeprecatedHidden` (0e91d3fcb0) ends up transforming
IR annotation constructor calls to annotation descriptors, and an
assertion fails in `IrBasedDeclarationDescriptor.toAnnotationDescriptor`
which checks that the class has kind ANNOTATION_CLASS.

Specifically, this failed in the JVM IR bootstrap on
`CallResolutionInterceptorExtension.interceptCandidates` from module
'frontend'.
2020-11-11 12:53:32 +01:00
Svyatoslav Kuzmich
c1b73f5fee [Wasm] Diable Wasm IR tests on Windows TeamCity 2020-11-11 14:30:22 +03:00
Vyacheslav Gerasimov
3feff16a77 Cleanup 193 compatibility fixes 2020-11-11 14:28:54 +03:00
Vyacheslav Gerasimov
8620d26a8a Delete 193 bunch files 2020-11-11 14:28:53 +03:00
Alexander Gorshenev
ade46ef808 Update Kotlin/Native: 1.4.30-dev-17200 2020-11-11 14:27:45 +03:00
Sergey Igushkin
3666327c81 Fix JVM maven-publish caching by not capturing state in POM rewriting
In POM rewriting logic, ensure that non-serializable entities are
accessed from within project.provider { ... } and their evaluation
results are therefore properly serialized.

Issue #KT-43054 Fixed
2020-11-11 13:55:07 +03:00
Sam Wang
d1ba2f3d46 Restore KotlinExplicitMovementProvider in as41 and as42 2020-11-11 11:37:27 +01:00
Vladimir Dolzhenko
4f76c747ec Mark org.jetbrains.kotlin.mavenProjectImportHandler as dynamic 2020-11-11 10:29:16 +00:00
Vladimir Dolzhenko
b0f6b739d0 Declare missed org.jetbrains.kotlin.defaultErrorMessages EP 2020-11-11 10:29:16 +00:00
Vladimir Dolzhenko
51a1990e50 Drop missing gradle extensions from jvm-common.xml
Similar to 0cad41bb0c

Relates to ^KT-38518
2020-11-11 10:29:15 +00:00
Kirill Shmakov
0eea3a5e95 Bump AS version
To support newest Canary and fix module wizard issues.
^KT-43188 Fixed.
2020-11-11 12:10:36 +03:00
Mikhail Glukhikh
f2f00a4654 Fix BB test to work on JDK 6 2020-11-11 12:00:18 +03:00
Dmitriy Dolovov
078963eead Native, Gradle IT: Fix assertion message 2020-11-11 11:36:51 +03:00
Alexander Likhachev
fbd8de04b8 [Gradle, K/N] Configuration cache support for run with warns
#KT-42849 Fixed
2020-11-11 10:58:37 +03:00
Alexander Likhachev
2d2042ad12 [Gradle, K/N] Configuration cache support for compile & link with warns
#KT-43151 Fixed
2020-11-11 10:58:37 +03:00
Yaroslav Chernyshev
a3b951e505 [Gradle, Cocoapods] Refactor, log process outputs with info level
Also fixed broken `stdErr` processing for `xcodebuild` commands.

#KT-42938 Fixed
2020-11-11 10:47:11 +03:00
Dmitriy Novozhilov
67b262aa34 [FIR] Move tracking candidate applicability from CheckerSink to Candidate 2020-11-11 09:52:56 +03:00
Dmitriy Novozhilov
f1ac1f177b [FIR] Extract overload by lambda return type into separate component 2020-11-11 09:52:56 +03:00
Dmitriy Novozhilov
a97c107a2b [FIR] Replace callee reference before checking completion from inference session
This is needed because in some cases inference session checks candidate
  and candidates of all sub calls and for that it uses candidate from
  callee reference of call. So we should replace reference with specific
  candidate even if we didn't choose proper candidate yet

#KT-43129
2020-11-11 09:52:56 +03:00
Dmitriy Novozhilov
9f5aadd2f4 [FIR] Implement overload resolution by lambda return type
#KT-43129 Fixed
2020-11-11 09:52:55 +03:00
Dmitriy Novozhilov
025ec8e8b1 Add FQ_NAME postfix to OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION 2020-11-11 09:52:55 +03:00
Dmitriy Novozhilov
dfad21270f [FIR] Remove workaround for #KT-43129
Revert changes from 4612f26b and a936386e
2020-11-11 09:52:55 +03:00
Vyacheslav Gerasimov
1148d527ee Build: Upgradle gradle to 6.7 2020-11-11 02:39:23 +03:00
Kris
173954b3b3 Add samples for Random.nextX() functions 2020-11-11 01:37:37 +03:00
Kris
ebdd023633 Add samples for last() and lastOrNull() functions 2020-11-11 01:37:24 +03:00
Yan Zhulanow
e83a3c3f27 Parcelize: Use @Parcelize annotations from Android Extensions instead of the copied&deprecated ones (KT-42342, KT-43150)
Dex can't merge class files from both android-extensions-runtime and parcelize-runtime, so we have to keep only one copy of each class.
Instead of @Deprecated annotations, there are new diagnostics (without quick-fixes yet).
The goal is to allow simple usages (@Parcelize alone) but forbid kotlinx.android.synthetic.Parceler usage.
2020-11-11 04:25:07 +09:00
Ilmir Usmanov
fa42a6ba58 Use non-local return target instead of inline site in suspend function
return type coercion.
 #KT-43226 Fixed
2020-11-10 20:08:45 +01:00
Mikhail Glukhikh
d4f08018ce [FIR2IR] Extract special symbol provider to make JVM extension 2020-11-10 21:07:27 +03:00
Mikhail Glukhikh
bc47a30dd3 [FIR] Handle 'EnhancedNullability' more properly
This commit includes three changes:
1. 'EnhancedNullability' is no more set for declaration types
2. It is no more used for conversion types in translator
3. Translator inserts implicit not-null cast only when enhanced type is cast to not-null type.
2020-11-10 21:07:27 +03:00
Mikhail Glukhikh
e7a84fd1ee [FIR2IR] Preserve 'EnhancedNullability' type annotation in IR 2020-11-10 21:07:26 +03:00
Jinseong Jeon
f8dc56e2bb FIR render: fix typos on RenderMode 2020-11-10 21:07:26 +03:00
Mikhail Glukhikh
f8e03786c0 Mute not relevant JS/WASM back ends for new BB tests 2020-11-10 21:07:09 +03:00
Juan Chen
9486f58fb1 [FIR] fix subtyping for definitely notnull types.
The current implementation doesn't consider Foo a subtype of Captured<in
Foo>!!, since AbstractTypeCheckerContext::checkSubtypeForSpecialCases
does not handle DefinitelyNotNullType cases. This PR adds handling of
DefinitelyNotNullType by looking at its original type.

^KT-42824 Fixed
2020-11-10 21:07:09 +03:00
Juan Chen
eb804709da [FIR] fix subtyping for nullable captured types.
The issue is the type checker doesn't consider P? a subtype of
CapturedType<in P>?, whereas P a subtype of CapturedType<in P>?. In
AbstractTypeCheckerContext::checkSubtypeForSpecialCases, it checks if
P? is a subtype of the lower type of the captured type, which is
P, and returns false.

This fix uses nullable version of the lower type when the captured
type is marked nullable. To check if P? is a subtype of Captured<in
P>?, we check the LHS, P?, against the nullable lower type of RHS,
P?.

^KT-42825 Fixed
2020-11-10 21:07:09 +03:00
Alexander Udalov
d96223a2ff Fix compiler warnings in new wasm modules
Also don't output v8ExecutablePath in js.tests on each project
configuration.
2020-11-10 18:19:41 +01:00
Alexander Udalov
84d1393711 Minor, workaround compiler exception (KT-43286) 2020-11-10 18:06:17 +01:00
Sergey Shanshin
202459531d Add support of nullable serializers to UseSerializers annotation (#3898)
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/984
2020-11-10 19:42:02 +03:00
Ilya Gorbunov
66f5c98505 Deprecate createTempFile/createTempDir functions
Document their potential permission problems.
Suppress this deprecation in tests.
2020-11-10 18:25:48 +03:00
Georgy Bronnikov
31bfc7d4e3 Fix test data 2020-11-10 17:49:55 +03:00
Georgy Bronnikov
2c404a654b JVM_IR: avoid scope violation in BridgeLowering 2020-11-10 17:49:55 +03:00
Georgy Bronnikov
d246005891 JVM_IR: fix unbound type parameters in AddContinuationLowering 2020-11-10 17:49:55 +03:00
Georgy Bronnikov
9929047f5d JVM_IR: avoid scope violation in BridgeLowering 2020-11-10 17:49:55 +03:00
Dmitry Petrov
e10d8e51b6 JVM_IR more precise superclass stub filtering
Filter out abstract members of superclasses when generating collection
stubs.

KT-43207
2020-11-10 16:41:45 +03:00
Svyatoslav Kuzmich
7f26deb5e6 [Wasm] Enable for loops optimization 2020-11-10 16:09:22 +03:00
Denis Zharkov
233bb47b99 FIR: Fix SAM conversion for raw types with non-trivial TP upper bounds 2020-11-10 14:26:54 +03:00
Denis Zharkov
ce4a11144d FIR: Correctly handle nullable/flexible captured types 2020-11-10 14:26:54 +03:00
Denis Zharkov
ed07bbc734 FIR: Fix inner type resolution during body transformation 2020-11-10 14:26:54 +03:00
Denis Zharkov
a5545b96cb FIR: Fix ambiguity between current Companion and one from supertypes
Companion as qualifier should be found at static scope not a member one
2020-11-10 14:26:54 +03:00
sebastian.sellmair
96352b9c8c Add (and disable) metadata compilation for single backend source sets
KotlinProjectStructureMetadata is created by inspecting source sets
with metadata compilation. Single backend common source sets are
currently not supported for metadata compilation and therefore
did not register one. Foreseeing to support this case with KT-42468,
metadata compilation is now created and registered, but just disabled.
This change will include android variants in
KotlinProjectStructureMetadata even when not officially published.
With those variants, the IDE can infer visibility from some module's
"jvmAndAndroidMain" source set to another modules "jvmAndAndroidMain"

KotlinMetadataTargetConfigurator: rename getPublishedCommonSourceSets to getCommonSourceSetsForMetadataCompilation

KotlinMetadataTargetConfigurator: isMetadataCompilationSupported and add comment to getPublishedCommonSourceSets

Re-use androidPluginIds in KotlinPlugin

KotlinAndroidTarget: Create KotlinComponents for non-published variants and mark them with publishable=false

JvmAndAndroidIntermediateSourceSetTest: add KotlinProjectStructureMetadata jvmAndAndroidMain exists in jvm variants test

AbstractAndroidProjectHandler: Add java sources only in post processing

KotlinAndroidTarget: Inline creation of usageContexts

KotlinAndroidTarget.doCreateComponents: filter non-publishable variants when publishLibraryVariantsGroupedByFlavor is enabled

#KT-42383 fixed
2020-11-10 10:21:40 +00:00
Svyatoslav Kuzmich
03e63f1103 [Wasm] Enable maven-publish plugin in wasm stdlib 2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
ffe3487aa5 [Wasm] Don't generate unnecessary unreachable instructions
Helps with WAT readability
2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
b371b61cf5 [Wasm] Indent blocks of produced WAT
Makes it more readable
2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
4d59a58291 [Wasm] Add interop annotation @JsFun 2020-11-10 13:08:04 +03:00
Svyatoslav Kuzmich
e51a76bc4e [Wasm] Basic CLI
-Xwasm option that will produce wasm instead of JS when used with -Xir-produce-js
Does not affect klib production
2020-11-10 13:08:04 +03:00
Vladimir Dolzhenko
80f316168e Updated IDE perf tests vega visualization to handle wide time ranges with aggregation 2020-11-10 10:58:17 +01:00
Kristoffer Andersen
297c33b452 [IR] Correct line number on suspend function with implicit unit return 2020-11-10 10:58:02 +01:00
Roman Artemev
c2fec38384 [JS IR BE] Unmute fixed tests 2020-11-10 11:06:11 +03:00
Roman Artemev
94acfa50bd [IR BE] Remap dispatch receiver for inner ctor too
- do not forget to add into mapping dispatch receiver
 - fix KT-40686 (at least part of it)
 - add test
2020-11-10 11:06:11 +03:00
Roman Artemev
1ced0138ff [JS IR BE] Drop redundant marker since function doesn't use descriptors anymore. 2020-11-10 11:06:11 +03:00
Dmitriy Novozhilov
e66daf90fd Advance bootstrap to 1.4.30-dev-2196 2020-11-10 11:02:48 +03:00
Dmitry Petrov
785466acee Minor: add '// JVM_TARGET: 1.8' 2020-11-10 06:48:07 +03:00
Alexander Udalov
106ee1d1ff JVM IR: restore ability to suppress codegen-reported diagnostics
In the old backend, BindingContextSuppressCache is used (which is now
created explicitly in GenerationState), which looks up `@Suppress`
annotations on elements right before reporting the diagnostic. In JVM
IR, we clear the binding context after psi2ir, so this approach doesn't
work. This change provides another implementation of KotlinSuppressCache
which eagerly precomputes all suppressions on all annotated elements in
all source files at the point of creation of GenerationState (when the
binding context is still full).

 #KT-43047 Fixed
2020-11-09 19:55:31 +01:00
Alexander Udalov
61548a0a36 Fix inspections and slightly "kotlinify" KotlinSuppressCache 2020-11-09 19:48:04 +01:00
Alexander Udalov
9d3c9a823d Improve rendering of failures in AbstractWriteFlagsTest
When expected and actual flag values are not equal, transform them to
presentable strings according to `Opcodes.ACC_*` field values.
2020-11-09 19:47:54 +01:00
Alexander Udalov
0e91d3fcb0 JVM IR: generate ACC_SYNTHETIC for deprecated-hidden declarations correctly
Extract the logic that computes ACC_SYNTHETIC flag for deprecated
declarations, and use `DeprecationResolver` as the old backend does in
`DescriptorAsmUtil.getCommonCallableFlags`. Creating IR-based
descriptors for each function to pass it there is a bit costly though,
so as a small optimization, use `allOverridden` to check if anything in
the method hierarchy is deprecated.

Also optimize `allOverridden` for the case of linear inheritance which
is far more common.

 #KT-43199 Fixed
2020-11-09 19:47:54 +01:00
Alexander Udalov
d9efc2d922 Fix warnings in compiler code and tests 2020-11-09 19:46:10 +01:00
Roman Golyshev
ebfbc2f601 KT-43205 Ignore annotations in CallableClsStubBuilder when needed
Kotlin compiler can add `@Deprecated` annotations to the fields of
private companion objects, and if those annotations are not supposed to
be shown in decompiled code and used, the field is marked with
`HAS_ANNOTATIONS=false` flag (see KT-25009)

However, it was not taken into account in stubs building process, which
led to the 'Stubs vs PSI mismatch' exceptions

^KT-43205 Fixed

Also, restore the order of nested typealiases and classes (see KT-41859)

We didn't want to bump the version of the stubs when we fixed this
issue; now we have an opportunity to restore the order back to
match the `MemberComparator`

Also, some refactoring is done to underscore that
`createPackageDeclarationsStubs` is suitable only for packages, not
for any declarations container
2020-11-09 15:49:50 +00:00
Svyatoslav Kuzmich
fdd7fa5aea [Wasm] Mute codegen box tests 2020-11-09 16:04:43 +03:00
Svyatoslav Kuzmich
02a84fa6e1 [Wasm] Remove wasmBox tests
They are be covered by common codegen box tests.
2020-11-09 16:04:43 +03:00
Svyatoslav Kuzmich
bfd0f21e9d [Wasm] Major compiler and stdlib update 2020-11-09 16:04:43 +03:00
Svyatoslav Kuzmich
3be38d1796 [Wasm] Add Wasm IR
Intended to be used by Kotlin/Wasm compiler.

Includes:
 * IR tree: declarations, instructions, types.
 * Convertors: ir2text, ir2bin, bin2ir
 * Spec tests, to test convertors against reference Wabt tool
2020-11-09 16:04:42 +03:00
Svyatoslav Kuzmich
65cf991e84 [JS IR] Move JS-specific isInlineClass utils from common to JS compiler module 2020-11-09 16:04:42 +03:00
Vladimir Dolzhenko
e101e6762c Add uploading IDE performance benchmarks to ES 2020-11-09 14:03:58 +01:00
Alexander Gorshenev
ff7c38b2df Unmuted a test 2020-11-09 16:02:15 +03:00
Alexander Gorshenev
eea5a9102c Bump klib abi version to 1.4.2 to reflect absence of serialized fake overrides 2020-11-09 16:02:14 +03:00
Alexander Gorshenev
cb288d47ea Don't serialize fake overrides anymore 2020-11-09 16:02:14 +03:00
Alexander Gorshenev
5de7a10df0 Eliminated -Xdeserialize-fake-overrides 2020-11-09 16:02:14 +03:00
Dmitry Petrov
b9c6267a63 KT-43217 Encode @EnhancedNullability types in IdSignature 2020-11-09 15:20:46 +03:00
Stanislav Erokhin
f6df624c6b KT-43202 Fix isEap function: support RC version
Since 1.4.20 we changed rc suffix to RC.
Old variant (rc) kept just in case
#KT-43202 Fixed
2020-11-09 10:52:50 +03:00
Igor Chevdar
5e0f54a30b [IR] Fixed https://youtrack.jetbrains.com/issue/KT-43159 2020-11-09 11:37:37 +05:00
Pavel Kirpichenkov
0e8cf58a35 Minor: reformat 2020-11-08 15:33:30 +03:00
Pavel Kirpichenkov
b79b94fe75 [MPP] Allow smart casts for properties from dependsOn modules
Smartcasts for public properties from different module are not
stable because module declaring a property in general can be
compiled separately from the module using it. However, if client
module has dependsOn relation with declaring module their simultaneous
compilation is guaranteed which makes this smart cast safe.

Cache all transitive 'expected by' modules in module dependencies.
Extend test to check smart casts are allowed for properties from transitive
'expected by' dependencies and prohibited otherwise.

^KT-42754 Fixed
2020-11-08 15:33:30 +03:00
Pavel Kirpichenkov
778bbd76cb [MPP] Add test for KT-42754 2020-11-08 15:33:30 +03:00
Dmitriy Dolovov
9f0cec3443 Native, Gradle IT: Add verbosity to IT 2020-11-07 11:38:07 +03:00
Alexander Udalov
9adc1a6e9b JVM IR: generate 'main' wrappers as non-final
To replicate bytecode generated by the old backend, and thus simplify
ABI comparison.
2020-11-06 19:27:53 +01:00
Alexander Udalov
791be7c2dc JVM IR: improve ABI of properties in multifile facades
When copying top level declarations from multifile parts to facades,
also copy corresponding properties. This allows to keep their
annotations, which are later used in codegen (for example, to generate
ACC_DEPRECATED on property accessors), and allows to get rid of the hack
where the JVM name of the property accessor was computed prematurely via
methodSignatureMapper.

Also, don't copy `$annotations` methods for non-const properties to
facades because the old backend only generates them in parts (which
might be a separate problem, see KT-27644).

 #KT-40262 Fixed
2020-11-06 19:27:53 +01:00
Alexander Udalov
55974b4eda JVM IR: do not generate InlineOnly property accessors in multifile facade
#KT-37007 Fixed
2020-11-06 19:27:53 +01:00
Alexander Udalov
500b1cfbd3 JVM IR: fix flags of $default methods in multi-file facades
Do not change origin of multifile class bridges to something else
because, as it turns out, there are numerous origin-specific checks in
the codegen that start to behave differently for multifile bridges.
Instead of the method-targeted origin MULTIFILE_BRIDGE, use new class
origin JVM_MULTIFILE_CLASS to detect whether a declaration is a
multifile bridge.

 #KT-40198 Fixed
 #KT-43145 Fixed
2020-11-06 19:27:52 +01:00
Alexander Udalov
d326d6a693 Specify module name via moduleName option instead of freeCompilerArgs
This allows to get rid of warnings about duplicate module name in some
of the modules.
2020-11-06 19:27:32 +01:00
Alexander Udalov
bdb8a58b3b JVM IR: merge JvmBackendFacade into JvmIrCodegenFactory 2020-11-06 19:27:08 +01:00
Alexander Udalov
5c2c2591a1 Minor, rename file to keep git history 2020-11-06 19:27:07 +01:00
Alexander Udalov
624204c7b4 JVM IR: remove outdated code in JvmIrCodegenFactory 2020-11-06 19:27:07 +01:00
Alexander Udalov
b2d49e9615 Minor, fix whitespace in toString 2020-11-06 19:26:49 +01:00
Alexander Udalov
c1a292b01b Psi2ir: improve exception stack traces
- Do not wrap exceptions resulting from generating error expressions
  multiple times, as that could lead to stack traces where the identical
  code is wrapped many times and is printed in the exception message on
  each step, which was difficult to read
- Add element location (file name, line number & position) to the
  message, similarly to exceptions from codegen, when catching and
  rethrowing exceptions at the top level
2020-11-06 19:26:48 +01:00
Dmitriy Dolovov
3cb202f576 Gradle IT: Fix Gradle output checks in Kotlin/Native ITs 2020-11-06 19:24:31 +03:00
Alexander Likhachev
e3db96354d Add javadoc and sources artifacts to kotlin-gradle-build-metrics module
#KTI-382 Fixed
2020-11-06 16:23:32 +03:00
Alexander Gorshenev
5f2a963006 Better wording and comments for klib compatibility code 2020-11-06 16:19:43 +03:00
Alexander Gorshenev
891a4c4621 Dropped outdated klib version compatibility mechanisms 2020-11-06 16:19:43 +03:00
Alexander Gorshenev
8b2b36d61f Enabled klib abi version compatibility 2020-11-06 16:19:42 +03:00
Denis Zharkov
e434a1c892 FIR: Drop unused AbstractFirOverrideScope::create*Copy 2020-11-06 14:44:29 +03:00
Denis Zharkov
2e4c41c0d8 FIR: Drop PossiblyFirFakeOverrideSymbol 2020-11-06 14:44:28 +03:00
Denis Zharkov
7b48625b58 FIR: Remove FirCallableSymbol::overriddenSymbol 2020-11-06 14:44:27 +03:00
Denis Zharkov
78b374ec88 FIR: Do not set overriddenSymbol for KFunction::invoke
It has been probably set by mistake since overriddenSymbol is only used for
fake overrides
2020-11-06 11:32:39 +03:00
Denis Zharkov
a11b488c82 FIR: Add workaround for combination of intersection + delegated members
See org.jetbrains.kotlin.fir.Fir2IrTextTestGenerated.FirProblems#testDelegationAndInheritanceFromJava
2020-11-06 11:32:39 +03:00
Denis Zharkov
41f878e104 FIR: Adjust test data for type alias constructors
They are not SubstitutionOverrides anymore
2020-11-06 11:32:39 +03:00
Denis Zharkov
96c3436e73 FIR: Temporary adjust diagnostics test data
UPPER_BOUND_VIOLATED for type alias constructors is not supported properly
See KT-43142
2020-11-06 11:32:39 +03:00
Denis Zharkov
d58e66e79a FIR: Merge both synthetic type alias constructor kinds 2020-11-06 11:32:39 +03:00
Denis Zharkov
f9aab77ce5 FIR: Simplify ConstructorProcessing relevant to type aliases 2020-11-06 11:32:39 +03:00
Denis Zharkov
8a949b0dcf FIR: Use attribute instead of overriddenSymbol for synthetic type alias constructor 2020-11-06 11:32:39 +03:00
Denis Zharkov
4282e27d73 FIR: Get rid of usages of FirCallableSymbol::overriddenSymbol 2020-11-06 11:32:39 +03:00
Denis Zharkov
728c2a808f FIR: Do not propagate overriddenSymbol at FirObjectImportedCallableScope 2020-11-06 11:32:39 +03:00
Denis Zharkov
037ba4d973 FIR: Simplify VariableStorage::isStable 2020-11-06 11:32:39 +03:00
Denis Zharkov
317d981472 FIR: Do not use overriddenSymbol for imported from object 2020-11-06 11:32:39 +03:00
Denis Zharkov
65119adb6a FIR: Adjust test data. FakeOverride -> SubssitutionOverride 2020-11-06 11:32:39 +03:00
Denis Zharkov
3e37995004 FIR: Get rid of FirCallableSymbol::isFakeOverride and isIntersectionOverride 2020-11-06 11:32:39 +03:00
Alexey Tsvetkov
36387d97ad Add IC metrics reporting 2020-11-05 23:26:46 +03:00
Alexey Tsvetkov
5bde6457b1 Metrics reporting utils 2020-11-05 23:26:46 +03:00
Alexey Tsvetkov
97a09680d5 Remove CompositeICReporterAsync 2020-11-05 23:26:42 +03:00
Zalim Bashorov
2c1e4c1769 [IR] Use more specific type (IrSimpleFunction) for accessors in IrLocalDelegatedProperty 2020-11-05 22:25:05 +03:00
Sergey Igushkin
11bc1c0753 Revert "Fix configuration cache issue in AbstractKotlinTarget" 2020-11-05 21:02:47 +03:00
Roman Artemev
8ca9e792e9 [KLIB] Make sure that referenced local anonymous class is deserialzied.
In case if such class is used an type argument for field type make sure
that field initializer is being read.

Check type recursively.

- fix KT-41143
- update test
2020-11-05 20:28:11 +03:00
Dmitriy Dolovov
0dd329d3d4 Gradle IT: Intercept and log Gradle process output on import failures 2020-11-05 18:51:16 +03:00
Dmitriy Dolovov
4de1bf8d35 Gradle IT: Move GradleProcessOutputInterceptor to the test framework
This is necessary to make GradleProcessOutputInterceptor available for
other tests, e.g. Gradle IT.
2020-11-05 18:51:08 +03:00
Dmitriy Dolovov
fae3ba35e9 Gradle, Native: More verbose logging in KotlinToolRunner
Especially for tools executed in a separate JVM process:
JVM options, Java system properties, custom ENV variables.
2020-11-05 18:51:02 +03:00
Dmitriy Dolovov
734dff6282 [Commonizer] Use compact variants of collections to reduce memory footprint 2020-11-05 18:50:56 +03:00
Dmitriy Dolovov
30bf7b87fe Minor. Code formatted 2020-11-05 18:50:50 +03:00
Dmitriy Dolovov
f5bb60f7cd [Commonizer] Refactor CIR type representation
1. Drop CirClassifierId
2. Specialized classes for each kind of types (classes, TAs, type parameters, flexible types).
3. TypeCommonizer now returns commonized type. In case of TAs this could be a completely new type
   describing expect class or a new TA with the different underlying type.
2020-11-05 18:50:43 +03:00
Dmitriy Dolovov
2764550bbe [Commonizer] Relax conditions for TA lifting-up
Allow lifting up matching TAs with non-empty list of type parameters
and non-empty list of type arguments in the expanded type.
2020-11-05 18:50:37 +03:00
Dmitriy Dolovov
cb2e94df16 [Commonizer] Minor. Convert approximation keys back to data classes 2020-11-05 18:50:31 +03:00
nataliya.valtman
45ce0c6c11 avoid failing KotlinGradleIT.testInternalTest for Windows agent 2020-11-05 13:43:02 +03:00
Sergey Igushkin
c839282f9b Merge pull request #3878 from google/prr/hungnv/KT-43054-configurationCacheIssue
Fix configuration cache issue in AbstractKotlinTarget
2020-11-05 13:26:40 +03:00
Victor Petukhov
90ea64a0e5 Don't report warning about changing execution order for varargs if it's inside an annotation
^KT-43110 Fixed
2020-11-05 13:18:00 +03:00
Victor Petukhov
f052bc341c Don't report warning about implicitly inferred Nothing for call arguments if there is non-Nothing return type
^KT-43108 Fixed
2020-11-05 13:17:59 +03:00
Andrei Klunnyi
7859287337 [KT-40688] Inlay Hints: lambda hints removal on editing
Due to the platform API limitation lambda related hints are treated
separately to all others. Hints removal on editing is not an exclusion
and is now supported as well.
2020-11-05 10:10:19 +00:00
Jinseong Jeon
b3b09ea9b7 FIR: adjust spec testData after DFA changes:
* recording type statements for null assignments
* element-wise join by default
2020-11-04 16:35:42 +03:00
Jinseong Jeon
a5389b067b FIR DFA: use element-wise join everywhere 2020-11-04 16:35:42 +03:00
Jinseong Jeon
771c839d74 FIR DFA: element-wise join at merging points of try expression 2020-11-04 16:35:42 +03:00
Jinseong Jeon
bd173ebebc FIR DFA: isolate effects between blocks in try expression 2020-11-04 16:35:42 +03:00
Jinseong Jeon
1f1e1828a7 FIR CFG: reconfigure exception throwing paths in try expression 2020-11-04 16:35:42 +03:00
Jinseong Jeon
146036010c FIR DFA: add tests about smartcasts in/after try-catch-finally 2020-11-04 16:35:42 +03:00
Mads Ager
2c8c47399a [JVM_IR] Enable KotlinAgainstJava and remaining JavaAgainstKotlin test. 2020-11-04 14:16:37 +01:00
Yunir Salimzyanov
24345bb6b3 Prevent NPE while fetching muted tests from Teamcity server 2020-11-04 16:14:01 +03:00
MikeKulasinski-visa
bc2b396ecd kotlin.native.cocoapods.targets can be a custom list of architectures (#3861)
Co-authored-by: Mike Kulasinski <mike.kulasinski@payworks.com>
Co-authored-by: Ilya Matveev <ilya.matveev@jetbrains.com>
2020-11-04 18:21:12 +07:00
Mads Ager
0279068214 [JVM_IR] Follow old backend in bridge visibility and varargs marking.
The old backend makes bridges for protected and package-private
methods public. Also, for bridges for vararg methods, the vararg
marker is not on the bridge.

These differences seem minor but are visible via reflection, so
we might as well follow the old backend.
2020-11-04 12:03:06 +01:00
Ilmir Usmanov
326768e8b5 Minor. Update test data 2020-11-04 00:20:39 +01:00
Steven Schäfer
bd4e2a283c JVM IR: Don't generate null checks on value parameters of private operator functions
The null check on the extension receiver of private operator functions
is a special case and doesn't extend to value parameters.
2020-11-03 21:44:25 +01:00
Steven Schäfer
d4cb521433 JVM IR: Fix names for SAM callable references with inline class return types
This fixes the ABI issues in KT-42879.
2020-11-03 18:33:34 +01:00
Denis Zharkov
aa81041415 FIR: Fix DiagnosticsTestGenerated when FIR starts requesting light classes
Became necessary after fixing loading Java annotation from deserialization
2020-11-03 18:30:15 +03:00
Denis Zharkov
a936386e53 FIR: Add more complicated workaround for OverloadResolutionByLambdaReturnType
That helps for minOfOrNull/maxOfOrNull
2020-11-03 18:30:15 +03:00
Denis Zharkov
4612f26bfb FIR: Add workaround for OverloadResolutionByLambdaReturnType
Mostly, that should help for existing flatMap usages

^KT-43129 Submitted
2020-11-03 18:30:15 +03:00
Denis Zharkov
07ed89b02b Move OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION to compiler.common
So, it could be used in FIR
2020-11-03 18:30:15 +03:00
Denis Zharkov
a444618c27 FIR: Correctly handle Java annotations from deserialization
To obtain enhanced declarations, we should use type scope
2020-11-03 18:30:15 +03:00
Alexander Udalov
f2b0d057b9 JVM IR: minor optimizations in IrTypeMapper.classInternalName
Replace cubic complexity with square when computing internal name for
nested classes by using StringBuilder instead of concatenating strings,
and don't do getLocalClassType/classNameOverride checks on each step of
the recursion.
2020-11-03 15:40:16 +01:00
Alexander Udalov
b3e79d36df Fix compiler warnings and some inspections 2020-11-03 14:00:53 +01:00
Alexander Udalov
e5d5c20473 Minor, suppress deprecation warnings in parcelize plugin 2020-11-03 14:00:53 +01:00
LepilkinaElena
ee8db2f760 Escape resolving same library several times in K/N (#3880) 2020-11-03 15:57:48 +03:00
Ilmir Usmanov
1376fed1d4 Support non-public inline class constructors
#KT-28056 Fixed
2020-11-03 12:10:21 +01:00
Bingran
88bbeea7f6 Fix deprecated gradle api usage in artifact transform
Previously, when adding --warning-mode=fail to KaptIncrementalIT,
it would fail when testing with advance gradle version because
deprecated configurations in build files of test projects and
gradle api usage in artifact transform.

With this PR, we have two "StructureTransformAction'. The one with
latest gradle api is for use at most cases, the legacy one is for use
when gradle version is less or equal than 5.3 because the new gradle api
is introduced in 5.4.

This change also adds some test fixtures and updates deprecated
configurations to support testing artifact transform.

Test: KaptIncrementalIT
2020-11-03 13:50:16 +03:00
Igor Chevdar
94145f880c [IR] Inliner: supported recursion in default arguments 2020-11-03 11:39:00 +05:00
Ilmir Usmanov
5f8fabed61 Minor. Update test data 2020-11-03 02:20:44 +01:00
Ilya Chernikov
497b7ee266 [minor] fix accidental addition of FirScriptCodegenTestGenerated 2020-11-02 20:35:07 +01:00
Mark Punzalan
89836a2c9a Minor, test-data-only: Remove unused "IGNORE_BACKEND_FIR" directives in
asmLike test-data.
2020-11-02 19:37:14 +01:00
Alexander Udalov
c02e92a5e0 JVM IR: minor, use createJvmIrBuilder to simplify code 2020-11-02 19:33:24 +01:00
Alexander Udalov
dd33ed9297 Fix suspend function with inline class types in reflection
#KT-34024 Fixed
2020-11-02 19:33:23 +01:00
Alexander Likhachev
56f7e34e3e [Gradle, K/N] Revert change of AbstractKotlinNativeCompile supertype
It was changed in order to support build cache for K/N tasks but as we doesn't support cache for CInteropProcess task at the moment, there is no overlapping outputs issue
#KT-43080 Fixed
2020-11-02 20:42:46 +03:00
Vladimir Dolzhenko
369b1ef5df Fix compilation in perfTests 2020-11-02 16:44:04 +01:00
Vladimir Dolzhenko
2bffce2259 Revert Open build tool window on Gradle DSL errors
Proper fix is (to handle any exceptions within ProjectModelContributor EPs) is done in a platform

^EA-236697 Fixed
2020-11-02 15:29:54 +01:00
Vladimir Dolzhenko
1a57794e82 Clean ups in IDE performance tests output 2020-11-02 15:09:30 +01:00
Mads Ager
617279310e [JVM_IR] Rebase inline function and defaults args stepping test. 2020-11-02 13:14:12 +01:00
Ilmir Usmanov
7b315a8b52 JVM_IR: Do not box inline class in methods 2020-11-02 10:50:00 +01:00
Mikhael Bogdanov
e20093d762 Support @JvmStatic and @JvmOverload in annotation companion 2020-11-02 08:27:49 +01:00
Mikhael Bogdanov
7ec2d036ae Don't generate final modifier on static interface methods produced by @JvmStatic+@JvmOverloads from interface companion
#KT-35716 Fixed
2020-11-02 08:27:49 +01:00
Vladimir Dolzhenko
7d0e9654bd Clean ups in IDE performance tests output 2020-11-01 14:29:15 +01:00
Vladimir Dolzhenko
d36511c094 Clean ups in IDE performance tests output 2020-10-31 23:36:35 +01:00
Ilya Kirillov
5fae769a90 Wizard: use new compose icon
#KT-43033
2020-10-31 16:57:07 +03:00
Ilya Kirillov
8eefcbb1d4 Wizard: update compose templates
#KT-43032 fixed
2020-10-31 16:57:05 +03:00
Ilya Kirillov
21928d8f51 Wizard: do not allow creating compose projects with gradle groovy
#KT-42983 fixed
2020-10-31 16:57:05 +03:00
Vladimir Dolzhenko
4f6fa1059c Add missed task dependency for IDE performance tests output 2020-10-31 14:55:58 +01:00
Vladimir Dolzhenko
ceea57ab58 Add missed task dependency for IDE performance tests output 2020-10-31 12:17:04 +01:00
Vladimir Dolzhenko
3c0d43dc0d Rebuild IDE performance tests output
format changes: added warmUp tag, index, benchmark format version
perform post processing: geom mean calc, extract warm-up benchmark
2020-10-30 21:30:02 +01:00
Alexander Udalov
f87e46b599 Kx-serialization: generate wrapper type for reference array serializer 2020-10-30 17:47:29 +01:00
Alexander Udalov
42aef01d79 Kx-serialization: support SerialInfo annotations from dependencies in JVM IR
Also handle call sites correctly, by generating an instance of the Impl
class instead of trying to create the annotation.

 #KT-42976 Fixed
2020-10-30 17:47:29 +01:00
Alexander Udalov
51ded98c4b Kx-serialization: support SerialInfo for JVM IR
No tests added because this is going to be checked by the upcoming build
of kotlinx-serialization runtime with JVM IR.

 #KT-42976 In Progress
2020-10-30 17:45:25 +01:00
Dmitry Petrov
e4ba787034 JVM_IR KT-43066 Generate 'clone' in class implementing kotlin.Cloneable 2020-10-30 19:03:31 +03:00
Mikhail Glukhikh
7b4f781ea8 [FIR] Split primary constructor parameter scope into two different
In init block or property initializers,
for `val x` declared in primary constructor,
`x` reference is now resolved to property, not to parameter.
So we need two different scopes for primary constructor,
one for 'pure' parameters and another one for all parameters,
including val/var ones.

#KT-42844 Fixed
2020-10-30 18:44:55 +03:00
Shagen Ogandzhanian
2d0535a713 [JS_IR] Invoke companion init block while instantiating a class
KT-40740, squashed rr/shagen/KT-40740-static-init-js-ir
2020-10-30 16:19:13 +01:00
Hung Nguyen
6d29bb5814 Fix configuration cache issue in AbstractKotlinTarget
AbstractKotlinTarget#buildAdhocComponentsFromKotlinVariants passes a
non-serializable local object to a lambda, which will fail during
serialization when configuration caching is enabled.

To fix that, this commit passes only the relevant parts of the object
to the lambda.

Bug: https://youtrack.jetbrains.com/issue/KT-43054
Test: Manually verified on
      https://android.googlesource.com/platform/tools/metalava/+/refs/heads/master/
      where the issue was detected (I haven't been able to create a mininal
      reproducible project)
2020-10-30 13:44:49 +00:00
Ilya Chernikov
22117604f6 Move script simple type remapper to the common utilities 2020-10-30 12:57:43 +01:00
Ilya Chernikov
de340e9bc8 Implement support for synthetic script params in IR:
implicit receivers and provided properties
also support script imports
2020-10-30 12:57:43 +01:00
Ilya Chernikov
7572b50385 Expose script parameters from descriptor explicitly...
and universally as ValueParameterDescriptors;
update implementation accordingly
2020-10-30 12:57:43 +01:00
Ilya Chernikov
4cb0437145 [minor] fix reflection usage in scripting tests 2020-10-30 12:57:43 +01:00
Ilya Chernikov
94f2813a8a Add script main function generation to JVM IR backend 2020-10-30 12:57:42 +01:00
Ilya Chernikov
62b9d87bfc [minor] scripting tests improvements 2020-10-30 12:57:42 +01:00
Ilya Chernikov
af7102a586 Enable IR backend in script compiler 2020-10-30 12:57:42 +01:00
Ilya Chernikov
60246f2261 Ignore temporarily the kt22029.kts codegen test for JVM IR:
since it fails and I cannot fix it right now.
2020-10-30 12:57:42 +01:00
Ilya Chernikov
d7112a4500 Implement JVM IR support for scripts 2020-10-30 12:57:42 +01:00
Ilya Chernikov
01d73ba0fc Make IrScript a statement container first, update JS support
The IrScript is now the IrStatementContainer with significant
statements order, and the code is adapted accordingly
2020-10-30 12:57:42 +01:00
Andrei Klunnyi
55048f40ab Disable "Incomplete destructuring declaration"
^KT-43037 fixed
2020-10-30 09:33:18 +01:00
Dominik Wuttke
3acb468d48 Add a link to scope functions overview for takeIf and takeUnless
Co-authored-by: Dominik Wuttke <Dominik.wu@gmx.net>
2020-10-30 04:09:50 +03:00
Uzi Landsmann
f48f7c6dca Added samples for the kotlin.system package (measureTime* functions)
Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
2020-10-30 03:35:15 +03:00
Uzi Landsmann
15381c4662 Added samples for the kotlin.streams package
Co-authored-by: Uzi Landsmann <uzi.landsmann@bisnode.com>
2020-10-30 02:23:31 +03:00
Yuya Urano
18672c99ca KT-20357: Add a sample for requireNotNull 2020-10-30 02:15:48 +03:00
Ciaran Treanor
2b03c10941 Correct small grammatical error in KDocs
Updated KDoc generator template to address all instances of
a grammatical error ("less" -> "fewer").
Also committed newly generate _Collections.kt, _Sequences.kt,
and _Strings.kt.
2020-10-30 01:47:06 +03:00
Ilmir Usmanov
28e148d35a Old JVM: support init blocks in inline classes
#KT-28055 Fixed
2020-10-29 20:38:03 +01:00
Ilmir Usmanov
999604541e JVM_IR: Support init blocks in inline classes
Put their content to constructor-impl, so they are called during
constructor call, but they are not called during boxing, because
box-impl calls <init> and not constructor-impl.

 #KT-28055 In progress
2020-10-29 20:38:01 +01:00
Mikhael Bogdanov
5804f73ebd JVM_IR. Deprecate public access to @JvmField/const fields in private companions
#KT-25009
2020-10-29 17:19:49 +01:00
Mikhael Bogdanov
57c9afc73a Deprecate public access to @JvmField/const fields in private companions
#KT-25009
2020-10-29 17:19:49 +01:00
Alexander Udalov
8be23df668 Remove unneeded dependency of util on deserialization & reflect
This is probably a result of a somewhat incorrectly merged
6c37574fce.
2020-10-29 17:03:11 +01:00
Alexander Udalov
0d1bb9acaf JVM IR: do not clear BindingContext in bytecode tool window 2020-10-29 17:02:58 +01:00
Dmitry Petrov
08b761ae7a PSI2IR don't copy annotations for properties implemented by delegation
KT-43012
2020-10-29 16:23:02 +03:00
Sergey Igushkin
53004f97b1 Store processed metadata artifacts in .gradle/ rather than build/
This allows the files to survive Gradle's `clean` task that deletes the
`build/` directory with all its contents, which leads to the IDE losing
dependencies until next re-import.

The `.gradle` directory is chosen because Gradle creates it in every
project and it is normally included in .gitignore (or otherwise ignored
in VCS).

Related to issue #KT-39568
2020-10-29 15:59:23 +03:00
Mads Ager
dca1f4631c [JVM_IR] Use line number 1 for multifile bridge methods.
This is necessary for the intellij debugger filters to hide
these bridges.

Fixes KT-41961.
2020-10-29 13:04:08 +01:00
Alexander Dudinsky
c8a8410fc5 Fix MultiModuleLineMarkerTest on Windows 2020-10-28 22:35:43 +03:00
Anton Yalyshev
d4d93b7091 Add change-notes for 1.4.20 2020-10-28 21:57:05 +03:00
Alexander Udalov
ad5b6da273 JVM IR: substitute generic type for inline class replacement function calls
The main change here is in `JvmInlineClassLowering.visitFunctionAccess`,
where we now store the substituted return type of the function as the
type of the call expression. Without it, the call could have a
meaningless type, e.g. some `T` which is inaccessible at that place, and
that could backfire in subsequent lowerings in codegen. For example, in
the `stringPlus.kt` test, it would prevent the code in
`FlattenStringConcatenationLowering.isStringPlusCall` from recognizing
and replacing the `String.plus` call, leading to a codegen exception.

Other changes are mostly cosmetics to make the code similar to
`visitFunctionReference`, and preventive optimizations for the case when
the substitution map is empty.
2020-10-28 16:46:28 +01:00
Mikhail Glukhikh
4a3a2ef72a [FIR2IR] Test data fix after rebase (regular + delegated supertype) 2020-10-28 18:09:13 +03:00
Mikhail Glukhikh
60141ccbaa [FIR] Fix Substitution scope key to avoid accidental matches 2020-10-28 18:09:12 +03:00
Mikhail Glukhikh
2dc6467b5d [FIR] Modify signatures also from ERASED_COLLECTION_PARAMETER_SIGNATURES
In this commit we change value parameter type of containsAll, removeAll,
retainAll from Java collections. Originally it's Collection<?>,
we change it to Collection<T>

#KT-42340 Fixed
2020-10-28 18:09:11 +03:00
Jake Wharton
3a693e112b Update ExperimentalPathApi annotation's SinceKotlin value to 1.4 2020-10-28 16:55:57 +03:00
Roman Golyshev
82984089f0 KT-42274 Update SOURCE_STUB_VERSION
This update should have been done in
4b7d34b537 commit, as it is stated in the
`KtTokens.MODIFIER_KEYWORDS_ARRAY` docs.

Shifting all modifiers by one have led resulted in incorrect modifiers
when stubs were read from the disk. Updating `SOURCE_STUB_VERSION` will
make IDEA recreate all stubs from scratch

^KT-42274 Fixed
2020-10-28 12:57:53 +00:00
Mikhail Glukhikh
80108444ec FIR2IR: cleanup implicit cast inserter 2020-10-28 15:44:46 +03:00
Jinseong Jeon
2424f2438c FIR2IR: towards comprehensive visits in implicit cast inserter 2020-10-28 15:44:45 +03:00
Jinseong Jeon
5f6d2c5362 FIR2IR: utilize argument conversions 2020-10-28 15:44:44 +03:00
Jinseong Jeon
f1fd3d6b5d FIR2IR: avoid using constant -1 2020-10-28 15:44:42 +03:00
Jinseong Jeon
707e94bab5 FIR2IR: add test about coercion-to-Unit for nested when 2020-10-28 15:44:41 +03:00
Jinseong Jeon
318f4b5f02 FIR2IR: refactor implicit cast insertion, part 3: implicit not_null 2020-10-28 15:44:40 +03:00
Jinseong Jeon
8708bdec0d FIR2IR: refactor implicit cast insertion, part 2: coerce-to-Unit 2020-10-28 15:44:39 +03:00
Jinseong Jeon
8f8ee88957 FIR2IR: refactor implicit cast insertion, part 1: implicit cast 2020-10-28 15:44:38 +03:00
Jinseong Jeon
e9a7b64ca0 FIR2IR: use AnnotationGenerator to convert file annotations 2020-10-28 15:44:37 +03:00
Mikhail Glukhikh
ef6b643b9c [FIR2IR] Don't set WHILE_LOOP origin for blocks 2020-10-28 15:44:36 +03:00
Yan Zhulanow
eb9b5da82b Kapt: Never mark static methods 'default' (KT-42915) 2020-10-28 21:03:26 +09:00
Toshiaki Kameyama
09e1bed5c9 Redundant 'inner' modifier: fix false positive/negative with constructor call
#KT-40879 Fixed
#KT-41223 Fixed
#KT-41311 Fixed
#KT-41680 Fixed
2020-10-28 18:16:57 +07:00
nataliya.valtman
e9669bf5cb fix unstable IncrementalFileToPathConverterTest tests 2020-10-28 12:33:03 +03:00
Denis Zharkov
2589de6c49 FIR: Refine delegated members introduced to use-site scope
- Do not add hashCode/equals/toString
- Do not add privates and ones that are already declared
2020-10-28 11:43:25 +03:00
Denis Zharkov
2105a041a5 FIR: Optimize usages of containingClass and its implementation 2020-10-28 11:43:25 +03:00
Denis Zharkov
923bb3b674 FIR2IR: Mute failing bb test
^KT-42946 Open
2020-10-28 11:43:25 +03:00
Denis Zharkov
2bdb21793f FIR: Adjust test data 2020-10-28 11:43:25 +03:00
Denis Zharkov
b6a312483a FIR: Fix fir2symbol inconsistencies for imported properties
Do not copy delegateFieldSymbol because otherwise the old symbol will be rebound
to the new instance of a property
2020-10-28 11:43:25 +03:00
Denis Zharkov
09b7237ae5 FIR: Introduce importedFromObjectClassId 2020-10-28 11:43:25 +03:00
Denis Zharkov
4d9ef4d414 FIR: Get rid of CallableId::classId usages
Use dispatchReceiverType or containingClassAttr instead
2020-10-28 11:43:25 +03:00
Denis Zharkov
9996c983c9 FIR: Initialize dispatchReceiverType and containingClassAttr for callable members 2020-10-28 11:43:25 +03:00
Denis Zharkov
ecb89a66be FIR: Copy attributes when copying declaration
Otherwise they share FirDeclarationAttributes instance that might lead
to problems when modifying only one of them
2020-10-28 11:43:25 +03:00
Denis Zharkov
52c6aebec2 FIR: Use copy-builders at FirObjectImportedCallableScope 2020-10-28 11:43:25 +03:00
Denis Zharkov
995b1aa1eb FIR: Add FirCallableMemberDeclaration::dispatchReceiverType 2020-10-28 11:43:25 +03:00
Ilya Gorbunov
0fa2cc15de Cleanup more test files and directories after tests
#KT-19192
2020-10-28 07:36:22 +03:00
Ilya Gorbunov
fe098ec821 Revise functions in PathReadWrite
- Adjust implementations to avoid excessive vararg copies
- Remove options from forEachLine, it doesn't make much sense and
isn't consistent with the other read* functions.
- Revise inlineness of functions in PathReadWrite
- Compact implementations of those that are remained inline.
- Clarify docs of functions for reading the entire file

#KT-19192
2020-10-28 07:36:19 +03:00
Ilya Gorbunov
a43cc0d1f9 Implement additional Path extensions
#KT-19192
2020-10-28 07:36:16 +03:00
Ilya Gorbunov
038f1cbd1e Add glob filtering when listing directory entries
#KT-19192
2020-10-28 07:36:14 +03:00
Ilya Gorbunov
e7c888a2e6 Avoid introducing Path.printWriter
#KT-19192
2020-10-28 07:36:11 +03:00
Ilya Gorbunov
9f659d74df Introduce dedicated experimental annotation for Path extensions
#KT-19192
2020-10-28 07:36:08 +03:00
Ilya Gorbunov
997cd35e06 Move Path extensions to the new package kotlin.io.path
This avoids the conflict with the existing top-level functions in
kotlin.io package.

#KT-19192
2020-10-28 07:36:06 +03:00
Ilya Gorbunov
7d58a5e2f2 Simplify Path.copyTo implementation
Delegate most checks to the platform Files.copy.
This changes the exception type thrown in one case,
so document when it happens. Also 'copyTo' no longer
creates target parent directory if it doesn't exist.

#KT-19192
2020-10-28 07:36:02 +03:00
Ilya Gorbunov
f6d2400208 Workaround bugs in Path.relativize
Also add actual paths to the relativeTo error message.

#KT-19192
2020-10-28 07:36:00 +03:00
AJ
b3a87356bd Add java.nio.Path extensions to stdlib-jdk7: part 2
- Add notExists
- Rename isFile to isRegularFile
- Remove forEachBlock
- Rename listFiles
- Add relativeTo extensions
- Remove extra overloads
- Update doc comments
- Address review comments

#KT-19192
2020-10-28 07:35:57 +03:00
AJ
03cc0bf6aa Add java.nio.Path extensions to stdlib-jdk7
This PR adds most extensions on `java.io.File` in `kotlin.io` to `java.nio.Path`. This includes extensions from `FileReadWrite.kt`, `Utils.kt`, and `FileTreeWalk.kt`.

I attempted to keep the implementations, documentation, and tests as similar as possible to the existing implementations.

I am happy to add, remove, or move to separate PRs any of the functions of this PR.

### `File` extensions that were not added to `Path`

##### `createTempDir`, `createTempFile`

These functions have no `File` parameters, so can't be overloaded. Equivalents exist as `Files.createTempFile()` and `Files.createTempDirectory()`.

##### `startsWith`, `endsWith`, `normalize`, `resolve`, `resolveSibling`

These exist as member functions on `Path`

##### `relativeTo`, `relativeToOrNull`, `relativeToOrSelf`, `toRelativeString`, `toRelativeStringOrNull`

This functionality exists as the `Path.relativize` member function, which is equivalent to `relativeTo`, but with the receiver and parameter flipped. `foo.relativeTo(bar)` is equivalent to `bar.relativize(foo)`. We could potentially add a `relativizeOrNull` extension to make that pattern simpler.

##### `isRooted`

`Path` has a `root` method, so `isRooted` is equivalent to `root != null`

### New extensions

All of the simple boolean attribute checks from `java.nio.Files` were added as extensions on `Path`. These extensions are used commonly enough that it seems worth supporting them. This functionality for `File` is implemented as member methods.

The following `Path` extensions were added:

- `exists`
- `isDirectory`
- `isExecutable`
- `isFile`
- `isHidden`
- `isReadable`
- `isSameFile`
- `isSymbolicLink`
- `isWritable`

Some of these extensions take options that are forwarded to their `Files` method, so all of the extensions were implemented as functions rather than properties for consistency.

Additionally, `Path.listFiles` was added to match the `File.listFiles` method. One motivation for its addition was that it's used several times in the implementation of other file extensions. The way to list directory contents with `java.nio` is via `Files.newDirectoryStream()`, which returns an iterable object that must be closed to avoid leaking resources. It's difficult to use correctly with functions like `map` and `filter`, so this extension was added as a simpler, less error-prone alternative.

### Other changes

I added overloads of several of the read-write that take `OpenOptions` to expose the greater control that `java.nio` introduces. For example, you can use `printWriter(APPEND)` to create a `PrintWriter` that doesn't delete the contents of an existing file.

All the new extensions throw exceptions (such as `NoSuchFileException`) from `java.nio` rather than the copies from `kotlin.io`. The `kotlin.io` copies take `File` objects as parameters, and so aren't compatible with `Path`s.

### Address review comments

- Move varargs parameters to the last position
- Remove PathTreeWalk

#KT-19192
2020-10-28 07:35:54 +03:00
Yan Zhulanow
008da87160 Minor: Update Android Extensions deprecation message in relevant test 2020-10-28 00:43:20 +09:00
Yan Zhulanow
9faf91f55d Fix Parcelize settings serialization (KT-42958) 2020-10-28 00:43:20 +09:00
Yaroslav Chernyshev
3386b93009 [Gradle, Cocoapods] Added useLibraries() to allow static library pods
#KT-42531 fixed
2020-10-27 17:57:53 +03:00
Mikhael Bogdanov
21521aa397 Deprecate protected constructors call from public inline function
#KT-21177
2020-10-27 14:51:08 +01:00
Dmitry Gridin
a72cdeabb4 fix testData
^KT-40861
2020-10-27 18:58:48 +07:00
Ilya Goncharov
e6edb62911 [Gradle, JS] Fix for IDEA import with dukat binaries
^KT-42954 fixed
2020-10-27 14:21:34 +03:00
Mikhail Zarechenskiy
bb2e9e2d56 Extract new method from the publicly used interface for compatibility
Note that we can't just use ``@JvmDefault` annotation as the main change
 is in the `core` module which targets Java 6

 #KT-42259 Fixed
2020-10-27 14:14:39 +03:00
Alexander Dudinsky
0e7e657657 Migrate MultiModuleLineMarkerTest to the new CodeMetaInfo test infrastructure 2020-10-27 12:31:45 +03:00
Alexander Dudinsky
94bf38a7b5 Added support for various platforms for CodeMetaInfo tests. ^KT-41996
The tests need to be able to parse and render CodeMetaInfo for different
 platforms. For example, we must draw a run gutter a MAC application on
 OSX, but for a Win application, the gutter should not be drawn at the
 same time. This commit allows to do such checks. In order to indicate
 on which platform it should be rendered, it is necessary to specify the
 platform for a specific CodeMetaInfo in the test data in the format
 {OSX,Unix,Win}, if the block with platforms is missing, this means
 that it should be rendered on each platform.

<!LINE_MARKER{OSX}(...)!> - should only be on OSX
<!LINE_MARKER(...)!> - should be on any platform
2020-10-27 12:31:18 +03:00
Alexander Dudinsky
84d24e5b76 Migrate MultiplatformAnalysisTest to new test runner 2020-10-27 12:23:50 +03:00
Alexander Dudinsky
ac98bc9853 New highlighting/line markers/diagnostics test infrastructure
The current test framework has a number of shortcomings, such as
different markups for different kinds, those formats can not be
mixed in one test file, lacks composability, re-use of it is complicated
This commit contains the first version of the new test runner
to which tests will be migrated in the future.
2020-10-27 12:23:50 +03:00
Yan Zhulanow
994cb6f28e Update deprecation message for the Android Extensions plugin 2020-10-27 18:08:39 +09:00
Toshiaki Kameyama
5e9333773c Remove explicit type arguments: don't report when type argument has annotations
#KT-40985 Fixed
2020-10-27 15:44:44 +07:00
nataliya.valtman
e1a380ec95 KT-34862 use relative path for incremental build cache 2020-10-27 10:45:06 +03:00
Mikhail Glukhikh
09043fb98d [FIR] JvmMappedScope: add mutable methods or not depending on a class 2020-10-27 10:27:06 +03:00
Mikhail Glukhikh
5c3269f489 [FIR] JvmMappedScope: don't add Java methods if Kotlin ones are here 2020-10-27 10:26:55 +03:00
Toshiaki Kameyama
ce407471ec Convert to secondary constructor: suggest on class name
#KT-40861 Fixed
2020-10-27 14:05:28 +07:00
Ivan Gavrilovic
2c5c15f503 Clean-up outputs on non-incremental run
Always clean all outputs on non-incremental run of the
Kotlin compile task.
#KT-38692 Fixed
2020-10-27 09:44:06 +03:00
Abduqodiri Qurbonzoda
2fd7d64db0 Promote CancellationException to stable #KT-41837 2020-10-27 05:06:50 +03:00
Mikhail Glukhikh
caafe21e84 [FIR] Add CheckLowPriorityStage to callable reference resolve 2020-10-26 20:07:37 +03:00
Ilmir Usmanov
a775fa195b Unbox inline class parameter of lambda if underlying type is Any or Any?
The inline class is boxed when we pass it as lambda argument, now we
unbox it. If the underlying type is not Any or Any?, bridge method does
the unboxing.

 #KT-32450 Fixed
 #KT-39923 Fixed
 #KT-32228 Fixed
 #KT-40282 Fixed
2020-10-26 17:34:37 +01:00
Toshiaki Kameyama
752f6d8f72 Elvis -> if intention: don't introduce new variable when RHS type is Nothing 2020-10-26 20:57:16 +07:00
Toshiaki Kameyama
f9f8fd055b Convert receiver to parameter: place value argument list after type argument list
#KT-41499 Fixed
2020-10-26 20:47:35 +07:00
Dmitry Petrov
b1629cc5f4 JVM KT-22465 don't generate accessor to private setter in other class 2020-10-26 14:56:07 +03:00
Roman Artemev
4d63ecd83c [JS IR] Do not copy prototype references of FO from super class
Reduce bundle size from issue from 4.9M to 3.4M

 - fix KT-41227
 - add simple test
2020-10-26 14:30:54 +03:00
Matthew Gharrity
99a6bdeec7 Fix KotlinCoreEnvironment projectCount disposable
The disposable which decrements ourProjectCount was a non-capturing
lambda, meaning it had a single identity and could only be registered
in the Disposer tree once. Therefore the application environment
would never be disposed if ourProjectCount ever went above 1.
2020-10-26 12:23:10 +01:00
Mikhail Glukhikh
e9b51b42f9 [FIR] Add test for both KT-10240 and KT-19446 2020-10-26 14:09:36 +03:00
Alexander Udalov
382a0bd298 JVM IR: clear BindingContext after psi2ir
This helps to reduce peak memory in lowerings/codegen by a lot.

A more robust approach would be to have a separate BindingContext for
each file, and clear each of them after running psi2ir on it. This would
also lower peak memory usage in psi2ir.

Provide a fallback workaround compiler argument
-Xir-do-not-clear-binding-context just in case BindingContext is in fact
used somewhere and it's not caught by tests.
2020-10-26 10:34:43 +01:00
Alexander Udalov
bc76f1fec3 Refactor test utilties to reuse GenerationState construction 2020-10-26 10:34:43 +01:00
Alexander Udalov
dd813777b9 Refactor Main-Class computation in CLI for JVM with .jar outputs
Compute FQ name of the main class right after running the analysis and
before invoking codegen. This is needed because MainFunctionDetector
depends on BindingContext, and JVM IR needs to clear BindingContext as
soon as it's not necessary to reduce peak memory usage, thus breaking
any usages of data from it after the codegen.

Also refactor and use the extracted, but not properly reused previously,
copy of findMainClass in findMainClass.kt.

Note that this replaces NPE in KT-42868 with an UOE.
2020-10-26 10:34:43 +01:00
Vladimir Dolzhenko
0a18be62e5 Add prefix for inner test classes in ide perf tests to avoid metric name clashes 2020-10-25 22:49:30 +01:00
Alexander Udalov
08b8939b80 IR: make IrSymbol.isPublicApi an extension 2020-10-23 20:56:08 +02:00
Alexander Udalov
4bd08e5e0c IR: clear callToSubstitutedDescriptorMap for each file to avoid leaking memory
This map is populated during psi2ir and is only used in
insertImplicitCasts, after which it makes sense to clear it, otherwise
it strongly references a lot of descriptors for calls in other files
which would never be used.
2020-10-23 20:50:08 +02:00
Alexander Udalov
7ac981d4d3 Psi2ir: refactor ModuleGenerator.generateModuleFragment
Move `postprocess` into `generateSingleFile` and do those steps on each
file instead. This will allow to create
`GeneratorContext.callToSubstitutedDescriptorMap` for each file and
clear it after its only call site (InsertImplicitCasts) has used it.
Also simplify code a bit.
2020-10-23 20:50:08 +02:00
Victor Petukhov
7b53d668ab Fix test after 4f06162446 2020-10-23 18:33:23 +03:00
Yan Zhulanow
c07f25fa44 Revert "FoldInitializerAndIfToElvisInspection: don't add explicit type if var is used as non-nullable"
This reverts commit bb7d4c22
2020-10-24 00:22:41 +09:00
Yan Zhulanow
87574dddd9 Revert "ReplaceWith: suggest for "invoke" extension"
This reverts commit be194c34
2020-10-24 00:22:41 +09:00
Yan Zhulanow
04457e92d0 Revert ""Put/Join arguments/parameters" intention: don't suggest on nested argument list"
This reverts commit 4a328981
2020-10-24 00:22:41 +09:00
Yan Zhulanow
3321ce6325 Revert ""Code Cleanup": don't remove deprecated imports when file has @file:Suppress("DEPRECATION") annotation"
This reverts commit cf5a6274
2020-10-24 00:22:41 +09:00
Yan Zhulanow
839c30d04b Revert "Additional minor fixes for KT-33594: avoid using hard-coded annotation name, simplify hasAnnotationToSuppressDeprecation()"
This reverts commit 2a841550
2020-10-24 00:22:40 +09:00
Yan Zhulanow
9320637efe Revert "Redundant companion reference: do not report 'values/valueOf' function in enum"
This reverts commit 55d55446
2020-10-24 00:22:40 +09:00
Yan Zhulanow
383190f25e Revert "Replace with ordinary assignment: do not suggest when operator is augmented assignment operator function"
This reverts commit 73e319ca
2020-10-24 00:22:40 +09:00
Yan Zhulanow
7fccd0153b Revert "Refactoring: Remove hard-coded augmented assignment check with a Name check"
This reverts commit 016e78e4
2020-10-24 00:22:40 +09:00
Yan Zhulanow
0ae21a157f Revert ""Change to return with label" quick fix: apply for type mismatch"
This reverts commit f76e9886
2020-10-24 00:22:39 +09:00
Yan Zhulanow
601198634d Revert "Minor: Extract lambda return expression handling"
This reverts commit 55038e19
2020-10-24 00:22:39 +09:00
Yan Zhulanow
b18de1e3ff Revert "Provide quickfix for specifying type of variable initialized with null"
This reverts commit cdf7f46c
2020-10-24 00:22:39 +09:00
Yan Zhulanow
4327bc4ac3 Revert "KT-23394: Add a test with a property"
This reverts commit f2dc132d
2020-10-24 00:22:38 +09:00
Yan Zhulanow
fe64fcf8a3 Revert "Minor: update order in IntentionTestGenerated"
This reverts commit 6515d53b
2020-10-24 00:22:38 +09:00
Yan Zhulanow
c4a48598c0 Revert ""Add parameter to function" for TYPE_MISMATCH: fix it works correctly for extension function"
This reverts commit 03e725d5
2020-10-24 00:22:38 +09:00
Yan Zhulanow
16dbf7ba74 Revert "Convert to range check: don't report it if recursive call will be created"
This reverts commit 73184884
2020-10-24 00:22:38 +09:00
Yan Zhulanow
d735637f1e Revert "RemoveBracesIntention: add new line for long expression"
This reverts commit f4b9c477
2020-10-24 00:22:37 +09:00
Yan Zhulanow
f615ed2f26 Revert ""Use destructuring declaration": fix it works correctly if variable name is shadowed"
This reverts commit d61158a1
2020-10-24 00:22:37 +09:00
Yan Zhulanow
ab70cc35ea Revert "Add quick fix for 'JAVA_CLASS_ON_COMPANION'"
This reverts commit 15a615d6
2020-10-24 00:22:37 +09:00
Yan Zhulanow
6cc4d70b07 Revert "Minor: Remove hard-coded 'Companion' name"
This reverts commit 871ad2b9
2020-10-24 00:22:37 +09:00
Yan Zhulanow
19f518c037 Revert "IfThenToSafeAccessInspection: fix it works correctly for variable/operator call"
This reverts commit 5095caee
2020-10-24 00:22:36 +09:00
Yan Zhulanow
19896f9616 Revert "Minor: Use second pattern argument instead of explicit callee.text"
This reverts commit 55e36fa1
2020-10-24 00:22:36 +09:00
Yan Zhulanow
519f92599c Revert "Minor: Import DebuggerUtils"
This reverts commit 58f606e1
2020-10-24 00:22:36 +09:00
Igor Chevdar
9b2aa0951b [box-tests] Turned on tests on typeof for K/N 2020-10-23 18:27:10 +05:00
Igor Chevdar
9d1cb6a2c0 Turned off TypeOfChecker for K/N 2020-10-23 18:27:10 +05:00
Victor Petukhov
4f06162446 Get a callable reference expression to report an error on it properly, taking into account possible wrapping
^KT-42620 Fixed
2020-10-23 15:12:08 +03:00
Ilya Muradyan
cb020fb9f4 Change repository adding logic
Now if the repo being added already exists, it is moved to the
end of the list, effectively lowering its priority.

Original issue: https://github.com/Kotlin/kotlin-jupyter/issues/107
2020-10-23 13:31:38 +03:00
Ilya Goncharov
7062bf5737 [JS_IR] Additional check on loop label to not persist name for labeled loop
^KT-42262 fixed
2020-10-23 13:16:03 +03:00
Igor Chevdar
1a9e516dc0 [ir-plugin] Referenced binary operators with the new API 2020-10-23 14:58:33 +05:00
Igor Chevdar
23d12a717e [box-tests] Added a test 2020-10-23 14:22:48 +05:00
Igor Chevdar
27aed0ccbc [IR] Inliner: erase non-reified parameters for casts
Fixes https://youtrack.jetbrains.com/issue/KT-31072
2020-10-23 14:22:09 +05:00
Kristoffer Andersen
27fb46712a [JVM+IR] Unify new debugger tests expectations
This commit unifies the expectation format between the stepping and
LVT tests in the new debugging test harness.

Furthermore, it introduces a compression of runs of locations without
linenumbers. These default to showing as bytecode offsets from
previous line number, which overspecifies the tests: the bytecodes
chosen should not be constrained by a debugging step test.
2020-10-23 11:19:58 +02:00
pyos
e19ecdfb3d [Tests] Suspend Codegen Tests Improvements
This commit enables the execution of suspend box tests in a separate
test. It's a QoL improvement in the existing bb tests but, motivating
these changes, enables the new debugger stepping tests to step
coroutine code.
2020-10-23 11:19:58 +02:00
Kristoffer Andersen
3291f8455b [JVM+IR] Update straight-forward LVT tests 2020-10-23 11:19:58 +02:00
Kristoffer Andersen
2c9bf95227 [JVM+IR] New LVT debugging test harness improvements
This is the first step in a push to improve the test coverage of the
IR debugging experience. This commit improves on the sketch of local
variable table tests built on the new debugger stepping
infrastructure. As improvements on the existing
checkLocalVariableTableTest they:
 - don't overspecify codegen strategy: no hard requirements on slots.
 - test the observed lifespans of locals by stepping through code.

Ultimately this should enable us to bring over all existing tests for
improved coverage of both old and new JVM backends.

WIP list:
 - Gracefully handle absent LVT: treat as empty Add type of local and
 - type of value stored there to expectations Print values in local
 - slots if primitive or java.lang.String Enable specifying
 - expectations per backend Gracefully handle absent box methods
 - Gracefully handle null values in slots of reference type
 - Port a first LVT test
2020-10-23 11:19:58 +02:00
Ilya Goncharov
4479bf0933 [JS_IR] Enum constructor copy parameters with mapping by index
Previously mapping was by name, and there was clash in case of user
parameters named 'name' or 'ordinal'

^KT-39186 fixed
2020-10-23 11:42:43 +03:00
Vladimir Dolzhenko
2790bc1105 Split perf test json reports in a separate files/docs 2020-10-23 09:11:05 +02:00
Vladimir Dolzhenko
d7a783e077 Add prefix for inner test classes 2020-10-23 09:11:05 +02:00
Yan Zhulanow
58f606e1f5 Minor: Import DebuggerUtils 2020-10-23 15:46:54 +09:00
Yan Zhulanow
55e36fa1ab Minor: Use second pattern argument instead of explicit callee.text 2020-10-23 15:46:54 +09:00
Toshiaki Kameyama
5095caee50 IfThenToSafeAccessInspection: fix it works correctly for variable/operator call
#KT-30513 Fixed
#KT-17071 Fixed
2020-10-23 15:46:54 +09:00
Yan Zhulanow
871ad2b909 Minor: Remove hard-coded 'Companion' name 2020-10-23 15:46:53 +09:00
Toshiaki Kameyama
15a615d63b Add quick fix for 'JAVA_CLASS_ON_COMPANION'
#KT-29264 Fixed
2020-10-23 15:46:53 +09:00
Toshiaki Kameyama
d61158a176 "Use destructuring declaration": fix it works correctly if variable name is shadowed
#KT-30601 Fixed
#KT-20570 Fixed
2020-10-23 15:46:53 +09:00
Toshiaki Kameyama
f4b9c4777f RemoveBracesIntention: add new line for long expression
#KT-30523 Fixed
2020-10-23 15:46:52 +09:00
Toshiaki Kameyama
731848849e Convert to range check: don't report it if recursive call will be created
#KT-39182 Fixed
2020-10-23 15:46:52 +09:00
Toshiaki Kameyama
03e725d5da "Add parameter to function" for TYPE_MISMATCH: fix it works correctly for extension function
#KT-39557
2020-10-23 15:46:52 +09:00
Yan Zhulanow
6515d53b94 Minor: update order in IntentionTestGenerated 2020-10-23 15:46:52 +09:00
Yan Zhulanow
f2dc132d5d KT-23394: Add a test with a property 2020-10-23 15:46:51 +09:00
Toshiaki Kameyama
cdf7f46ce1 Provide quickfix for specifying type of variable initialized with null
#KT-23394 Fixed
2020-10-23 15:46:51 +09:00
Yan Zhulanow
55038e19ec Minor: Extract lambda return expression handling 2020-10-23 15:46:51 +09:00
Toshiaki Kameyama
f76e98868c "Change to return with label" quick fix: apply for type mismatch
#KT-32280 Fixed
2020-10-23 15:46:51 +09:00
Yan Zhulanow
016e78e483 Refactoring: Remove hard-coded augmented assignment check with a Name check 2020-10-23 15:46:50 +09:00
Toshiaki Kameyama
73e319ca7a Replace with ordinary assignment: do not suggest when operator is augmented assignment operator function
#KT-34715 Fixed
2020-10-23 15:46:50 +09:00
Toshiaki Kameyama
55d55446c8 Redundant companion reference: do not report 'values/valueOf' function in enum
#KT-34285 Fixed
2020-10-23 15:46:50 +09:00
Yan Zhulanow
2a841550d4 Additional minor fixes for KT-33594: avoid using hard-coded annotation name, simplify hasAnnotationToSuppressDeprecation() 2020-10-23 15:46:50 +09:00
Toshiaki Kameyama
cf5a6274e2 "Code Cleanup": don't remove deprecated imports when file has @file:Suppress("DEPRECATION") annotation
#KT-33594 Fixed
2020-10-23 15:46:49 +09:00
Toshiaki Kameyama
4a328981c6 "Put/Join arguments/parameters" intention: don't suggest on nested argument list
#KT-31020 Fixed
2020-10-23 15:46:49 +09:00
Toshiaki Kameyama
be194c3460 ReplaceWith: suggest for "invoke" extension
#KT-8597 Fixed
2020-10-23 15:46:49 +09:00
Toshiaki Kameyama
bb7d4c224f FoldInitializerAndIfToElvisInspection: don't add explicit type if var is used as non-nullable
#KT-38349 Fixed
2020-10-23 15:46:48 +09:00
Yan Zhulanow
3e632d074e Enable Parcelize IDE plugin in Android Studio 4.2 (KT-42859)
It turned out that all extensions related to the Parcelize IDE plugin are disabled in Android Studio 4.2. The missing inclusion seemingly happened because of a rebase mistake. This commit returns the missing inclusion back.
2020-10-23 15:46:48 +09:00
Mikhail Glukhikh
47a4bd1701 [FIR Java] Look into type arguments during dependent type parameter search 2020-10-23 08:12:17 +03:00
Mikhail Glukhikh
7f3d0af4f7 [FIR Java] Soften rules for matching types for may-be-special-builtins
This commit is workaround for cases like
MyJavaMap<KK : Bound, V> : java.util.Map<K, V>.
After signature changing and substitution we have
MyJavaMap.get(Object) declared and MyJavaMap.get(KK) from supertype,
which can't be otherwise matched as overriding one another.
2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
81529a835b Drop FirAbstractOverrideChecker.isEqualTypes 2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
abc2866902 [FIR] Fold flexible types after substitution if possible 2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
acb03cb28c [FIR2IR] Expand type during super qualifier search 2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
c50aa5f2ec [FIR TEST] Bad test data changes due to Java signature transformation
Both changes are related to getOrDefault. We should either make Java
version low priority or remove it at all.
2020-10-23 08:12:16 +03:00
Mikhail Glukhikh
d3e85dbce0 [FIR] Implement replacing Object with type parameters for specials builtins
#KT-42601 Fixed
2020-10-23 08:12:15 +03:00
Mikhail Glukhikh
d40248cb53 [FIR] Extract computeJvmDescriptorReplacingKotlinToJava 2020-10-23 08:12:15 +03:00
Mikhail Glukhikh
f866eff93e Extract special generic signatures to compiler.common.jvm to reuse in FIR 2020-10-23 08:12:15 +03:00
Mikhail Glukhikh
0e7acd6e8b [FIR Java] Add better type parameter erasure for override matching
Around KT-42601
2020-10-23 08:12:15 +03:00
Mikhail Glukhikh
17de486c23 [FIR Java] Drop nasty code providing type parameter erasure 2020-10-23 08:12:14 +03:00
Alexander Likhachev
999627952a [Gradle, K/N] Add proper assumptions for Mac only integration tests 2020-10-23 05:41:08 +03:00
Alexander Likhachev
ac7b7abcc0 [Gradle, JS] Fix K/JS project build with configuration cache (part 3)
Now configuration cache enabled builds with JS tasks does not fails but prints warning and skips execution on subsequent builds.
Relates to KT-42494
2020-10-23 05:41:07 +03:00
Igor Yakovlev
97d39c102a Fix BWC for Search utils 2020-10-22 19:32:18 +03:00
Andrei Klunnyi
71023cd596 [KT-40688] Inlay Hints: inlay hints are duplicated on code editing
Code editing changes inlay hints offset.
InlayModel.getAfterLineEndElementsInRange(int, int) call didn't return
previously existed hint by its "outdated" offset. From now on hints are
taken by logical line.
2020-10-22 18:22:51 +02:00
Georgy Bronnikov
b7a07fdf03 Review fix: unify irTemporary variants 2020-10-22 18:31:23 +03:00
Georgy Bronnikov
8e331c8afe IR: relax type cast for WrappedVariableDescriptor.containingDeclaration 2020-10-22 18:26:47 +03:00
Georgy Bronnikov
b588839752 EnumConstructorCall.fromSymbolDescriptor 2020-10-22 18:26:46 +03:00
Georgy Bronnikov
887dd10764 IR: remove descriptor usage 2020-10-22 18:26:46 +03:00
Georgy Bronnikov
e5cf7a1be7 Remove descriptor usage from Scope.kt 2020-10-22 18:26:46 +03:00
Leonid Startsev
8d999a2c13 Disable kx.ser plugin inside descriptors serialization in the IDE
Since IDE does not perform any serialization of descriptors, and
metadata written to the 'serializationDescriptorSerializer'
deleted only on call to DescriptorSerializer,
enabling this extension in the IDE effectively causes memory leaks.

 #KT-39624 Fixed

Pass SerializationDescriptorSerializerPlugin to other extensions directly

instead of using static val in companion.
2020-10-22 17:14:06 +03:00
Leonid Startsev
4ec90b18bc Rework DescriptorSerializerPlugin to be a part of Project's extensions
instead of statically registering it.

Static registering can cause subtle errors when plugin implementation
(e.g. SerializationDescriptorPluginForKotlinxSerialization) is registered
from multiple classloaders: in multi-module with daemon compilation scenario

 #KT-41857 Fixed
2020-10-22 17:04:35 +03:00
Mikhail Glukhikh
ef907e0c46 Fix FIR IDE test broken by Jinseong commit 2020-10-22 16:53:12 +03:00
Mikhail Glukhikh
ad12cc296b [FIR] Expand type before adding equality constraint 2020-10-22 15:38:30 +03:00
Alexander Gorshenev
7815529eed [Private fake overrides] Tests for private fake overrides construction 2020-10-22 13:23:29 +03:00
Alexander Gorshenev
294e7dd902 [Private fake overrides] Renamed FakeOverrideBuilder object to FakeOverrideBuilderForLowering 2020-10-22 13:23:29 +03:00
Alexander Gorshenev
81c06b24f7 [Private fake overrides] Private fake overrides linkage 2020-10-22 13:23:28 +03:00
Alexander Gorshenev
223d1dd5e6 [Private fake overrides] Private fake override construction 2020-10-22 13:23:28 +03:00
Alexander Gorshenev
c90556a883 [Private fake overrides] FakeOverrideDeclarationTable for private fake override construction 2020-10-22 13:23:28 +03:00
Alexander Gorshenev
623f9a54c6 [Private fake overrides] Tweak DeclarationTable to be open 2020-10-22 13:23:27 +03:00
Alexander Gorshenev
c7ea8b1ab6 [Private fake overrides] Prepare IdSignature for private fake override construction 2020-10-22 13:23:27 +03:00
Mikhail Glukhikh
91089f5f7a IrValidator: add more details to duplicate message for type parameter 2020-10-22 13:05:01 +03:00
Mikhail Glukhikh
44bb12480b [FIR2IR] Forbid private fake overrides in generator 2020-10-22 13:05:00 +03:00
Mikhail Glukhikh
3663bc6be3 FirClassSubstitutionScope: eliminate second constructor to simplify code 2020-10-22 13:05:00 +03:00
Mikhail Glukhikh
80f8b5b234 IrValidator: mention file in exception message 2020-10-22 13:05:00 +03:00
Mikhail Glukhikh
23e7468e57 [FIR2IR] Cache Java field-based properties more correctly #KT-42805 Fixed
Before this commit, we cached such IR properties by FIR property
which was created by Java field each time when we referenced it.
This led to signature clashes. Now we cache such IR properties
directly by associated FIR field.
2020-10-22 13:05:00 +03:00
Mikhail Glukhikh
3576cbf0d8 [FIR] Add test for KT-42805 2020-10-22 13:04:59 +03:00
Mikhail Glukhikh
f2c651ec9c [FIR2IR] Don't generate Any delegated members for data class
#KT-42771 Fixed
2020-10-22 13:04:59 +03:00
Mikhail Glukhikh
44459e8ac7 FIR mangler: fix alias-based type handling #KT-42770 Fixed 2020-10-22 13:04:58 +03:00
Victor Petukhov
6251568e17 Fix test after 84129098cb 2020-10-22 12:17:26 +03:00
Mikhail Glukhikh
289efd47b2 [FIR2IR] Cleanup code around implicit casts 2020-10-22 11:03:48 +03:00
Juan Chen
620a5d404d [FIR2IR] Keep redundant cast on 'this' for local anonymous function
#KT-42517 Fixed
2020-10-22 10:51:23 +03:00
Jinseong Jeon
f4531b0f34 FIR: set missed source in various FirElements
This could be caught by debuggability tests, such as stepping tests,
which are not enabled for FIR yet.
Instead, for now, full pipeline tests will raise index out-of-bound
errors due to the undefined offsets, which stem from null source.
2020-10-22 10:51:21 +03:00
Jinseong Jeon
46cc01602e FIR2IR: add implicit NOT_NULL cast if needed 2020-10-22 10:51:20 +03:00
Sergey Bogolepov
eeda48e63e Allow prefix and relative path in resolvable properties.
It allows us to move more logic to konan.properties from ClangArgs.
E.g., something like `-$absoluteTargetSysRoot/usr/include/c++/4.9.4`
2020-10-22 12:45:49 +07:00
Victor Petukhov
84129098cb Add equality constraints without subtyping
^KT-42195 Fixed
^KT-41741 Fixed
2020-10-21 21:23:13 +03:00
Dmitry Petrov
b1b87becc8 PSI2IR more JVM-like exhaustive when behavior KT-36840 2020-10-21 20:07:11 +03:00
Ilya Goncharov
7edeccbdc7 Move labeling into NameTables with labeling loops which contain escaped break
^KT-42262 fixed
2020-10-21 16:59:24 +03:00
Ilya Goncharov
400a15e3d6 Add lowering on switch in loop
^KT-42262 fixed
2020-10-21 16:59:24 +03:00
Ilya Goncharov
14d9aa1660 Add test on break in when without label
^KT-42262 fixed
2020-10-21 16:59:24 +03:00
pyos
a4b67f007f JVM_IR: treat suspend-converted references as lambdas for inlining
Again, this is consistent with adapted function references, since
they're pretty much the same anyway.
2020-10-21 15:21:01 +02:00
pyos
12bec7cca2 JVM_IR: when convering references to lambdas, bind the receiver
instead of storing it into a captured temporary.

This makes the resulting lambdas equivalend to adapted function
references produced by PSI2IR or FIR2IR.

 #KT-42492 Fixed
2020-10-21 15:21:01 +02:00
pyos
95fb597da0 PSI2IR / FIR2IR: bind FunctionN as receiver when suspend-converting
This is more consistent with adapted references & allows skipping a
temporary variable.
2020-10-21 15:21:01 +02:00
pyos
ccf921510d PSI2IR / FIR2IR: do not create temporaries for adapted references
Arguments to function references behave the same as arguments to
function calls and should be evaluated once regardless, so the temporary
is unnecessary.
2020-10-21 15:21:01 +02:00
Alexander Udalov
369056ca5d Minor, add explicit type argument to workaround KT-42175 2020-10-21 15:19:25 +02:00
Kirill Shmakov
29aaf70d21 Launch common tests on local JVM via run gutter
For projects with android target and without jvm one. #KT-42463
2020-10-21 15:40:13 +03:00
Jinseong Jeon
1c1e8f7beb FIR CFG: revise edge kind between local func node and fun enter node
so that local function enter node can be visited by FIR CFA

#KT-42814 Fixed
2020-10-21 14:01:31 +03:00
Pavel Punegov
ce8d983b2a Fix test after the fix for KT-17691 2020-10-21 13:58:53 +03:00
Dmitry Petrov
0b34526321 JVM_IR remove lambda hack required for odd JVM+OI behavior in KT-35849 2020-10-21 13:47:01 +03:00
Mads Ager
ad88c60fd8 [JVM_IR] Copy offsets from the original function to invokeSuspend.
Otherwise, implicit returns in void returning suspend functions
will not have the line number of the end brace.

Fixes KT-41962 and KT-40464.
2020-10-21 12:38:45 +02:00
Dmitriy Novozhilov
800bfe2cdb [TEST] Update testdata broken in c2d3a252 2020-10-21 12:49:45 +03:00
Dmitriy Novozhilov
c2d3a252a8 Mute very strange failing of FIR find usages test 2020-10-21 11:53:42 +03:00
Dmitriy Novozhilov
0484ab8cca Don't unwrap captured types in IDE descriptors renderers
#KT-42263 Fixed
2020-10-21 11:53:42 +03:00
Dmitriy Novozhilov
3068d79d2b [FIR-IDE] Add lock for status resolve 2020-10-21 11:53:11 +03:00
Dmitriy Novozhilov
6550bd09b1 [FIR] Ensure class resolve phase in status resolve 2020-10-21 11:53:10 +03:00
Dmitriy Novozhilov
699dd54be9 [FIR] Don't inherit some declaration modifiers (like tailrec) 2020-10-21 11:53:10 +03:00
Dmitriy Novozhilov
bf1a00c73a [FIR] Rework resolution of declaration statuses
There is introduced algorithm of resolution with jumps: before
  resolution of some class we resolve all status of members of its
  supertypes, so we can properly determine inherited visibility
  and modifiers
2020-10-21 11:53:10 +03:00
Mikhail Glukhikh
0b8116dff0 [FIR] Change some phase requirements: STATUS -> DECLARATIONS
NB: Also not quite sure this is better. IMO this shows more clearly that
we require results of declarations resolve and not some strange 'STATUS'
2020-10-21 11:53:10 +03:00
Mikhail Glukhikh
275260720d Add replacePhase in FirTypeResolveTransformer.transformEnumEntry 2020-10-21 11:53:10 +03:00
Mikhail Glukhikh
c171dafd91 FIR serializer: always normalize visibility
Without this commit we fail on package-private or so in serializer
2020-10-21 11:53:10 +03:00
Dmitriy Novozhilov
1ff5da5f41 [FIR] Add forgotten fake override type calculation 2020-10-21 11:53:10 +03:00
pyos
5c55f67923 JVM_IR: generate shorter names for classes in delegate initializers
#KT-41493 Fixed
2020-10-20 21:14:44 +02:00
LepilkinaElena
b786cf7559 [IR] Made signature nullable (#3860) 2020-10-20 21:13:40 +03:00
Alexander Udalov
6a9c72e77c IR: use one traversal instead of two for DeclarationContainerLoweringPass 2020-10-20 20:03:17 +02:00
Alexander Udalov
b5695188f9 IR: remove FunctionLoweringPass, refactor usages to FileLoweringPass
FunctionLoweringPass didn't add much value over FileLoweringPass, but
had a hidden footgun (like ClassLoweringPass) in that if your lowering
pass invoked a visitor/transformer on the function body and you forgot
to override visitFunction to stop visiting nested functions,
runOnFilePostfix would work with the complexity of the squared number of
nesting levels. It looks like this was happening with K/N's
DataClassOperatorsLowering (I haven't measured though).
2020-10-20 20:03:14 +02:00
Alexander Udalov
c110031935 IR: refactor DeclarationTransformer
Do not create extra DeclarationTransformer and FileLoweringPass
instances, instead inline all transformations to
DeclarationTransformer.lower.
2020-10-20 20:02:45 +02:00
Alexander Udalov
2be7afc7f9 IR: minor, give names to anonymous lowering visitors
To improve stacktraces and make the code a bit more readable.
2020-10-20 19:15:50 +02:00
Dmitry Petrov
3979cde738 Add box and PSI2IR tests for special cases listed in KT-35849 2020-10-20 19:31:40 +03:00
Ilya Goncharov
efee322830 [Gradle, JS] Update Dukat on 0.5.8-rc.3 2020-10-20 16:12:38 +03:00
Victor Turansky
4d4aabab8d [JS BE] Make properties configurable when implementing an interface by delegation
#KT-42364 Fixed
2020-10-20 15:49:29 +03:00
Sergey Bogolepov
2ad13847d1 [KT-40670] Allow to override konan.properties from CLI 2020-10-20 17:00:00 +07:00
Konstantin Tskhovrebov
ea34a588f3 Update KMM project wizard. 2020-10-20 12:03:17 +03:00
Dmitry Petrov
47c784f023 JVM_IR fix Java wildcard types translation
Types such as 'Collection<? extends CharSequence>' are treated as
'(kotlin.collections.MutableCollection<out kotlin.CharSequence!>
  ..kotlin.collections.Collection<kotlin.CharSequence!>?)'
by the front-end.
When generating generic signatures, JVM BE takes lower bound (which is
'kotlin.collections.MutableCollection<out kotlin.CharSequence!>').
Emulate this behavior in TypeTranslator.
2020-10-19 20:52:53 +03:00
zhelenskiy
19ed04e3fe Bad capitalization fixed 2020-10-19 16:16:56 +03:00
zhelenskiy
ba08cbbb20 Other typos fixed 2020-10-19 16:16:56 +03:00
zhelenskiy
6e0aa007da Typos fixed 2020-10-19 16:16:56 +03:00
Ilya Goncharov
0367dec035 [Gradle, JS] Dukat change default mode onto source
- Binary only for legacy

^KT-42339 fixed
2020-10-19 16:14:27 +03:00
Konstantin Tskhovrebov
0ce6d694b7 Fix tests for as42. 2020-10-19 15:58:38 +03:00
Alexander Udalov
48cd86b717 Add JVM target bytecode version 15
#KT-41916 Fixed
2020-10-19 14:47:21 +02:00
Ilmir Usmanov
819d64a2ef Box inline class returned from suspend lambda non-locally in JVM_IR
#KT-41194 Fixed
2020-10-19 14:28:39 +02:00
Ilmir Usmanov
70a4ed3ebc Box inline class returned from suspend lambda non-locally
All inline classes should be boxed coming in and out of lambdas,
however, if the inline class was returned non-locally, it was not boxed.
This change fixes the issue in Old JVM BE.
 #KT-41194 In progress
2020-10-19 14:28:36 +02:00
anastasiia.spaseeva
c1765a5306 Add changelog for 1.4.20-M2 2020-10-19 13:15:49 +03:00
Georgy Bronnikov
b70a173595 Formatting changes 2020-10-19 12:21:13 +03:00
Georgy Bronnikov
44893e09c1 IR: remove unneeded ObsoleteDescriptorBasedAPI uses from backend.common 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
a0a6a4b0f1 JVM_IR: make ObsoleteDescriptorBasedApi use explicit in all of backend.jvm 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
305da8ee10 IR: IrFunctionReference.fromSymbolDescriptor 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
14b3beefb3 IR: IrDelegatingConstructorCall.fromSymbolDescriptor 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
b28c85f5ea IR: IrCall.fromSymbolDescriptor 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
ab3ef3a7e9 IR: remove descriptor usage 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
065edac64b IR: remove unused functions 2020-10-19 12:21:12 +03:00
Georgy Bronnikov
726282c1ee IR: remove a descriptor usage 2020-10-19 12:21:11 +03:00
Dmitriy Dolovov
c69402c800 [Commonizer] Fix computing underlyingType and expandedType in CirTypeAlias 2020-10-19 11:21:53 +03:00
LepilkinaElena
cc4d93ac71 [IR] Eliminated expensive calculating of fqNames (#3815) 2020-10-16 21:07:04 +03:00
Ilya Kirillov
4f5b2b8e22 Uncomment accidentally commented code in debugger tests 2020-10-16 20:54:50 +03:00
Mads Ager
318d11dcec [JVM_IR] Remove muting of fwBackingField.
It has been rebased and is not using this .out file at all
for JVM_IR. So in terms of testing this is a noop.
2020-10-16 19:21:08 +03:00
Mads Ager
0505bd958a [JVM] Fix the nop removal optimization.
Never remove a nop if that would cause a line number to move
across a local lifetime boundary.

This fixes KT-42725.
2020-10-16 19:21:08 +03:00
pyos
69127445a3 JVM_IR: refine the condition for caching method nodes
Don't cache non-inline `suspend fun`s if there is no `$$forInline`;
do cache `invokeSuspend` if there *is* `invokeSuspend$$forInline`.
2020-10-16 18:05:04 +02:00
Alexander.Likhachev
d6e0d2a55b [Gradle, JS] Fix K/JS project build with configuration cache (part 2)
It is still does not support configuration cache but these changes allows build to pass with warnings
#KT-42494 Fixed
2020-10-16 16:15:05 +03:00
Roman Artemev
d7db643422 Add box test for KT-33992 2020-10-16 16:02:02 +03:00
Roman Artemev
023a62395a Add box test for KT-36897 2020-10-16 16:02:01 +03:00
Dmitriy Novozhilov
5e406e8803 [FIR-IDE] Unmute passing test 2020-10-16 15:24:58 +03:00
Dmitriy Novozhilov
9f5191f2a1 [FIR-IDE] Regenerate tests 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
8cb08139e1 [FIR-IDE] Add example flag for enabling fir ide to gradle.properties 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
0e47d32587 [FIR] Properly set type of constants for java declarations 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
5f641a2552 [FIR] Add wrapping scopes with forced calculator in checkers and fir2ir 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
e75f218f87 [FIR] Rename FirDeclarationOrigin.FakeOverride to SubstitutionOverride 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
739ebf772c [FIR] Add configuring FakeOverrideTypeCalculator into ConeKotlinType.scope 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
fc23cf76d4 [FIR] Force calculation of return type of fake overrides in return type calculator 2020-10-16 15:24:57 +03:00
Dmitriy Novozhilov
f9faa5be64 [FIR] Don't force calculation of return type in substitution scope 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
06981fc0af [FIR] Move functions for fake override creating to separate objects 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
1c2fdf7e3f [FIR] Remove scope session from FirClassSubstitutionScope constructor 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
9e863c90fc [FIR] Remove redundant default values for functions in FirClassSubstitutionScope 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
e07f63d26c [FIR] Move declaration attributes to declaration builders 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
0b51fd03e2 [FIR] Add failing test for incorrect type calculation of implicit types 2020-10-16 15:24:56 +03:00
Dmitriy Novozhilov
23f1cc6b07 [FIR] Get rid of ReturnTypeCalculator in ScopeSession 2020-10-16 15:24:55 +03:00
Dmitriy Novozhilov
fae1b70605 [FIR] Fix type of this reference in copy funciton of data class 2020-10-16 15:24:55 +03:00
Leonid Startsev
0616f948c7 Use actual form of decodeSerializableElement function in 'decodeSequentially'
code path in deserialize.

Old 3-argument form is deprecated and should be removed.
2020-10-16 15:24:12 +03:00
Ilya Kirillov
1bb2eefcaa Fix find usages test testdata adding FIR_COMPARISON directive 2020-10-16 14:54:16 +03:00
Ilya Goncharov
1bc52c195c [Gradle, JS] Uninternal _target in js extension 2020-10-16 14:51:35 +03:00
Alexander.Likhachev
0b6959ee3d [Gradle, K/N] Deprecate K/N compile classpath prop in favor of libraries 2020-10-16 13:48:07 +03:00
Alexander.Likhachev
f4da283ffb [Gradle, K/N] Move build cache tests into appropriate class 2020-10-16 13:48:07 +03:00
Alexander.Likhachev
a0f4898009 [Gradle, K/N] Make compile and link tasks cacheable
Currently build cache isn't supported for frameworks as symlinks in build output is used. Symlinks are transformed into regular files by Gradle build cache and that breaks incremental build. Cinterop process task is not cacheable at the moment as it depends on OS-environment
#KT-39564 Fixed
2020-10-16 13:48:07 +03:00
pyos
a9b53adc50 JVM_IR: make primitive == object slightly less lazy.
Discarding the value used to leave an unused-but-never-destroyed
temporary variable. It's best to not separate calls to `enterTemp`
and `leaveTemp`.

Not sure what kind of test to add though, since this is minor -- if the
result of the comparison is discarded, then the entire statement is more
or less pointless.

 #KT-42251 Fixed
2020-10-16 12:25:55 +02:00
Alexander Udalov
4c09906235 Build: add kotlin.build.useIRForLibraries to enable JVM IR for libraries separately
The next step for JVM IR adoption in our project is going to be enabling
`kotlin.build.useIR`, but keeping `kotlin.build.useIRForLibraries`
disabled until we fix all remaining ABI incompatibility issues for
library code.
2020-10-16 12:13:05 +02:00
Alexander Udalov
29d8730964 Build: when using JVM IR, produce stable binaries
This is needed to allow non-JVM-IR modules depend on the modules
compiled by JVM IR. This also allows us to enable JVM IR in our build by
default now, without introducing errors to all external usages of our
compiler and other artifacts that we publish.
2020-10-16 12:13:05 +02:00
Pavel Kirpichenkov
04a4f9cde6 Minor: cover negative cases with test +m
Add case without reported diagnostic on public companion.
Only report diagnostic if @JvmStatic annotation has source in code.

KT-25114
2020-10-16 11:11:59 +03:00
Pavel Kirpichenkov
9669ab1468 Report warning on @JvmStatic in private companion objects
Deprecation cycle to prohibit in 1.5.
^KT-25114 In Progress
2020-10-16 11:11:59 +03:00
Pavel Kirpichenkov
d769ca06ab Add test for KT-25114 2020-10-16 11:11:58 +03:00
Victor Petukhov
c6da2a1138 Reuse built functional types for postponed arguments by expected types and paths from a top level type variable
^KT-42221 Fixed
2020-10-16 10:46:22 +03:00
Dmitry Petrov
ee5edf4caa JVM_IR fix 'remove' in inline class implementing MutableCollection 2020-10-16 00:02:12 +03:00
Alexander Udalov
95edcea9a9 Build: fix kotlinx-metadata-jvm publication
Co-authored-by: Vyacheslav Gerasimov <vyacheslav.gerasimov@jetbrains.com>
2020-10-15 21:13:50 +02:00
Ilya Kirillov
8dd80fe3c9 Wizard: fix maven testdata 2020-10-15 21:47:42 +03:00
Ilya Kirillov
394245ba4c Wizard: do not run compose tests for Groovy dsl 2020-10-15 21:47:39 +03:00
Ilya Kirillov
ec1528e742 Wizard: use custom Kotlin version for compose project 2020-10-15 21:47:38 +03:00
Ilya Kirillov
b0bb03d761 Wizard: return junit back to android target 2020-10-15 21:47:36 +03:00
Ilya Kirillov
42914b4046 Wizard: add resolutionStrategy for mpp library template 2020-10-15 21:47:32 +03:00
Ilya Kirillov
f5d638eb8f Wizard: do not create empty local.properties file 2020-10-15 21:47:30 +03:00
Ilya Kirillov
aeff3c2682 Wizard: regenerate tests 2020-10-15 21:47:28 +03:00
Ilya Kirillov
b7017c233e Wizard: use different Kotlin version for compose templates 2020-10-15 21:47:25 +03:00
Ilya Kirillov
1cc007fcbf Wizard: introduce Compose MPP template 2020-10-15 21:47:23 +03:00
Ilya Kirillov
7422690ea1 Wizard: fix InvalidModuleDependencyError error message 2020-10-15 21:47:19 +03:00
Ilya Kirillov
2a5679e0c6 Wizard: make project templates list scrollable 2020-10-15 21:47:16 +03:00
Ilya Kirillov
db069c3264 Wizard: add compose desktop template 2020-10-15 21:47:08 +03:00
Ilya Kirillov
d547cb9ee6 Wizard: introduce mobile mpp module template & allow module templates for mpp modules 2020-10-15 21:47:04 +03:00
Ilya Kirillov
ac6b9e4aa0 Wizard: add android extensions plugin only by flag 2020-10-15 21:47:02 +03:00
Ilya Kirillov
ed924a1c99 Wizard: change custom maven repositories rendering 2020-10-15 21:47:00 +03:00
Ilya Kirillov
31dac65a39 Wizard: remove extra line break in build files 2020-10-15 21:46:57 +03:00
Ilya Kirillov
9948c265df Wizard: add setting to hide version & groupId in gradle 2020-10-15 21:46:56 +03:00
Ilya Kirillov
d3e99bd7a7 Wizard: simplify custom maven repository syntax for Gradle 2020-10-15 21:46:55 +03:00
Ilya Kirillov
3ef12e32ee Wizard: update libraries versions 2020-10-15 21:46:51 +03:00
Ilya Kirillov
fa8951c19e Wizard: move common repositories to the allprojects section 2020-10-15 21:46:49 +03:00
Ilya Kirillov
e824199169 Wizard: remove resolutionStrategy from settings.gradle 2020-10-15 21:46:48 +03:00
Ilya Kirillov
8b89eb5dc8 Wizard: clean activity_main.xml & AndroidManifest.xml files 2020-10-15 21:46:41 +03:00
Ilya Kirillov
733cd8891a Wizard: simplify android configuration 2020-10-15 21:46:40 +03:00
dependabot[bot]
4858b72a8d Bump junit from 4.11 to 4.13.1 in /libraries
Bumps [junit](https://github.com/junit-team/junit4) from 4.11 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.11.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.11...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:38:43 +02:00
dependabot[bot]
f69928d2b1 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:38:23 +02:00
dependabot[bot]
845d6ae063 Bump junit in /libraries/tools/kotlin-maven-plugin/src/it/simple
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:38:06 +02:00
dependabot[bot]
b778298486 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:37:56 +02:00
dependabot[bot]
f3c26af0c7 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:37:40 +02:00
dependabot[bot]
c2ed625f25 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:37:24 +02:00
dependabot[bot]
e9255c8f17 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:37:10 +02:00
dependabot[bot]
41123be3a2 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:36:55 +02:00
dependabot[bot]
3f27bb374a Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:36:41 +02:00
dependabot[bot]
fb7736377c Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:36:25 +02:00
dependabot[bot]
df202c9b3f Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:36:12 +02:00
dependabot[bot]
7fe9966e02 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:35:56 +02:00
dependabot[bot]
046ed1e08c Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:35:41 +02:00
dependabot[bot]
0396ed29cc Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:35:27 +02:00
dependabot[bot]
2a9e6df9b1 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:35:12 +02:00
dependabot[bot]
1bf2a6b013 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:34:54 +02:00
dependabot[bot]
797c02e1cb Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:34:39 +02:00
dependabot[bot]
916f9766ad Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:34:05 +02:00
dependabot[bot]
c012b16430 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:33:55 +02:00
dependabot[bot]
74ad4eb00e Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:33:35 +02:00
dependabot[bot]
e888f54ae8 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:33:14 +02:00
Alexander Udalov
0eea089cc1 Merge pull request #3821 from JetBrains/dependabot/maven/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld/junit-junit-4.13.1
Bump junit from 4.9 to 4.13.1 in /libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld
2020-10-15 20:33:06 +02:00
dependabot[bot]
209d5fd6c9 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 20:32:53 +02:00
Mikhael Bogdanov
c8e84f82eb Proper check NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT in new jvm-default modes
#KT-42699 Fixed
2020-10-15 16:26:00 +02:00
Mikhael Bogdanov
b6dc99b98e Skip java defaults in EXPLICIT_OVERRIDE_REQUIRED_IN_MIXED_MODE check
#KT-42674 Fixed
2020-10-15 16:26:00 +02:00
sebastian.sellmair
a60febbdfb KotlinMPPGradleProjectResolver: Ensure that artifactsMap is populated when Android plugin applied
#KT-42381 fixed
2020-10-15 13:23:21 +00:00
Victor Turansky
b42795a9ea Bump 'com.gradle.plugin-publish' from 0.11.0 to 0.12.0 (#3853) 2020-10-15 15:46:34 +03:00
Juan Chen
09acea5548 [FIR]: Set proper classId to enum entries
FirVisibilityChecker::isVisible checked if a private declaration can be
accessed at a use site by matching class ids of the private
declaration's owner with the use site's containing class
declarations. When the private declaration is defined in an enum
entry and used in the same entry, its owner class id has the enum
entry name, but the use site is in an FirAnonymousObject, which has
"anonymous" as the class id. This causes visibility check to fail.

This PR fixes owner class ids of declarations defined in enum entries
to be the same as normal anonymous objects.
2020-10-15 14:46:22 +03:00
Jinseong Jeon
ed188204b4 FIR checker: make property init analyzer path-sensitive
In particular, exception throwing path after finally block is
distinguished via path label.

KT-42350 Fixed
2020-10-15 14:22:39 +03:00
Jinseong Jeon
6fc3f7e776 FIR CFG: label edges from try-enter through finally block to exit target 2020-10-15 14:22:39 +03:00
Jinseong Jeon
43852ad7ab FIR CFG: add edges from try/catch to finally 2020-10-15 14:22:39 +03:00
Jinseong Jeon
ea2f773e54 FIR checker: reproduce KT-42350 2020-10-15 14:22:38 +03:00
Alexander Udalov
da69e3db7c kotlinx-metadata-jvm: report error on using metadata version < 1.4 in writers
The main reason for this change is that the current API for class
version requirements (`KmClass.versionRequirements`) makes it impossible
to support pre-1.4 metadata where this was stored incorrectly for nested
classes: with the "version requirement table" in the outer class, and
indexes into that table in nested classes. See KT-41011.

Other than this aspect, metadata of classes is basically the same in
pre-1.4 and 1.4, which means that if some kotlinx-metadata-jvm users
really need to serialize metadata of an earlier version and they don't
care about the version requirements issue, they can just use these new
bytes but write the earlier version (e.g. 1.1) to the class file.
Everything will work the same, except for the possible version
requirements issue mentioned above.

Note that metadata version 1.4 is still supported for
`KotlinModuleMetadata.Writer` though.

 #KT-41011 Fixed
2020-10-15 13:10:01 +02:00
Alexander Udalov
5d7d9beb0d kotlinx-metadata-jvm: remove bytecodeVersion from write methods
Bytecode version has never been used meaningfully in Kotlin, and will be
removed in a future release, so there's no point in using it. See
KT-41758.
2020-10-15 13:10:01 +02:00
Alexander Udalov
90d66b0ba5 kotlinx-metadata: reformat, cleanup, fix inspections 2020-10-15 13:10:01 +02:00
Roman Artemev
c89c31cd29 [KLIB] Fix package name (js -> common) 2020-10-15 13:55:06 +03:00
Roman Artemev
07a1124b99 [KLIB] Support error code in metadata 2020-10-15 13:55:06 +03:00
Roman Artemev
f4830c88b9 [JS IR] Make error code tests modular 2020-10-15 13:55:06 +03:00
Roman Artemev
0f7032051b [JS IR] Fix klib generation (proper order of flags) 2020-10-15 13:55:06 +03:00
Roman Artemev
a4945878aa [KLIB] Pass containsErrorCode flag from library/IC cache into deserializer
- Make deserializer track whether error node are allowed.
2020-10-15 13:55:05 +03:00
Roman Artemev
28c6d17ab4 [KLIB] Mark klib that contains error with special flag 2020-10-15 13:55:05 +03:00
Roman Artemev
98e5510871 [KLIB] Support IrError* nodes in serialization 2020-10-15 13:55:05 +03:00
Roman Artemev
934141f8af [KLIB] Support IrError* nodes in klib proto
- add proto messages
 - regenerate java-proto
 - support in reader to make code compiled
2020-10-15 13:55:05 +03:00
Roman Artemev
8ce497c7ef [IR] Add wrapped descriptor for error declaration 2020-10-15 13:55:05 +03:00
Mikhail Zarechenskiy
eacc94a89d Do not hide synthetic properties except isEmpty from Java
In order to hide synthetic property isEmpty from JDK 15, there was
 added additional logic in 5cc12b49fc but
 it also lead to the fact that now it's impossible to call synthetic
 property `declaringClass` on `Enum` as it's in the same list as method
 isEmpty(). Note that it's questionable behavior, probably we should
 also hide `declaringClass` as well but for now we turn it back to
 preserve compatibility

 #KT-42467 Fixed
2020-10-15 12:26:17 +03:00
Yaroslav Chernyshev
4227e2dc40 [Cocoapods] Fix task and directory naming to avoid subspecs collision
Logics of generating name for dependencies downloaded from git or url
admits producing tasks with forbidden symbols inside name for subspecs.
This fix introduces replacing of forbidden symbols for such purposes.

#KT-42550 Fixed
2020-10-15 09:59:33 +03:00
Jinseong Jeon
b8817d5884 FIR2IR: clean up dead code regarding overriding utils 2020-10-15 08:47:46 +03:00
Jinseong Jeon
5f64d6ec76 FIR2IR: add support for callable reference to Java field
#KT-42656 Fixed
2020-10-15 08:47:46 +03:00
Jinseong Jeon
65545a10c4 FIR: reproduce KT-42656 2020-10-15 08:47:46 +03:00
Derek Bodin
96834d6f4c Update example for default buildList to not use capacity KT-41136 (#3688) 2020-10-15 01:56:57 +03:00
Vladimir Dolzhenko
d9b3f91d73 Support hasError in ide perf tests vega charts 2020-10-15 00:09:48 +02:00
Vladimir Dolzhenko
051d914996 Align ide perf tests vega charts with json reports camelCase propNames
fix handling test errors
2020-10-14 21:31:03 +02:00
Ilya Kirillov
98efdaa523 FIR IDE: fix KtTypeRendererTest 2020-10-14 22:11:12 +03:00
Ilya Kirillov
5cda4b5ab3 fix test generator compilation 2020-10-14 22:11:12 +03:00
Ilya Kirillov
29151665e1 FIR IDE: add fir ide plugin tests task 2020-10-14 22:11:11 +03:00
Ilya Kirillov
bd68b937e5 FIR: ignore testdata directory in testPsiConsistency test 2020-10-14 22:11:10 +03:00
Ilya Kirillov
5c798d4e13 FIR IDE: fix test data in fir-ide module 2020-10-14 22:11:10 +03:00
Ilya Kirillov
6086b54a06 FIR IDE: do preliminary highlighting in completion tests considering exceptions 2020-10-14 22:11:09 +03:00
Ilya Kirillov
b9cf9d8bc5 FIR IDE: add missing test dependency 2020-10-14 22:11:09 +03:00
Ilya Kirillov
2f093e76b0 FIR IDE: render resolve phase for lazy resolve tests 2020-10-14 22:11:08 +03:00
Ilya Kirillov
9c53c66bb5 FIR IDE: actualize testdata for idea-frontend-fir module 2020-10-14 22:11:08 +03:00
Ilya Kirillov
a585d20639 FIR IDE: fix bodies calculator for property acessors 2020-10-14 22:11:07 +03:00
Ilya Kirillov
ab4faa52f0 FIR IDE: add missing IdeSessionComponents for FirIdeBuiltinsAndCloneableSession 2020-10-14 22:11:06 +03:00
Ilya Kirillov
a22514cf8e FIR IDE: separate lazy phase into 3 phases, add contracts phase 2020-10-14 22:11:06 +03:00
Ilya Kirillov
c418140bef FIR IDE: fix test dependencies 2020-10-14 22:11:05 +03:00
Ilya Kirillov
dc467f7d6c FIR: add test which checks that we do not access lazy bodies & lazy expressions till contract phase 2020-10-14 22:11:04 +03:00
Ilya Kirillov
7611135a4a FIR: add raw fir building delegate expression test 2020-10-14 22:11:04 +03:00
Ilya Kirillov
971e551bae FIR IDE: implement lazy delegate initializers 2020-10-14 22:11:00 +03:00
Ilya Kirillov
3f9735dd5d FIR: use enum in RawFirBuilder to indicate its mode: normals, stubs, or lazy bodies 2020-10-14 22:11:00 +03:00
Ilya Kirillov
81d4371685 FIR IDE: generate lazy initializers for properties 2020-10-14 22:10:59 +03:00
Ilya Kirillov
7c1170722f FIR: add FirLazyExpression node 2020-10-14 22:10:58 +03:00
Ilya Kirillov
71b5b6df7c FIR IDE: add tests for lazy resolving single declaration in file 2020-10-14 22:10:58 +03:00
Ilya Kirillov
f4199a0729 FIR: add ability to render declaration phase in FirRenderer 2020-10-14 22:10:57 +03:00
Ilya Kirillov
bbf450703f FIR: introduce stub bodies raw fir test case 2020-10-14 22:10:56 +03:00
Ilya Kirillov
d2d330c3be FIR IDE: implement lazy functions, constructors & accessors bodies building for raw fir
test
2020-10-14 22:10:56 +03:00
Ilya Kirillov
4fae9cbdb0 FIR: introduce FirLazyBlock node 2020-10-14 22:10:55 +03:00
Ilya Kirillov
864800902b FIR IDE: introduce WeakFirByPsiRef 2020-10-14 22:10:55 +03:00
Mads Ager
17748b4499 [JVM_IR] Fix off-by-one line number error in CoroutineCodegen.
Fixes KT-41957.
2020-10-14 20:57:42 +02:00
pyos
13def12731 IR: remove unnecessary calls to deepCopyWithSymbols
to make it harder to hide incorrect uses.
2020-10-14 20:25:20 +02:00
Alexander Udalov
45a0850d95 Fix KotlinType.isNullabilityFlexible for types based on type parameters
In the compiler, this function was used in psi2ir (and it affected
nullability annotations in the resulting JVM class files), in "useless
elvis with null on the right side" diagnostic checker, and in light
classes.

 #KT-42650 Fixed
2020-10-14 19:32:51 +02:00
Alexander Udalov
fbf56c054b JVM IR: fix names of $annotations methods for internal properties
#KT-40384 Fixed
2020-10-14 19:32:51 +02:00
Alexander Udalov
3f73be391f JVM IR: fix names of $annotations methods with inline classes in signature
#KT-40385 Fixed
2020-10-14 19:31:58 +02:00
Alexander Udalov
1df3bafbaf Minor, fix and unmute fieldNameClash.kt test
#KT-31927
2020-10-14 16:53:58 +02:00
Alexander.Likhachev
ec877843fc [Gradle, K/N] Increase Xmx for MPP tests with native 2020-10-14 17:13:32 +03:00
Mikhail Glukhikh
babc7845af FirSyntheticPropertiesScope: support case with derived getter
#KT-42496 Fixed
2020-10-14 16:33:44 +03:00
Mikhail Glukhikh
2f9b7495fc [FIR2IR] Make safe call result always nullable 2020-10-14 16:33:37 +03:00
Dmitry Petrov
d623f4d1d6 Add test for KT-40190 2020-10-14 16:05:15 +03:00
Alexander.Likhachev
d3f98923dc [Gradle, JS] Fix K/JS project build with configuration cache enabled
KT-42494 Fixed
2020-10-14 15:10:34 +03:00
Alexander.Likhachev
82a66bc659 [Gradle, K/N] Remove wasm from VariantAwareDependenciesIT 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
e505c6473d [Gradle, K/N] Remove check for export API from libraries producing test 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
72ad581fe4 [Gradle, K/N] Change prefix of apple-specific tests to native-*
The commit does nothing but renaming of directories
2020-10-14 15:10:34 +03:00
Alexander.Likhachev
3ab99c1f96 [Gradle, K/N] Reduce number of targets in MPP tests 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
3dda02459d [Gradle, K/N] Add more cases for cinterop test 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
be7cc32c10 [Gradle, K/N] Add export API test for frameworks 2020-10-14 15:10:34 +03:00
Alexander.Likhachev
7c2339bcad [Gradle, K/N] Move compiler version change to separate test 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
f0aa4a59e3 [Gradle, K/N] Tests cleanup 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
4b68678a36 [Gradle, K/N] Add release binaries to generate binaries tests 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
08ee702d19 Update Kotlin/Native: 1.4.30-dev-16766 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
5dd1e75793 [Gradle, K/N] Configure memory properties for tests in single place 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
780b85e3ec [Gradle, K/N] Simplify testNativeTests test by reducing number of targets 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
882f442848 [Gradle, K/N] Simplify native cinterop test 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
7523b401c3 [Gradle, K/N] Remove wasm32 from mpp tests compile tasks 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
79ba6df7b8 [Gradle, K/N] Remove "kotlinx.html" maven repository from tests 2020-10-14 15:10:33 +03:00
Alexander.Likhachev
03ee0f60ea [Gradle, K/N] Add workaround for iOS simulator warning report check 2020-10-14 15:10:32 +03:00
Alexander.Likhachev
00cbfa9eb4 [Gradle, K/N] Simplify native binaries DSL test 2020-10-14 15:10:32 +03:00
Alexander.Likhachev
4f8503dc30 [Gradle, K/N] Reduce number of targets in tests 2020-10-14 15:10:32 +03:00
Alexander.Likhachev
8aa9ef5049 [Gradle, K/N] Enable compiler daemon in tests 2020-10-14 15:10:32 +03:00
Alexander.Likhachev
923e7f7de5 [Gradle, K/N] Create new framework producing test 2020-10-14 15:10:32 +03:00
Ilya Matveev
76e03842ae [Gradle, K/N] Refactor native-specific Gradle tests 2020-10-14 15:10:32 +03:00
Ilya Matveev
71fe60f4a2 [Gradle, K/N] Rename native native-specific test projects
Some native-specific tests was moved from NewMultiplatformIT
but test projects used by them still have the "new-mpp" prefix.
This patch replaces this prefix with "native".
2020-10-14 15:10:32 +03:00
Ilya Matveev
174e390d2c [Gradle, K/N] Add separate tasks for native-specific Gradle tests
Native-specific tests are removed from default test tasks.
2020-10-14 15:10:32 +03:00
Ilya Matveev
d971817c32 [Gradle, K/N] Move native-specific tests to a separate class from MPP
This patch just copies the tests without any refactoring.
2020-10-14 15:10:31 +03:00
Jinseong Jeon
4d28463f1a FIR CLI: initialize module and dependencies
#KT-42624 Fixed
2020-10-14 14:56:37 +03:00
Yaroslav Chernyshev
01ba1cded7 [Cocoapods] Minor. Fix CocoaPodsIT, test data update 2020-10-14 12:21:58 +03:00
Alexander Dudinsky
36dd883768 Update testData of testKt28385 for 202 version 2020-10-14 12:15:07 +03:00
Roman Artemev
9ef7273641 Unmute stdlib tests after bootstrap advance. 2020-10-14 12:06:02 +03:00
Dmitriy Dolovov
3d8b614778 [Commonizer] Allow debugging through "runCommonizer" Gradle task 2020-10-14 09:33:12 +03:00
Dmitriy Dolovov
f49f5cb3d5 [Commonizer] Fix classpath for "runCommonizer" Gradle task 2020-10-14 09:33:06 +03:00
Ilya Kirillov
f27bf04911 Perf test: remove info markers in testdata before test 2020-10-14 02:04:10 +03:00
Pavel Punegov
4b3455dfa1 Set backend for the test 2020-10-13 22:02:16 +03:00
nataliya.valtman
58ed1bbb64 Can't use configure action from Immutable state
#KT-42413 Fixed
2020-10-13 21:02:00 +03:00
Dmitriy Novozhilov
9147aa76b5 Advance bootstrap to 1.4.30-dev-1423 2020-10-13 20:50:10 +03:00
Dmitry Petrov
052f345a17 JVM_IR no generic signatures for abstract stubs KT-42609 2020-10-13 19:20:29 +03:00
Dmitry Petrov
c8bf74c7d5 Bytecode listing test fails if JVM and JVM_IR have same testData 2020-10-13 19:20:29 +03:00
Nikolay Krasko
51e2b9d33d Enable signing using gpg in KotlinBuildPublishingPlugin (KTI-355)
Add skip for generated Sign task because otherwise added
 signatory is forcing task activation.

```Execution failed for task ':kotlin-allopen:signMainPublication'.
org.gradle.api.InvalidUserDataException: Cannot perform signing task
':kotlin-allopen:signMainPublication' because it has no configured
signatory```

 #KTI-355 Fixed
2020-10-13 18:29:32 +03:00
Alexander Udalov
1b39a235d8 JVM IR: sort multifile part names in metadata 2020-10-13 16:40:53 +02:00
Alexander Udalov
b257b03152 JVM IR: do not generate JvmName on multifile parts
#KT-36970 Fixed
2020-10-13 16:40:52 +02:00
Alexander Udalov
0eccb9661f JVM IR: simplify staticDefaultFunctionPhase
Also fix quadratic complexity similar to the previous commit.
2020-10-13 16:11:17 +02:00
Alexander Udalov
1859d4d340 JVM IR: avoid quadratic complexity in InheritedDefaultMethodsOnClassesLowering
Visiting all children and not stopping on classes made
`ClassLoweringPass.runOnFilePostfix` perform with the complexity of the
square of the amount of class nesting levels.
2020-10-13 16:11:17 +02:00
Vladimir Dolzhenko
5ca4c2ce1a Use camelCase propNames in ide perf tests json stats; report hasError 2020-10-13 15:17:45 +02:00
Jinseong Jeon
bc6693fa6e FIR2IR: element-wise SAM conversion for vararg 2020-10-13 15:40:06 +03:00
Nikolay Krasko
5d394528f6 Fix double publication of javadoc in kotlin-osgi-bundle (KTI-356)
There's a common place with generating empty javadoc:
635ffcd53b/libraries/pom.xml (L187)

 #KTI-356 Fixed
2020-10-13 15:16:14 +03:00
Dmitry Savvinov
e06ae01c0c Restore nullability after type refinement along with annotations
See the issue for details

^KT-42546 Fixed
2020-10-13 13:48:43 +03:00
Ilya Kirillov
ee794f8664 FIR IDE: add check canceled between diagnostics 2020-10-13 12:03:06 +03:00
Pavel Kirpichenkov
9dd3d8fb14 [NI] Fix extension function check after commonization
`isExtensionFunction` property is false for suspend functions
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
c53011dd04 [FIR] mute builder inference test
^KT-42591 Open
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
39a87435ee [FIR/NI] Refactor type variable gathering from lambda types
Motivation:
- drop getArguments from type context as a duplicate of getArgumentList
- reduce the number of collection allocations in getAllDeeplyRelatedTypeVariables

Additional minor improvements, test data fixes
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
ef44077cb7 [FIR] Restore variable fixation direction in call completion
Several tests are affected by the usage of fixation direction calculator in FIR.
Restored to mimimize test data changes.

It is unnecessary in FE10 because a type variable with unknown type
is inferred into an error type, but affects test data in FIR where
Nothing/Any is selected by direction (as a temporary measure).

CR candidate in spec test is Unresolved in FIR because top-level CRs are resolved as call arguments.
Resolution ambiguity is also present in FE10 when CR is wrapped into an id call.
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
712a2ce1ab [FIR] Improved lambda completion: initial implementation
Repeat the logic of KotlinConstraintSystemCompleter in ConstraintSystemCompleter.
Implement additional context operations required for updated lambda completion algorithm.
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov
5eae6f2f4e [FIR] Move PostponedArgumentInputTypesResolver to resolution.common 2020-10-13 11:00:20 +03:00
Pavel Kirpichenkov
3822a32fce [FIR] Prepare commonization of PostponedArgumentInputTypesResolver 2020-10-13 11:00:20 +03:00
Victor Petukhov
0685beb765 NI: do substitution type variables during updating trace for lambda (these type variables can appear after the builder inference)
^KT-42450 Fixed
2020-10-13 10:21:55 +03:00
dependabot[bot]
1ca5bef7e6 Bump junit
Bumps [junit](https://github.com/junit-team/junit4) from 4.9 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.9...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-12 22:18:57 +00:00
Alexander Udalov
e399b4cd12 JVM IR: minor, sort ElementType fields as in the old backend
In the old backend, targets are generated in the order of their
declaration in the ElementType enum, see AnnotationCodegen.java:306
(EnumSet guarantees such iteration ordering).

This has no effect other than reducing non-essential differences when
comparing ABI of JVM vs JVM_IR.
2020-10-12 21:38:09 +02:00
Alexander Udalov
1daeebcdd3 Minor, add regression test
#KT-42562
2020-10-12 21:37:37 +02:00
pyos
2ff011af17 JVM_IR: add an assertion and a comment about property references
I once again forgot why we don't cache property reference classes and
had to refer to the internal chat.
2020-10-12 21:14:00 +02:00
pyos
1663619606 JVM_IR: add local delegated property metadata to non-synthetic classes
Otherwise kotlin-reflect won't find it (and it won't even be serialized
anyway).

 #KT-42562 Fixed
2020-10-12 21:14:00 +02:00
pyos
2974004de4 JVM_IR: make PropertyReferenceLowering less quadratic
ClassLoweringPass creates a visitor and calls lower() on each class,
which then creates another visitor that does not override `visitClass`
to ignore the nested classes. This is generally not a good idea.
2020-10-12 21:14:00 +02:00
Ilmir Usmanov
d7b9920eba Treat field initializer as class initializer
when checking for allowance of other field initialization in lambda
with EXACTLY_ONCE contract.
 #KT-40948 Fixed
2020-10-12 20:16:21 +02:00
Ilmir Usmanov
3b5706972e Extract effect from lambda argument if it is in parentheses
Otherwise, contracts on the parameter have no effect.
 #KT-42044 Fixed
 #KT-26229 Fixed
2020-10-12 20:16:19 +02:00
Dmitry Petrov
df64bb3eb7 JVM_IR emulate JVM hack for generic signatures in KT-18189
KT-40307

See also KT-42609
2020-10-12 21:14:48 +03:00
Steven Schäfer
f20a695c0e Minor: Rebase testGenericConstructorCallWithTypeArguments 2020-10-12 17:34:34 +02:00
Victor Petukhov
c89461e654 JSpecify: add gradle task to download JSpecify test suite 2020-10-12 17:33:35 +03:00
Victor Petukhov
d0cd7a4008 JSpecify: exclude test running from the common test task 2020-10-12 17:33:35 +03:00
Victor Petukhov
9dab052266 JSpecify: implement tests generator and test runner with checking compliance of kotlin diagnostics and jspecify marks 2020-10-12 17:33:35 +03:00
Victor Petukhov
f39e2d4a2d JSpecify: convert java use sites for existing tests to kotlin ones 2020-10-12 17:24:35 +03:00
Victor Petukhov
ce44f7d4d3 JSpecify: implement kotlin use sites to java ones converter 2020-10-12 17:24:31 +03:00
Victor Petukhov
520e35baaf JSpecify: rework tests – replace kotlin use sites to java ones with future j2k conversion 2020-10-12 17:24:29 +03:00
Victor Petukhov
8974128be4 JSpecify: remove annotations unsupported yet 2020-10-12 17:24:27 +03:00
Victor Petukhov
fb8bba4dfb Include kotlin reflect test runtime dependency for tests-java8 module to make jps tests running work 2020-10-12 17:24:26 +03:00
Vladimir Dolzhenko
677f5ca4e3 Don't keep ref to ABSENT_KOTLIN_INJECTION in companion object
As it prevents from dynamic reloading of plugin

^KT-39958 Fixed
2020-10-12 13:09:18 +00:00
Vladimir Dolzhenko
7c2112d014 Prepare for KT dynamic plugin: make EP dynamic
Relates to ^KT-38518
2020-10-12 13:09:17 +00:00
Vladimir Dolzhenko
0e7e24c498 Add more diagnostics to address invalid module
Relates to ^KT-42274
2020-10-12 13:03:22 +00:00
Roman Artemev
fa7104213c Temporary disable test until bootstrap is updated 2020-10-12 15:22:44 +03:00
Roman Artemev
f824bb6987 [JS BE] Merge Legacy and IR BE exceptions-related test data
- regenerate tests
 - add consistency test
2020-10-12 15:22:44 +03:00
Roman Artemev
c16b11a124 [JS IR BE] Fix throwable stuff to make exceptions similar to JVM 2020-10-12 15:22:43 +03:00
Roman Artemev
ff093d363a [JS IR BE] Fix Throwable ancestor transformation
Make sure that `message` and `cause` are properly configured

 - synchronize IR BE and Legacy behaviour
 - fix corresponding IR lowering
 - fix JS IR core runtime
 - add test
 - fix KT-39964
2020-10-12 15:22:43 +03:00
Roman Artemev
383146f836 [JS IR BE] Add compiler instrinsic to express undefined value in BE 2020-10-12 15:22:43 +03:00
Dmitriy Novozhilov
f794ced888 [FIR] Fix incorrect cluster creating in CFG dumps 2020-10-12 11:55:05 +03:00
Dmitriy Dolovov
3495ec198d Minor. Small clean-up in KLIB decompiler 2020-10-12 10:24:18 +03:00
Vladimir Dolzhenko
3eeaa07e0c Sync up plugin.xml AS42 with 202
Relates to #KT-42274
2020-10-12 06:49:43 +00:00
Mads Ager
f941733f13 [JVM_IR] Rebase init blocks stepping test that is working as intended. 2020-10-12 08:36:17 +02:00
Vladimir Dolzhenko
a9bc63dece Drop redundant legacy_name from ide perf tests json stats 2020-10-10 23:57:39 +02:00
Alexander Udalov
a4fb2a445f Minor, add spaces to diagnostic message 2020-10-09 22:11:37 +02:00
Alexander Udalov
ac39e4d89c Minor, add regression test
#KT-42554
2020-10-09 22:11:37 +02:00
pyos
6f9f437f15 IR: refuse to copy classes in InitializersLowering 2020-10-09 22:11:00 +02:00
pyos
e6c0575d3a JVM_IR: do not deep-copy suspend lambdas in initializers
This loses reflection metadata (and also sometimes fails). Which was
missing anyway - this is also fixed now.

 #KT-42554 Fixed
2020-10-09 22:11:00 +02:00
Mark Punzalan
8bc7370b92 ForLoopsLowering: Add PLUSEQ origin to increment to use IINC
instructions if possible.
2020-10-09 21:34:56 +02:00
Mark Punzalan
14137cb013 ForLoopsLowering: Remove additionalNotEmptyCondition as it is no
longer used in UntilHandler.
2020-10-09 21:34:56 +02:00
Mark Punzalan
ccbf7cc2ee ForLoopsLowering: Use last-exclusive for-loops for optimized until
progressions instead of decrementing "last".

#KT-41352 Fixed
2020-10-09 21:34:56 +02:00
Mark Punzalan
1adb130509 ForLoopsLowering: Move isLastInclusive to HeaderInfo. 2020-10-09 21:34:56 +02:00
Mark Punzalan
a093efde11 Add blackbox test for KT-42533. 2020-10-09 21:34:56 +02:00
Ilmir Usmanov
375d92cf67 Merge two consequent records in LVT
Otherwise, atomicfu will be unable to transform atomic variable usages.
2020-10-09 18:36:37 +02:00
Dmitry Petrov
91b8e32d43 Add ABI tests for classes extending Number and CharSequence 2020-10-09 16:36:35 +03:00
Dmitry Petrov
6dd2d8bbdb JVM_IR drop 'SpecialMethodWithDefaultInfo#needsArgumentBoxing' 2020-10-09 16:06:09 +03:00
Dmitry Petrov
a412596d8e JVM_IR emulate old back-end behavior in special bridges + inline classes
KT-42491 KT-42539
2020-10-09 16:06:08 +03:00
Dmitry Petrov
92fa13cbab Workaround for a possible compiler bug in object literals 2020-10-09 16:06:08 +03:00
Dmitry Gridin
23beaa5883 [formatter] add tests for line indent after properties
^KT-42560
2020-10-09 20:03:48 +07:00
Dmitry Gridin
434139d986 Revert "Add indent before accessor for extension property (KT-33131)"
This reverts commit ab34f8c7

^KT-42560 Fixed
2020-10-09 19:44:50 +07:00
Ilya Kirillov
852d705c71 FIR: optimize converting string expressions in raw FIR builder
Do get ASTNode for every string template entry as it is expensive operation
2020-10-09 15:00:56 +03:00
Ilya Kirillov
5937ffae4d FIR: optimize checking if placeholder projection for raw FIR builder 2020-10-09 15:00:55 +03:00
Ilya Kirillov
bbc641b390 FIR: do not get statement text for every statement in raw FIR builder
PsiElement.getText This is rather expensive operation
2020-10-09 15:00:55 +03:00
Ilya Goncharov
b1768d805f [Gradle, JS] Rename dukatMode to externalsOutputFormat
^KT-42339 fixed
2020-10-09 13:58:34 +03:00
Ilya Goncharov
3ad6d58153 [Gradle, JS] Execute dukat on import in both mode
^KT-42339 fixed

[Gradle, JS] Fix tests for dukat

^KT-42339 fixed

[Gradle, JS] Add tests on binaries-both mode

^KT-42339 fixed

[Gradle, JS] Remove snapshot versions

^KT-42339 fixed

[Gradle, JS] Fix file dependency resolution into imported package

^KT-42339 fixed
2020-10-09 13:58:34 +03:00
Ilya Goncharov
0a86beeb64 [Gradle, JS] Add descriptors to dependencies in configurations phase
- Add file collection dependencies to gradle node module building

^KT-42339 fixed
2020-10-09 13:58:34 +03:00
Ilya Goncharov
af65365d6a [Gradle, JS] Move gradle post processing after executing of dukat
^KT-42339 fixed

[Gradle, JS] Use 2 integrated tasks for dukat in both mode

^KT-42339 fixed

[Gradle, JS] Dukat into jar

^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Ilya Goncharov
4eea52e4e7 [Gradle, JS] Add TaskAction on overriden method for integrated task
^KT-42339 fixed

[Gradle, JS] Temporarily used next version of dukat

^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Ilya Goncharov
b37414ae0b [Gradle, JS] Add test on compilation with dukat binaries
^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Ilya Goncharov
c1fe8defd2 [Gradle, JS] Dukat descriptors
^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Ilya Goncharov
500fceb438 [Gradle, JS] Add binary dukat mode
^KT-42339 fixed

[Gradle, JS] Prepare sources and binary modes for dukat

^KT-42339 fixed
2020-10-09 13:58:33 +03:00
Dmitry Savvinov
f50851a982 Fix testdata after migrating to NewKotlinTypeCheckerImpl in OverrideResolver
- In kt10409 both 'pipe'-declarations contain error type.
NewKotlinTypeChecker in OverrideResolver considers error types as equal,
thus they are matched as bound declarations, thus 'IterablePipeline'
isn't considered to contain abstract member, thus no suggestion to add
abstract modifier.
Because initially test was covering purely technical issue of working
with error types, instead of removing it completely the additional
abstract member has been added

- in kt10808 we don't add explicit type anymore because
'noTypeInference' is false, because both expected type and actual type
are error-types, and KotlinIntroduceVariableHandler explicitly uses type
checker with 'errorTypesEqualToAnything=false'.
Also, this change might be ultimately seen as small improvement, because
if one extracts something with error type, they would certainly prefer
it to have a proper type as soon as errors are resolved (i.e. additional
code/imports written), rather than having a useless Any-type.
2020-10-09 13:44:06 +03:00
Dmitry Savvinov
f02593074f Drop isEqualTypeConstructor in favour of areEqualTypeConstructors 2020-10-09 13:44:06 +03:00
Dmitry Savvinov
fc4b488d43 Use NewKotlinTypeChecker in OverridingUtil
This allows to use deep type refinement in OverridingUtil, fixing issues
with expect/actuals in composite types
2020-10-09 13:44:06 +03:00
Dmitry Savvinov
01d6181050 Add test on overriding declaration with a composite type with expect declaration 2020-10-09 13:44:06 +03:00
Dmitry Savvinov
f8b9011667 Minor: unify error reporting for fun/properties overriding 2020-10-09 13:44:05 +03:00
Dmitry Savvinov
ac63d8b3bf Unify code for checking return type on override for fun/property
This fixes issues with the refinement of property' return type because
for functions' return type we already perform refinement properly
2020-10-09 13:44:05 +03:00
Dmitry Savvinov
736ecf3e9f Add test case on overriding property of expect-type
Current behaviour is undesired, the fix is in the next commit
2020-10-09 13:44:05 +03:00
Dmitry Savvinov
ac107f362e Refine types of type parameters before checking their equality in OverridingUtil 2020-10-09 13:44:05 +03:00
Dmitry Savvinov
80f4061a3d Add test on override with expect in return type 2020-10-09 13:44:04 +03:00
Vladimir Dolzhenko
f8b8f94040 Adjust vega IDE performance test charts 2020-10-09 11:03:26 +02:00
Mikhail Glukhikh
a6efaf440a FIR supertypes: replace class phase even if it hasn't unresolved supers 2020-10-09 09:45:46 +03:00
Mikhail Glukhikh
94302614cd [FIR] Add forgotten resolving status of enum entries (by Dmitry) 2020-10-09 09:45:45 +03:00
Dmitriy Novozhilov
5fbe715871 [FIR] Add forgotten replacing resolve phase during type resolve 2020-10-09 09:45:45 +03:00
Mikhail Glukhikh
1f5797e929 Don't resolve annotation arguments in FirTypeResolveTransformer 2020-10-09 09:45:45 +03:00
Mikhail Glukhikh
6f89385aec Transform forgotten property annotations in FirTypeResolveTransformer 2020-10-09 09:45:44 +03:00
Mikhail Glukhikh
e5463be6ba Don't transform parameter default values in FirTypeResolveTransformer 2020-10-09 09:45:44 +03:00
Mikhail Glukhikh
bdec245424 Don't transform enum entry initializer in FirTypeResolveTransformer 2020-10-09 09:45:44 +03:00
Mikhail Glukhikh
880eb6da6c Don't transform delegated constructor args in FirTypeResolveTransformer 2020-10-09 09:45:43 +03:00
Alexander Udalov
949952e766 kotlinx-metadata: minor, remove incorrect ReplaceWith from IS_PRIMARY deprecation 2020-10-08 17:44:35 +02:00
Mads Ager
afd710292a [JVM_IR] Fix mangling of default argument stubs for internal methods.
The MethodSignatureMapper expected to be able to look at the body
of the default argument stub. That is of course not possible when
it is from an external dependency.

Instead, we go through the attribute owner to get to the method
the stub is a default argument adapter for.
2020-10-08 17:43:24 +02:00
Jinseong Jeon
8c88670185 FIR: copy constructor for typealias'ed inner/nested class 2020-10-08 16:33:13 +03:00
Svyatoslav Kuzmich
5e5712afbb [JS IR] Make JsExport not fail on companion objects (KT-37829) 2020-10-08 14:07:50 +03:00
Victor Petukhov
9f716ba37c Jspecify: Rename DefaultNotNull to DefaultNonNull 2020-10-08 14:00:10 +03:00
Victor Petukhov
c3bada44cf Jspecify: Rename NullnessUnknown to NullnessUnspecified 2020-10-08 14:00:10 +03:00
Victor Petukhov
2685c7efce Jspecify: Rename codeanalysis annotations to jspecify ones 2020-10-08 14:00:10 +03:00
Denis Zharkov
59bd7364ab Enhance bounds for type parameters after loops disconnection
Otherwise behavior might change because enhancement may force computation
for other type parameters in cases like:
class A<X extends Y, Y extends X> {}

See the test:
org.jetbrains.kotlin.checkers.DiagnosticsTestGenerated.Tests.J_k#testRecursiveRawUpperBound3
2020-10-08 14:00:10 +03:00
Denis Zharkov
6661814e40 Do not enhance star projections for bounds of raw types
We have an invariant that their lower bound is always
SomeType<Any?> and their upper bound is SomeType<*>.
Ehancing the latter to SomeType<out Any> making
lower bound not being a subtype of upper bound that breaks contract
for flexible types (fails with exception)
2020-10-08 14:00:10 +03:00
Denis Zharkov
16b4a2c465 Do not enhance type parameter bounds if they contain a raw type
Otherwise enhancement algorithm starts forcing lazy mutually recursive
computations that leads to RECURSION_IN_SUPERTYPES in complex cases
2020-10-08 14:00:09 +03:00
Denis Zharkov
c1b34a83e9 Fix enhancement behavior in case of error-typed upper bounds 2020-10-08 14:00:09 +03:00
Denis Zharkov
2964d52640 Add test case for codeanalysis annotation 2020-10-08 14:00:09 +03:00
Denis Zharkov
dfb1cb8642 Minor. Rename UnknownNullness -> NullnessUnknown 2020-10-08 14:00:09 +03:00
Denis Zharkov
0b958c8ac5 Fix annotation name in test data to DefaultNullnessUnknown 2020-10-08 14:00:09 +03:00
Denis Zharkov
f3a490ee16 Support compiler flag -Xcodeanalysis-annotations 2020-10-08 14:00:09 +03:00
Denis Zharkov
c734bac676 Minor. Reformat JavaNullabilityChecker.kt 2020-10-08 14:00:08 +03:00
Denis Zharkov
ce2b7bded6 Minor. Reformat AbstractForeignAnnotationsTest.kt 2020-10-08 14:00:08 +03:00
Denis Zharkov
90a9ca6cb3 Minor. Rename flag in JvmAnalysisFlags: jsr305 -> javaTypeEnhancementState 2020-10-08 14:00:08 +03:00
Denis Zharkov
93d9301847 Minor. Extract JavaTypeEnhancementStateParser::parseJsr305State 2020-10-08 14:00:08 +03:00
Denis Zharkov
e7208f0c05 Rename Jsr305Parser -> JavaTypeEnhancementStateParser 2020-10-08 14:00:08 +03:00
Denis Zharkov
6c37574fce Rename Jsr305State -> JavaTypeEnhancementState
Also, rename some of the properties
It's needed to store status for codeanalysis annotation in that class
2020-10-08 14:00:08 +03:00
Denis Zharkov
2f04a1505d Support enhancement for unbounded wildcards from codeanalysis annotations 2020-10-08 14:00:07 +03:00
Denis Zharkov
392ef9aa2b Support type arguments enhancement from type parameters bounds
Currently, only works for codeanalysis annotations because
type parameters bounds are enhanced only for them
2020-10-08 14:00:07 +03:00
Denis Zharkov
e9e05c53e1 Support enhancement for type parameter based types
Load them as non-flexible when a relevant type parameter has non-flexible upper bound
(Currently, it only works for case of codeanalysis annotations)
2020-10-08 14:00:07 +03:00
Denis Zharkov
fa2578c795 Prepare type enhancement for codeanalysis annotations
- Rename NullabilityQualifierWithApplicability -> JavaDefaultQualifiers
- Use JavaDefaultQualifiers instead of JavaTypeQualifiers for default qualifiers

This change is intended to make code more clear and to allow add some additional
parameters specific for default qualifiers needed for codeanalysis annotations
2020-10-08 14:00:07 +03:00
Denis Zharkov
e27501497b Support codeanalysis annotations on type parameters bounds 2020-10-08 14:00:06 +03:00
Denis Zharkov
82d39dd86a Add basic support for default codeanalysis annotations 2020-10-08 14:00:06 +03:00
Denis Zharkov
517cc84f4d Add initial support for codeanalysis annotations 2020-10-08 14:00:06 +03:00
Vladimir Dolzhenko
165a147dd8 Improved IDE performance tests vega specs 2020-10-08 12:26:45 +02:00
Roman Golyshev
0682084ca3 [FIR Completion] Generate part of performance tests for FIR completion 2020-10-08 11:10:50 +03:00
Mikhail Glukhikh
beac3757bc [IR text test] Minor: add forgotten .fir.txt file 2020-10-08 10:33:58 +03:00
Vladimir Dolzhenko
46535bbd9d Add IDE performance tests vega specs 2020-10-08 00:07:17 +02:00
Dmitriy Dolovov
280fcb5c4b IDE: IndexNotReadyException while creating new Kotlin file in Dumb mode
^KT-42518
2020-10-07 22:36:52 +03:00
Alexander Udalov
2f003bdcb5 Minor, add regression test
#KT-42527
2020-10-07 21:31:43 +02:00
pyos
af98720720 JVM_IR: move MoveOrCopyCompanionObjectFields down a bit
More specifically, it should be done *just before*
JvmPropertiesLowering, as walking the IR tree between them will result
in visiting the moved backing fields twice (once via the companion's
parent, once via the IrProperty).

Ideally, this group of 3 lowerings should be merged into 1 as they are
completely inseparable, but this is slightly harder to do properly.

 #KT-42527 Fixed
2020-10-07 21:31:19 +02:00
pyos
dd1682510f JVM_IR: generate accessors for inherited abstract members too
#KT-41468 Fixed
2020-10-07 21:23:18 +02:00
Alexander Udalov
68157f09fa Minor, add temporary workaround for KT-42492 2020-10-07 19:33:40 +02:00
Roman Golyshev
7833698038 [FIR IDE] Fix idea-fir-performance-tests module references 2020-10-07 19:45:03 +03:00
Ilya Kirillov
efef18c2ca FIR IDE: mute not passing highlighting test 2020-10-07 19:45:02 +03:00
Ilya Kirillov
96422ea3fe FIR IDE: introduce highlighting performance test 2020-10-07 19:45:01 +03:00
Denis Zharkov
5cc12b49fc Hide java.lang.CharSequence::isEmpty from Kotlin built-in class
Also, prohibit using it as a synthetic property

^KT-42467 In progress
2020-10-07 17:48:19 +03:00
Denis Zharkov
90044f9672 Use correct naming for additional built-in member lists 2020-10-07 17:48:19 +03:00
pyos
98088f739d PSI2IR: do not generate when subjects multiple times
`in x` is represented as `<subject expression> in x` in psi, so
generating the entire call and then replacing the argument with a read
of a temporary results in redundant regenerations of the subject.

 #KT-42054 Fixed
 #KT-42455 Fixed
2020-10-07 17:22:25 +03:00
Alexander Udalov
e280416fe2 Minor, add regression test 2020-10-07 14:31:01 +02:00
pyos
8ef0fdf021 JVM_IR: remove two outdated comments 2020-10-07 14:30:36 +02:00
pyos
f7441813a9 JVM_IR: move SuspendLambdaLowering to a separate file 2020-10-07 14:30:36 +02:00
pyos
a6c62d3339 JVM_IR: do not inherit delegated property trackers
This is no longer needed now that lambdas are generated before
`$$delegatedProperties`.
2020-10-07 14:30:36 +02:00
pyos
05c856f1f7 JVM_IR: move SuspendLambdaLowering next to FunctionReferenceLowering
#KT-42253 Fixed
 #KT-39434 Fixed
2020-10-07 14:30:36 +02:00
pyos
44e0bfe90b JVM_IR: split AddContinuationLowering
One half handles suspend lambdas, the other - named functions.
2020-10-07 14:30:36 +02:00
pyos
4f171a9eb5 JVM_IR: move FunctionReference lowering before PropertyReference
so that `$$delegatedProperties` are generated in the lambdas' classes.
2020-10-07 14:30:36 +02:00
pyos
1190457759 JVM_IR: fix copying of receivers when unboxing inline class parameters
If an extension receiver is copied into a normal parameter, this may
later cause default argument masks to be shifted.
2020-10-07 13:21:50 +02:00
pyos
adcbfc7b4c IR: add an emptiness check to all unsigned until loops
Unlike signed integers, a larger unsigned type does not mean a lower
minimum value, so `x - 1` can overflow even if `x` is casted to a larger
type.

 #KT-42186 Fixed
2020-10-07 12:53:00 +02:00
pyos
4a03006162 Generate min/max constants as non-const in ranges tests
in order to make them appear as unknown values to codegen.
2020-10-07 12:53:00 +02:00
Pavel Punegov
260f66183c Don't ignore the test on JS backend as it doesn't fail any more. 2020-10-07 12:22:49 +03:00
Pavel Punegov
93b2ea2feb Regenerate tests 2020-10-07 12:18:12 +03:00
Pavel Punegov
a439860e12 Replace IGNORE_BACKENDs to TARGET_BACKEND for the Java test 2020-10-07 12:18:09 +03:00
Pavel Punegov
4d8ca074bc Ignore test for the full reflection in Native 2020-10-07 12:18:09 +03:00
Pavel Punegov
33d28b44fa Unmute typeOf tests in Native backend 2020-10-07 12:18:09 +03:00
Igor Yakovlev
d92aa94c6d [Usages] Provide BWC change for 1.4.20 and mark it as deprecated
Fixed #KT-42406
2020-10-07 12:09:59 +03:00
Vladimir Dolzhenko
23d33f51a2 Open build tool window on Gradle DSL errors
^EA-236697 Fixed
2020-10-07 10:46:52 +02:00
KotlinIsland
0e29f6f48b DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE: is -> are 2020-10-07 10:41:43 +02:00
Dmitry Gridin
9a0c3c47c8 [inspections] fix false positive "Redundant Unit" inspection in lambda with dynamic return type
^KT-40700 Fixed
2020-10-07 08:38:28 +00:00
Yaroslav Chernyshev
26d03295cf [Cocoapods] Remove hierarchical PodInstall dependsOn to Podspecs
#KT-41844 Fixed
2020-10-07 11:05:25 +03:00
Mikhail Glukhikh
e49f881e7f [FIR2IR] Add more clear exception about absent setter (see KT-42496) 2020-10-07 10:43:46 +03:00
Mikhail Glukhikh
aa4a042612 [FIR2IR] Use deepest matching symbol also for synthetic properties
#KT-42359 Fixed
2020-10-07 10:43:43 +03:00
Mikhail Glukhikh
fb4f27e136 [FIR2IR] Add test for problematic KT-42359 2020-10-07 10:43:38 +03:00
Jinseong Jeon
49307e243c FIR deserializer: load annotations on default accessors 2020-10-07 09:46:40 +03:00
Dmitriy Dolovov
c25742c91a kotlinx-metadata: Fix tests for Flag.Constructor.IS_SECONDARY flag
^KT-42429
2020-10-07 09:43:23 +03:00
Dmitriy Dolovov
52e56ca070 kotlinx-metadata: Wrong interpretation of Flag.Constructor.IS_PRIMARY
^KT-42429
2020-10-07 09:43:14 +03:00
Sergey Igushkin
3a5ffe479e General fixes for composite builds in HMPP
* Register project structure metadata providers globally, so included
  builds can access it from the root build.

* Rework some dependency management logic so that it doesn't assume that
  dependencies resolved to projects are safe to access – it is so only
  if the project is in the same build; also, in dependency handling, use
  proper keys which distinguish project with same ID in different
  builds.

* Add a separate implementation of `MppDependencyMetadataExtractor` that
  reads the project structure metadata from the mentioned global storage
  (as we can't read it from artifacts – those are not yet build at the
  project configuration phase) but when it comes to artifacts
  processing, takes real artifacts rather than introspect the project
  structure.

* Register the Kotlin/Native host-specific metadata artifact
  configurations as consumable, so that a consumer from a different
  build can properly resolve a dependency to such a configuration and
  get the artifact.
2020-10-06 23:26:17 +03:00
Sergey Igushkin
7d1a3a137b Publish MPP -metadata artifact in the root module, drop separate module
Until now, there was a separate module foo-metadata that contained the
Kotlin metadata artifacts. The reasons for this were only historical,
namely the platform modules used to depend on the metadata module and
expect it to bring the common sources to the IDE.

Now we don't really need the -metadata module, and it's now more harm
from it than good, as users never need to specify it as a dependency.

We fix this by removing the -metadata module from the default publishing
layout and putting the -metadata artifact(-s) directly to the root
module.
2020-10-06 23:26:17 +03:00
Sergey Igushkin
a0fbf54d11 Simplify matching of Kotlin variant name and Gradle configuration name
Earlier, the matching was non-trivial and required the consumer to look
through all of the producer's targets to find the Kotlin variant given
the name of the configuration that Gradle chose during variant-aware
dependency resolution. This is not feasible in composite builds as we
can't look into a project model of an included build.

To fix this, simplify the matching of the Gradle configuration name and
the Kotlin variant name by just using a suffix for the published
configurations.

Namely, instead of names like `jvm-api`, use the original configuration
name `jvmApiElements` for Kotlin variant names. To avoid ambiguity with
Gradle configurations (which we might want to customize for publishing,
like by altering the attributes or the published artifacts compared to
the configuration exposed for inter-project dependencies), create
publishing configurations
2020-10-06 23:26:16 +03:00
Sergey Igushkin
16d493558e HMPP resolution fixes
While we already had the associateWith relationship
that established additional visibility between such
source sets as fooMain and fooTest, this
relationship was not used properly when requested
dependencies were built for source set visibility
inference in HMPP. Instead, an old workaround was
used that just added dependencies of commonMain to
commonTest.

Fix this by using the associateWith relationship in
the preparation logic of source sets visibiltiy.

ALso, make the artifact view used in source sets visibility inference
lenient, so that a host-specific module that has not yet been published
won't lead to fail in source sets visibility and will instead be
ingored.
2020-10-06 23:08:01 +03:00
Sergey Igushkin
5963b07987 Use JSON as the format for the Kotlin project structure metadata 2020-10-06 23:08:01 +03:00
Sergey Igushkin
f19ef0184c Cleanup GranularMetadataTransformation after refactoring 2020-10-06 23:08:00 +03:00
Mads Ager
3817aa32a1 [IR] Move isAssignable to IrValueDeclaration. 2020-10-06 21:47:29 +02:00
Mads Ager
af0999ec6f [IR] Support isAssignable in builders and serialization. 2020-10-06 21:47:29 +02:00
Mads Ager
37145fb055 [JS_IR] Fix exponential behavior accidentally introduced. 2020-10-06 21:47:29 +02:00
Mads Ager
1f2ca606a5 [IR] Add isAssignable property to IrValueParameter.
Use it to check that only the value parameters that are explicitly
marked assignable are assigned.

Currently, the only parameters marked assignable are those for
default argument stubs.
2020-10-06 21:47:29 +02:00
Mads Ager
8d791ca98e [IR] Update naming, but not binary format for IrSetValue. 2020-10-06 21:47:29 +02:00
Mads Ager
33ab2299f9 [IR] Fix the type of the default argument mask condition.
On JVM and JS we can get away with using an Int but it really
should be a Boolean and Native reasonably insists on that.
2020-10-06 21:47:29 +02:00
Mads Ager
87f17dec4a [JS_IR] Use IrSetValue for default argument handling for JS backend.
Fix a couple of parameter remappings that now have to take IrSetValue
into account as well as IrGetValue.
2020-10-06 21:47:29 +02:00
Mads Ager
9a93bb3f09 [IR] Add IR support for setting parameters.
Use it in the JVM_IR backend for default values code. The parameter
local has to be overwritten for the inliner to work.
2020-10-06 21:47:29 +02:00
Ilya Chernikov
db23460fd5 Implement proper script runtime exception rendering with tests
#KT-42335 fixed
2020-10-06 21:43:11 +02:00
Ilya Kirillov
d5ad424e8f FIR: introduce source element mappings tests for raw FIR 2020-10-06 22:24:01 +03:00
Ilya Kirillov
a8ca2f8065 FIR IDE: fix diagnostics collection 2020-10-06 22:24:00 +03:00
Ilya Kirillov
551864d8c1 FIR: fix source element of FirQualifiedAccessExpression 2020-10-06 22:24:00 +03:00
Yan Zhulanow
c6de983476 Keep class members of the ExtensionPoint interface instead of its implementation for easier usage 2020-10-07 04:11:02 +09:00
Yan Zhulanow
0dc243d74c Parcelize: Don't activate both 'kotlin-parcelize' and 'kotlin-android-extensions' in IDE (KT-42267)
The actual problem is a lack of plugin activation check in ParcelableUltraLightClassModifierExtension (see how it should be done in ParcelizeUltraLightClassModifierExtension). However, ParcelableUltraLightClassModifierExtension lays inside ADT sources, and it's impossible to make an fast&easy fix from our side. However, we control the compiler plugin on which the IDE support is based, so the check is added there.

There should be no troubles if the application with 'kotlin-android-extensions' includes an Android library with 'kotlin-parcelize' or vise-versa, as runtime libraries of both plugins are attached to the 'implementation' Gradle configuration since AGP 2.5.
2020-10-07 04:11:02 +09:00
Yan Zhulanow
4c540152fe Parcelize: Forbid applying both 'kotlin-parcelize' and 'kotlin-android-extensions' (KT-42342) 2020-10-07 04:11:02 +09:00
Mads Ager
a37f16d7a2 [IR] Do not generate line numbers for synthesized data class members.
Fixes KT-41903.
2020-10-06 19:53:47 +02:00
Mikhael Bogdanov
5048471835 Properly check default kind on inheriting from old DefaultImpls scheme 2020-10-06 18:10:44 +02:00
Steven Schäfer
714d17ac63 Parcelize, JVM IR: Handle star projected and nullable arrays. 2020-10-06 17:42:35 +02:00
pyos
a6d5c02d9b JVM_IR: add a transformChildren call to PropertyReferenceLowering
#KT-42354 Fixed
2020-10-06 17:06:34 +02:00
Dmitry Petrov
b1bd138afb JVM_IR fix inline class <-> collection stubs issues
Move collectionStubMethodLowering before jvmInlineClassPhase, and make
them interact properly.

Note that some issues still remain in inline class <-> special bridges
interaction.

KT-40187 KT-42469
2020-10-06 17:08:24 +03:00
Alexander Udalov
2573eaa77f IR: do not crash renderer on functions with uninitialized return type
This is a follow-up to b497f39c29. It
turns out that it didn't help because `IrFunction.returnType` throws
exception, and checking for `IrUninitializedType` in `IrType.render` was
already too late. Throw and catch specific exception instead.

Also add function name into the exception message for better diagnostics
elsewhere (can't compute the full FQ name because in cases like
KT-42020, the parent is also uninitialized).
2020-10-06 14:23:34 +02:00
Alexander Udalov
06f1bd6101 Reformat IR tree declarations and implementations
Most of the changes are to the incorrect formatting introduced in
d1fd1da56f.
2020-10-06 14:21:40 +02:00
Mads Ager
b47e0e861b [PSI2IR] Use SYNTHETIC_OFFSET for delegated brigdes.
This allows kotlin-native to generate code in debug mode.
LLVM requires debug attributes for this code and SYNTHETIC_OFFSET
makes kotlin-native generate dummy debug attributes.
2020-10-06 13:32:55 +02:00
Mikhael Bogdanov
ed5c2b0565 Add tests for data class runtime string concatenation
#KT-35176
2020-10-06 13:20:41 +02:00
Mikhael Bogdanov
eb32a6ddbd Add test for for kt42457 wrong behaviour. Align runtime concatenation with it
#KT-42457
2020-10-06 13:20:40 +02:00
Mikhail Glukhikh
64fb114c30 FIR Java annotations: create vararg or Array depending on parameter name
#KT-42346 Fixed
2020-10-06 12:13:58 +03:00
Mikhail Glukhikh
f6b49a2c9a FirAnnotationArgumentChecker: handle conversion calls properly 2020-10-06 12:13:58 +03:00
Mikhail Glukhikh
6f432ea5dd [FIR] Add problematic test for KT-42346 (double vararg in annotation) 2020-10-06 12:13:57 +03:00
Mikhail Glukhikh
862fb6a405 FIR Java: make annotation parameters not-null 2020-10-06 12:13:57 +03:00
Ilya Goncharov
bcdc53d1c4 [Gradle, JS] Consider GString in npm dependencies parse in root dependencies
^KT-42462 fixed
2020-10-06 11:32:59 +03:00
Mikhael Bogdanov
39cde978d0 Minor. Rename test folder 2020-10-06 07:14:39 +02:00
Mikhael Bogdanov
d2c4be18a0 Rename runtime-string-concat option into 'string-concat' 2020-10-06 07:14:39 +02:00
LepilkinaElena
402f7df0d4 [IR] Save several last calculated line numbers not to recalculate them several times during code and debug info generation (#3792) 2020-10-06 08:03:50 +03:00
Roman Artemev
a52e045c91 [IR BE] Remap references in default arg value in inner class constructor
Make sure that there is no reference into zombie declarations.

 - fix KT-40771
 - add test
2020-10-06 00:06:47 +03:00
Roman Artemev
f597585ffb [IR BE] Refactor DefaultArgumentStubGenerator a bit 2020-10-06 00:06:46 +03:00
Ilya Chernikov
d7e0649d93 Automatically add -- after script/expression in kotlin runner
#KT-37987 fixed
2020-10-05 22:35:58 +02:00
Vladimir Dolzhenko
153217ae2e Clean up muted tests 2020-10-05 21:34:39 +02:00
Mikhael Bogdanov
b27955d268 Wrong specialization diagnostic is reported on java default inheritance 2020-10-05 20:09:21 +02:00
Jinseong Jeon
2d001a46fc FIR CFG traverser: do not skip graph enter node
#KT-42348 fixed
2020-10-05 19:48:12 +03:00
Jinseong Jeon
a154cf4c45 FIR checker: reproduce KT-42348 2020-10-05 19:48:11 +03:00
Vladimir Dolzhenko
be84110ada Clean up muted tests
Muted tests failed with `Range must be inside element being annotated` is fixed

Relates to ^KT-38959
2020-10-05 18:09:45 +02:00
Vladimir Dolzhenko
71d76bdb4b Revert "Perform shorten references under modal dialog"
This reverts commit 0b822aa4
2020-10-05 18:00:46 +02:00
Yaroslav Chernyshev
dcf18ec500 [Gradle, Cocoapods] Fix false-negative testCinteropExtraOpts failing 2020-10-05 16:40:32 +03:00
Ilya Gorbunov
76c5d036a8 Do not pack source of invisible runtime helpers to stdlib-js
Use reference sources of built-in Enum and Comparable instead.

KT-42318
2020-10-05 16:07:05 +03:00
Vyacheslav Gerasimov
4a9819bf9e Build: Upgrade gradle-enterprise plugin to 3.4.1 2020-10-05 15:57:10 +03:00
Vladimir Dolzhenko
0b822aa492 Perform shorten references under modal dialog
To prevent freezes and show progress to user shorten references has to be performed in a background thread

^KT-42170 Fixed
2020-10-05 11:41:56 +00:00
Vladimir Dolzhenko
36b3a8e0e3 Revert "Open build tool window on Gradle DSL errors"
This reverts commit 741df42c
2020-10-05 12:57:35 +02:00
Vladimir Dolzhenko
5eac949b43 Report EXPLICIT_DELEGATION_CALL_REQUIRED on relevant element
^KT-38959 Fixed
2020-10-05 09:43:05 +00:00
Jinseong Jeon
7af564c9f2 FIR: fix vararg remapping that merged named vararg 2020-10-05 12:33:03 +03:00
Vladimir Dolzhenko
29b23e79f3 Register EXPRESSION_CODE_FRAGMENT, BLOCK_CODE_FRAGMENT in KtStubElementTypes
Stubbed type has to be register earlier (see IStubFileElementType#checkNotInstantiatedTooLate)

Relates to ^KT-28732
2020-10-05 11:10:06 +02:00
Mikhail Glukhikh
3cd552cb43 [FIR2IR] Process anonymous object nested classes correctly
#KT-42373 Fixed
2020-10-05 12:06:53 +03:00
Mikhail Glukhikh
76cdf97b6d [FIR2IR] Set facade class for backing field properly #KT-42384 Fixed 2020-10-05 12:06:52 +03:00
Yaroslav Chernyshev
ad7ad98738 [Gradle, Cocoapods] Custom packageName and extraOpts for pods cinterop
#KT-40999 Fixed
2020-10-05 11:59:30 +03:00
Georgy Bronnikov
b0b971cd0a IR: Remove unused class 2020-10-05 11:02:12 +03:00
Georgy Bronnikov
80b7194799 IR: remove KotlinType usage from Ir.kt 2020-10-05 11:02:12 +03:00
Georgy Bronnikov
7afad9a91d Use wrapped descriptors in IrReturnableBlock 2020-10-05 11:02:12 +03:00
Georgy Bronnikov
38ee182f51 IR: remove unused AbstractClosureAnnotator 2020-10-05 11:02:11 +03:00
Ilmir Usmanov
5e02a4efd7 Mark implicit receiver as captured if the function is expression
#KT-40260 Fixed
 #KT-42280 Fixed
2020-10-05 09:36:54 +02:00
Dmitry Gridin
3078bd7b67 [formatter] line indent provider: fix indent for empty braces
^KT-42411 Fixed
2020-10-05 07:27:53 +00:00
Jinseong Jeon
380226cba0 FIR2IR: correct dispatch receiver inside inner class constructor 2020-10-05 09:12:19 +03:00
Jinseong Jeon
aa488eabc9 FIR2IR: distinguish constructor when picking return target 2020-10-05 09:09:39 +03:00
Ilya Chernikov
5ab822be36 Import scope of the imported script
#KT-34178
2020-10-02 18:53:31 +02:00
Ilya Chernikov
a71eab89e7 Remove unused code...
left after "Optimize scopes handling inside LexicalChainedScope"
refactoring commit.
2020-10-02 18:53:31 +02:00
Leonid Startsev
bdbf8d7980 Use correct class type when creating class references
(for e.g. PolymorphicSerializer)

Former class reference may had type arguments in it, which lead to bugs
in JS IR.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1072
2020-10-02 19:11:25 +03:00
Leonid Startsev
d4bdb0eedc Remove requirement on 'Serializable class must have single primary constructor'
#KT-38868 Fixed
 #KT-41627 Fixed
 Fixes https://github.com/Kotlin/kotlinx.serialization/issues/396
 Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1049
2020-10-02 19:11:25 +03:00
Ilya Goncharov
de8776ec1d [Gradle, JS] Support for groovy dsl and Pair in kotlin dsl
[Gradle, JS] Use package json custom fields as inputs

^KT-42400 fixed
2020-10-02 18:42:33 +03:00
Victor Petukhov
6c1dc43d25 Add check already fixed variables in PostponedArgumentInputTypesResolver during adding constraints on them and using inside a functional type
^KT-42374 Fixed
2020-10-02 18:31:54 +03:00
Ilya Goncharov
96ccf03794 [Gradle, JS] Test: Add yarn resolution by version shortcut
^KT-42420 fixed
2020-10-02 18:14:53 +03:00
Ilya Goncharov
18ec9f10f9 [Gradle, JS] Add yarn resolution by version shortcut
^KT-42420 fixed
2020-10-02 18:14:42 +03:00
Dmitriy Dolovov
07f78f5ab8 [Commonizer] Drop "kind" from CirClassConstructor
... as it is always CallableMemberDescriptor.Kind.DECLARATION
for serialized constructor declarations
2020-10-02 16:47:29 +03:00
Vladimir Dolzhenko
abc4aef403 Store kotlin-script-cache-dependencies as project file attribute
To avoid extra root project scan we need to store already processed script cache dependencies

^KT-41640 Fixed
2020-10-02 13:23:43 +00:00
Dmitry Petrov
941a506885 Add test for inline classes implementing collection interfaces
KT-40186
2020-10-02 14:06:07 +03:00
Ilya Chernikov
2828f0a814 Fix restoring script configuration from file attributes
#KT-41622 fixed
2020-10-02 12:38:22 +02:00
Ilya Chernikov
d88e87aaac Fix ScriptDefinition subtyping after earlier refactorings
#KT-41905 fixed
(may also fix other yet undetected or not analyzed problems with script
definitions)
2020-10-02 12:38:21 +02:00
Ilya Chernikov
adcfca3f98 Treat classpath extraction problems on script definition loading as warnings
#KT-44206 fixed
2020-10-02 12:38:21 +02:00
Vladimir Dolzhenko
741df42c18 Open build tool window on Gradle DSL errors
^EA-236697 Fixed
2020-10-02 10:08:49 +00:00
Dmitry Petrov
e018f2bd3e JVM_IR more precise check for special bridges in super class
KT-41123
2020-10-02 12:51:49 +03:00
Mikhael Bogdanov
cf5bd38bec JVM_IR. Support runtime string concatenation 2020-10-02 11:47:28 +02:00
Mikhael Bogdanov
1938f9459f Support indy concatenation 2020-10-02 11:47:28 +02:00
Mikhael Bogdanov
942e1962d9 Properly process constants 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
8a1f7c5859 Add TODO 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
c329c22630 Add runtime string concat options. Some renaming 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
04012951c1 Basic invokedynamic string concatenation support 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
88892ec65d Introduce StringAppendGenerator 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov
bf35818438 Minor. Reformat 2020-10-02 11:47:27 +02:00
Mark Punzalan
b58d75440b [FIR] Fix tests for vararg execution order after rebase. 2020-10-02 12:08:07 +03:00
Mark Punzalan
e175e87225 [FIR] Change type of argumentMapping properties and parameters from Map
to LinkedHashMap, to signify that the order is important and we don't
assume that mutableMapOf() will always return a LinkedHashMap.
2020-10-02 12:08:06 +03:00
Mark Punzalan
6b83f2d70e [FIR] Remove Candidate.oldToNewArgumentMapping and use
Candidate.argumentMapping instead of the Fir*Call's argumentList to
remap vararg arguments to a FirVarargArgumentExpression.

The argumentList was used to preserve the order, but we can rely on
Candidate.argumentMapping to have its keys in order.
2020-10-02 12:08:05 +03:00
Mark Punzalan
a2a4d94834 [FIR] Capture array and indices for postfix/prefix increment/decrement
of array element (including overloaded indexed access operators, e.g.,
`a[b, c]++`).

This prevents double-evaluation of the array and indices expressions,
which may have side-effects.
2020-10-02 12:08:03 +03:00
Mark Punzalan
eb631bc429 [FIR] Keep vararg argument order in resolved calls (KT-17691). 2020-10-02 12:08:02 +03:00
Mark Punzalan
f6ce2d893c [FIR] Handle varargs in overloaded indexed access operator. 2020-10-02 12:08:01 +03:00
Yan Zhulanow
c471a7735e Keep all variants of ExtensionPointImpl.registerExtension() in the pro-guarded compiler (KT-42103) 2020-10-02 17:50:23 +09:00
Toshiaki Kameyama
bcbb90dd81 "Receiver parameter is never used" inspection: don't report it when anonymous function is called with receiver
#KT-41246 Fixed
2020-10-02 13:32:31 +07:00
Mikhail Glukhikh
112e07814e [FIR] Mute test after rebase 2020-10-02 08:58:01 +03:00
Mikhail Glukhikh
cc88374fd7 [FIR] Add compile Kotlin against Kotlin test group 2020-10-02 08:57:55 +03:00
Mikhail Glukhikh
582f8fe287 FIR: recursive transform annotation if it has annotation as argument
#KT-42344 Fixed
2020-10-02 08:57:49 +03:00
Mikhail Glukhikh
2fd752f8f6 IR interpreter: fix calculation of constant Java fields
#KT-42117 Fixed
2020-10-02 08:57:44 +03:00
Mikhail Glukhikh
44ebec05bb FIR Java: support read of field constant initializers 2020-10-02 08:57:39 +03:00
Ilya Gorbunov
fafb4a7914 Use regex for case-insensitive String.replace
KT-41799
2020-10-02 00:29:26 +03:00
Francesco Vasco
4a0109cf44 Use StringBuilder in String.replace (2x faster)
KT-41799
2020-10-02 00:28:53 +03:00
Vladimir Ilmov
51a37bffff Incorrect package name for multipart classes 2020-10-01 23:06:17 +03:00
LepilkinaElena
dc2845df10 [IR] Avoid extra lists creation during getting explicit/all parameters (#3769) 2020-10-01 21:19:40 +03:00
Denis Zharkov
6d7744a921 FIR2IR: Use correct origin for lazily created fake overrides 2020-10-01 17:49:02 +03:00
Denis Zharkov
26a43b253f FIR2IR: Avoid recreation of declarations
They may be previously created for fake overrides
2020-10-01 17:49:02 +03:00
Denis Zharkov
ff4b6a0bf9 FIR: Fix modality computation for corner cases in FirTypeIntersectionScope
See org.jetbrains.kotlin.resolve.OverridingUtil#determineModalityForFakeOverride
2020-10-01 17:49:02 +03:00
Denis Zharkov
de3df799bc FIR: Fix implicit return type computation for synthetic property+intersection 2020-10-01 17:49:02 +03:00
Denis Zharkov
754e17a28f FIR2IR: Fix checking if accessor is allowed to have fake override 2020-10-01 17:49:02 +03:00
Denis Zharkov
70bf7063c9 FIR2IR: Add hack for delegate combinated with intersection 2020-10-01 17:49:02 +03:00
Denis Zharkov
85b8673434 FIR: Fix overload resolution with defaults 2020-10-01 17:49:02 +03:00
Denis Zharkov
4964ff0019 FIR2IR: Refine definition if we need a fake override
`realDeclarationSymbols` that was used before is built from klass.declarations that doesn't
contain e.g. declarations from enhancement
Next time, we should get rid of `realDeclarationSymbols` and use only
originalDeclaration.origin.fromSupertypes, but originalSymbol.callableId.classId == classId
doesn't work correctly
2020-10-01 17:49:02 +03:00
Denis Zharkov
3dfbd36f15 FIR: Unmute passing blackbox tests 2020-10-01 17:49:02 +03:00
Denis Zharkov
be6bef13d3 FIR2IR: Drop some unused declarations 2020-10-01 17:49:02 +03:00
Denis Zharkov
5c9187b270 FIR2IR: Rework fake overrides generation
- To discriminate what's already been generated, use the set of declaration
instead of names (it's obviously more correct)
- Make it possible to set more then one overridden (base)
2020-10-01 17:49:02 +03:00
Denis Zharkov
b241161c35 FIR2IR: Rework DelegatedMemberGenerator
Use scope content instead of manual traversing of declarations
2020-10-01 17:49:02 +03:00
Denis Zharkov
e311a60055 FIR: Refine FirDelegatedMemberScope
- Use an attribute instead of overriddenSymbol
- Use createCopyForFir because it copies type parameters
2020-10-01 17:49:02 +03:00
Denis Zharkov
28c536e511 FIR: Add temporary workaround to avoid changes in test data
CallableId for intersection overrides has been changed in previous commits
and many rendered FIR test data needs to be changed
But, we're going to get rid of callableId's/or fix them back for intersection overrides soon
2020-10-01 17:49:02 +03:00
Denis Zharkov
ff83555729 Minor. Optimize imports 2020-10-01 17:49:02 +03:00
Denis Zharkov
fd9c6479bf FIR: Do not call withReplacedConeType if type is unresolved 2020-10-01 17:49:02 +03:00
Denis Zharkov
cb07ffc4fd FIR: Clarify contracts for two versions FirClass<*>::scope
- One of them really creates a scope a specific type
- Another one is used for supertypes and includes creation of FirDelegatedMemberScope wrapper
2020-10-01 17:49:02 +03:00
Denis Zharkov
1adf731fc5 FIR: Minor. Use buildValueParameterCopy 2020-10-01 17:49:02 +03:00
Denis Zharkov
9696fecab5 FIR: Use refined visibility/modality for intersection overrides 2020-10-01 17:49:02 +03:00
Denis Zharkov
20bf238c27 FIR2IR: Fix signature computed for fake-overrides
Take into account _new owner_ of the function
Namely, if there's a substitution override from a class A<T> in its subtype B,
it will refer `B` as its owner in the signature
2020-10-01 17:49:02 +03:00
Denis Zharkov
9914b487b7 FIR: Do not load hashCode/toString/equals methods from Java interface
As it's done in FE 1.0, and there are subtle semantics in the language that depends on it
2020-10-01 17:49:02 +03:00
Denis Zharkov
7c7c5336f9 FIR: Reuse callables copying parts in FirClassSubstitutionScope
It changes the behavior in FirTypeIntersectionScope:
- now type parameters are also get copied
- value parameters are being copied unchanged
2020-10-01 17:49:02 +03:00
Denis Zharkov
0297be1fa8 FIR: Replace callableId for intersection overrides 2020-10-01 17:49:02 +03:00
Denis Zharkov
11bc0e3225 FIR: Extract FirTypeScope.getDirectOverridden* 2020-10-01 17:49:02 +03:00
Denis Zharkov
73c6eb2793 FIR2IR: Extract common parts in FakeOverrideGenerator 2020-10-01 17:49:02 +03:00
Denis Zharkov
d67a1f9123 FIR: Rework default parameters propagation through overrides 2020-10-01 17:49:02 +03:00
Denis Zharkov
ac666187b0 FIR: Use correct session in FirJvmMangleComputer 2020-10-01 17:49:02 +03:00
Denis Zharkov
c8afa8f715 FIR2IR: Remove unused FakeOverrideMode 2020-10-01 17:49:02 +03:00
Roman Golyshev
2b76fe8a72 [FIR Completion] Enable basic insertion handler tests for FIR completion
Enable tests that are passing
2020-10-01 15:42:50 +03:00
Steven Schäfer
39736868bf JVM IR: Allow debugger to evaluate expressions involving IR dependencies 2020-10-01 14:35:05 +02:00
Steven Schäfer
48b736e551 JVM IR: Enable evaluate expression tests for the JVM IR backend 2020-10-01 14:35:05 +02:00
Toshiaki Kameyama
33969c5f9a Redundant semicolon: fix false negative on start of line
^KT-40704 Fixed
2020-10-01 14:31:59 +02:00
Nikita Skvortsov
02c31a711c Avoid iterating over all idea modules.
Use hash table to quickly lookup idea module by gradle project path
2020-10-01 14:09:34 +02:00
Florian Kistner
713f6e1ed3 Load artifactory in root script to workaround conflicts 2020-10-01 13:46:01 +02:00
Yaroslav Chernyshev
4c9d3b4668 [Gradle, Cocoapods] Add Podfile missing info to podInstall error report
#KT-42243 Fixed
2020-10-01 14:30:19 +03:00
Roman Golyshev
6c79040cfb [FIR Completion] Enable passing tests 2020-10-01 13:07:20 +03:00
Roman Golyshev
12cd5fb43a [FIR Completion] Refactor FIR completion tests
Extract logic about checking the directive and catching the exception
2020-10-01 13:07:20 +03:00
anastasiia.spaseeva
31de584d14 [Spec tests] Generate sections json map 2020-10-01 12:32:22 +03:00
Victor Petukhov
d02432cf93 Introduce warning for the changing arguments execution order for named varargs (KT-17691) 2020-10-01 12:15:13 +03:00
Victor Petukhov
d62c665e99 Introduce language feature to enable the correct arguments execution order for named varargs (KT-17691) 2020-10-01 12:14:49 +03:00
Bart van Helvert
485ada7b90 Move getColon from KtClass to KtClassOrObject
Makes it possible to retrieve the colon from a KtObjectDeclaration.
2020-10-01 10:20:20 +03:00
Vladimir Dolzhenko
4d5b32b140 Clean up perf tests TC stats output 2020-10-01 07:52:01 +02:00
Victor Petukhov
986ee11aab Fix failing spec test 2020-09-30 22:14:11 +03:00
Kirill Shmakov
4f51367196 Remove build settings of CLion plugin 2020-09-30 19:56:49 +03:00
Vyacheslav Gerasimov
f03b957812 Build: Check ivy repository by empty marker file instead of directory
Should fix situations when directory exists but contents are invalid
which happens when unpacking process is interrupted.
2020-09-30 17:51:22 +03:00
Victor Petukhov
d0a1f18c7d Fix failing test after fcfabb70d5 2020-09-30 17:37:20 +03:00
Bingran
60cf3b5740 Upgradle agp version for ConfigurationCacheForAndroidIT
The new agp version contains the fix regarding build listeners which
will allow kgp run config caching test without warnings.

Fixes: n/a
Test: existing
2020-09-30 16:06:35 +03:00
Dmitry Petrov
af86c52101 JVM_IR merge annotations when substituting types
Otherwise special annotations such as @EnhancedNullability are lost,
which affects JVM signatures.

KT-42330
2020-09-30 15:44:54 +03:00
sebastian.sellmair
4b152a635e multiplatformUtil; Module.implementedModules: Extend Android M2 fallback to also include M3 relevant modules
Port of `kotlin-ide` commit: 9053046ad5731b7aca73e2f74b93e8bd8251f507
2020-09-30 12:34:26 +00:00
sebastian.sellmair
f9b8bc0edb Move KotlinAndroidDependsOnEdgesTest.kt to new functionalTest source set 2020-09-30 12:26:49 +00:00
sebastian.sellmair
1173c4380a KotlinPlugin: Setup default 'dependsOn' edges for Android source sets 2020-09-30 12:26:48 +00:00
Dmitriy Novozhilov
dbf34205ff Advance bootstrap to 1.4.30-dev-738 2020-09-30 15:00:44 +03:00
Victor Petukhov
fcfabb70d5 Report invisible setter error if it's resolved to synthetic property of base class with public getter and protected setter
^KT-11713 Fixed
2020-09-30 14:35:43 +03:00
Denis Zharkov
fdd71c0bce Fix incorrect NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER
^KT-42257 Fixed
2020-09-30 14:10:53 +03:00
Jinseong Jeon
d09ccdbe3c FIR serializer: distinguish typealias classifier 2020-09-30 12:21:57 +03:00
Jinseong Jeon
b4ac2f5b55 FIR serializer: special handling of Continuation 2020-09-30 12:21:57 +03:00
Konstantin Tskhovrebov
5d2adce7ab as42: Add lost project parameter to CliLightClassGenerationSupport. 2020-09-30 11:38:18 +03:00
Vladimir Dolzhenko
3212df6183 Reverted back occasional commenting of perf runs 2020-09-30 09:41:21 +02:00
Konstantin Tskhovrebov
803463ac11 Revert "as42: Fix override."
This reverts commit d33391f4
2020-09-30 10:28:38 +03:00
Nikolay Krasko
646e6446f7 as41: Fix compile error in :compiler:tests-common:compileTestJava 2020-09-30 10:05:57 +03:00
Nikolay Krasko
6d2647c681 Clean .bunch file
No need to pass base branch in the rule
2020-09-30 10:05:56 +03:00
Vladimir Dolzhenko
ce1b388668 Add registry key kotlin.resolve.forceFullResolveOnHighlighting
Relates to ^KT-41195
Relates to ^KT-38687
2020-09-30 05:56:46 +00:00
Vladimir Dolzhenko
50a16aa9bc Do not print metadata for perf tests 2020-09-29 23:48:16 +02:00
Dmitry Petrov
f79afd67f4 Add more tests for collections implemented by delegation 2020-09-29 22:44:00 +03:00
Vladimir Dolzhenko
3c380faeb5 Added deprecated PackageFragmentProvider#getPackageFragments for BWC
Relates to ^KT-33394
^KT-42259 Fixed
2020-09-29 19:14:44 +00:00
Mikhael Bogdanov
a228206cf5 Minor. Regenerate tests 2020-09-29 20:29:40 +02:00
Dmitry Petrov
79a2d9858c JVM_IR emulate JVM stub generation scheme
KT-42114
KT-42115
2020-09-29 21:06:30 +03:00
pyos
6dc08cb2fd Add a bytecode test that checks inlining of adapted references 2020-09-29 19:49:46 +02:00
pyos
9a3507af59 JVM_IR: treat adapted references as lambdas for inlining
#KT-38536 Fixed
 #KT-38535 Fixed
2020-09-29 19:49:46 +02:00
pyos
0e8a664c9b JVM_IR: fix bound suspend-converted references
Note: inlining of adapted callable references is still suboptimal.

 #KT-42021 Fixed
2020-09-29 19:49:46 +02:00
Mikhail Glukhikh
ac50433e17 Fix failing bytecode text test
In this commit I moved IGNORE_BACKEND_FIR to the end or deleted it
when it was applicable, to preserve correct line numbers
2020-09-29 19:16:42 +03:00
Yan Zhulanow
cfd90c85cb Kapt: Re-enable JDK 9/11 tests disabled by occasion 2020-09-30 00:31:08 +09:00
Pavel Kirpichenkov
b39af51390 [FIR] Extract language settings into a dedicated component
^KT-42080 Fixed
2020-09-29 18:22:56 +03:00
Pavel Kirpichenkov
8f31b1ca83 [FIR] Use default language settings in inference components
Without settings common inference components require additional parameters
to be passed explicitly from components not shared between FIR and FE10.
Proper configuration can be postponed in FIR, defaults are good enough for now.

^KT-42080 In progress
2020-09-29 18:22:56 +03:00
Yan Zhulanow
dba1b50aed Parcelize: Don't write Parcelize model if the Parcelize plugin is disabled 2020-09-29 23:58:30 +09:00
Yan Zhulanow
9cdd6e9a8f Kapt: Support new @JvmDefault functionality (KT-25960) 2020-09-29 23:58:30 +09:00
Yan Zhulanow
a44fd964cf Kapt: Don't convert field initializers for enum fields inside companion objects (KT-37732)
For classes with companion objects, Kotlin compiler generates a 'Companion' static accessor field.
Java prioritizes fields over inner types (apparently, Scala does this as well, KT-29864), so the generated initializer doesn't compile.
As a workaround, initializer generatation is disabled for enum fields inside companion objects. Certainly, it's not a proper fix, however it does fix the regression.
2020-09-29 23:58:29 +09:00
Toshiaki Kameyama
86ac44c23e "Replace 'if' with elvis operator": don't suggest if val initializer is a complex expression
#KT-35165 Fixed
2020-09-29 23:58:29 +09:00
Toshiaki Kameyama
653e20dcba Convert put to assignment: don't report when receiver object has custom 'set' method
#KT-33212 Fixed
2020-09-29 23:58:29 +09:00
Toshiaki Kameyama
5abb6bc7a5 Add quickfix for SENSELESS_NULL_IN_WHEN to remove redundant when branch
#KT-24556 Fixed
2020-09-29 23:58:29 +09:00
Toshiaki Kameyama
668473c337 Add quickfix for CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT to remove const modifier
#KT-35215 Fixed
2020-09-29 23:58:28 +09:00
Toshiaki Kameyama
5a3c6def8f Join with assignment: fix false negative when local variable are used
#KT-34270 Fixed
2020-09-29 23:58:28 +09:00
Toshiaki Kameyama
b56272dc64 Add name to argument: do not remove necessary backticks
#KT-30894 Fixed
2020-09-29 23:58:28 +09:00
Toshiaki Kameyama
a492fe7757 "Put arguments/parameters on separate lines": respect code style settings
#KT-20420 Fixed
2020-09-29 23:58:27 +09:00
Toshiaki Kameyama
74ee68e57b Remove redundant backticks: do not report if variable inside the string and isn't followed by space
#KT-35051 Fixed
2020-09-29 23:58:27 +09:00
Toshiaki Kameyama
ad3ea9a36a Replace with binary operator: don't highlight when receiver is platform type
#KT-35097 Fixed
2020-09-29 23:58:27 +09:00
Toshiaki Kameyama
93db78e7ac JavaMapForEachInspection: report for expression with implicit receiver
#KT-31833 Fixed
2020-09-29 23:58:27 +09:00
Yan Zhulanow
85e8b56a02 Minor: Simplify code 2020-09-29 23:58:26 +09:00
Toshiaki Kameyama
75e8849c94 Add quick fix for INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER
#KT-34533 Fixed
2020-09-29 23:58:26 +09:00
Yan Zhulanow
9f192ba85e Fix false positive in +0.0 == -0.0 comparison simplification (KT-17735) 2020-09-29 23:58:26 +09:00
Toshiaki Kameyama
915dc6ce91 FoldInitializerAndIfToElvisInspection: don't report when 'var' variable has no explicit type and it's used as not nullable type
#KT-38349 Fixed
2020-09-29 23:58:26 +09:00
Yan Zhulanow
db140b2815 Fix Pill debug IDEA run configurations 2020-09-29 23:58:25 +09:00
Yan Zhulanow
7b5fc19156 Minor: Simplify replacement check logic in ReplaceJavaStaticMethodWithKotlinAnalogInspection 2020-09-29 23:58:25 +09:00
Yan Zhulanow
ed2b547973 Minor: Extract suspend call check to a separate function 2020-09-29 23:58:25 +09:00
Toshiaki Kameyama
ef5335ba99 ReplaceJavaStaticMethodWithKotlinAnalogInspection: don't report for Character.toString(int)
#KT-34859 Fixed
2020-09-29 23:58:25 +09:00
Toshiaki Kameyama
b008e6c9be SimplifiableCallChainInspection: don't report if suspend function cannot be called correctly
#KT-23934 Fixed
2020-09-29 23:58:24 +09:00
Yan Zhulanow
1e9bb00744 Debugger: Disable "missing dependency superclass" diagnostic in evaluator (KT-38659) 2020-09-29 23:58:24 +09:00
Yan Zhulanow
62affd8e0d Kapt: Allow to strip @Metadata annotation from stubs (KT-36667) 2020-09-29 23:58:24 +09:00
Ilya Goncharov
da16b8e527 [Gradle, JS] Add includedRange with version only 2020-09-29 16:29:01 +03:00
Kirill Shmakov
3075de917b Add useAndroidX property into mobile library template KT-42123 2020-09-29 16:22:56 +03:00
Kirill Shmakov
ac9b5dabfc Clarify test names to avoid clashes in resolve
This is to workaround problem described in #KT-41342
2020-09-29 16:22:54 +03:00
Ilya Goncharov
31e7dd5fcc [Gradle, JS] Fix escaped characters in package.json
^KT-40202 fixed
2020-09-29 15:46:16 +03:00
Ilya Goncharov
337a66f906 [Gradle, JS] Fix NpmRange string representation with concrete version
^KT-42222 fixed
^KT-40986 fixed
^KT-39838 fixed
2020-09-29 15:46:16 +03:00
Ilya Goncharov
0fa4f0572b [Gradle, JS] Add test for duplicated dependency with range version
^KT-42222 fixed
^KT-40986 fixed
^KT-39838 fixed
2020-09-29 15:46:16 +03:00
Ilya Goncharov
024771028c [Gradle, JS] Fix yarn.lock resolution in case of duplicated dependencies
^KT-42222 fixed
^KT-40986 fixed
^KT-39838 fixed
2020-09-29 15:46:16 +03:00
Konstantin Tskhovrebov
34b6003371 as42: remove unused bunch files 2020-09-29 15:32:35 +03:00
Konstantin Tskhovrebov
c8def4543d Bump AS versions. 2020-09-29 15:32:35 +03:00
Konstantin Tskhovrebov
8a4aac53d8 as42: Fix override. 2020-09-29 15:32:34 +03:00
Andrei Klunnyi
ddfb86c839 KT-42014 ClassNotFoundException in Android Studio 4.2
KotlinCodeHintsPass was removed in 5fe1eaea but later a reference to
it appeared by accident in 50461e61.
2020-09-29 15:32:34 +03:00
Mikhail Zarechenskiy
8ff141357e as42: move plugin.xml to appropriate resource directy
#KT-41930 Fixed
2020-09-29 15:32:34 +03:00
Mikhail Zarechenskiy
11ac5bd32a as42: Fix test about forgotten bunches 2020-09-29 15:32:34 +03:00
Mikhail Zarechenskiy
929fb1f178 as42: Fix compilation of tests 2020-09-29 15:32:34 +03:00
Nikolay Krasko
99b9bc83a1 as42: Fix assertEqualsToFile usage 2020-09-29 15:32:34 +03:00
Nikolay Krasko
d83355e4c4 as42: Remove setupGradleSettings usage 2020-09-29 15:32:34 +03:00
Nikolay Krasko
fa9368125f as42: Remove clearing scratchesMapping in tests 2020-09-29 15:32:33 +03:00
Nikolay Krasko
c5b70797e2 as42: Fix compilation errors in AbstractJavaToKotlinConverterForWebDemoTest 2020-09-29 15:32:33 +03:00
Nikolay Krasko
1dc3cb5978 as42: Fix compilation errors caused by 202 platform 2020-09-29 15:32:33 +03:00
Nikolay Krasko
ecff2816ac as42: Fix duplication registration for com.intellij.psi.classFileDecompiler in plugin 2020-09-29 15:32:33 +03:00
Nikolay Krasko
a3bef10b97 as42: Add fastutil library to dependency to make KtUsefulTestCase.<clinit> work
java.lang.NoClassDefFoundError: it/unimi/dsi/fastutil/objects/Object2FloatMap
  at com.intellij.configurationStore.MyXmlSerializer$bindingProducer$1.createRootBinding(xmlSerializer.kt:172)
  at com.intellij.configurationStore.MyXmlSerializer$bindingProducer$1.createRootBinding(xmlSerializer.kt:170)
  at com.intellij.configurationStore.OldBindingProducer.getRootBinding(xmlSerializer.kt:154)
  at com.intellij.configurationStore.MyXmlSerializer.getRootBinding(xmlSerializer.kt:186)
  at com.intellij.util.xmlb.Serializer.getRootBinding(Serializer.java:18)
  at com.intellij.configurationStore.JdomSerializerImpl.serializeObjectInto(xmlSerializer.kt:78)
  at com.intellij.configurationStore.XmlSerializer.serializeObjectInto(xmlSerializer.kt:39)
  at com.intellij.configurationStore.XmlSerializer.serializeObjectInto$default(xmlSerializer.kt:38)
  at com.intellij.configurationStore.XmlSerializer.serializeObjectInto(xmlSerializer.kt)
  at com.intellij.codeInsight.CodeInsightSettings.writeExternal(CodeInsightSettings.java:231)
  at org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase.<clinit>(KtUsefulTestCase.java:123)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at junit.framework.TestSuite.createTest(TestSuite.java:60)
  at junit.framework.TestSuite.addTestMethod(TestSuite.java:307)
  at junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:150)
  at junit.framework.TestSuite.<init>(TestSuite.java:129)
2020-09-29 15:32:33 +03:00
Nikolay Krasko
1f3602c4b7 as42: Register DumbUtil service as it required in PsiElementFinderImpl 2020-09-29 15:32:33 +03:00
Nikolay Krasko
1b97511248 as42: Register classFileDecompiler through xml
It doesn't work otherwise. It's expected that extension point is registered
at the moment of ClassFileDecompilers instatiation or it fails.
2020-09-29 15:32:32 +03:00
Nikolay Krasko
5ba70b2cbb as42: Additional fixes for AS42 and 202 platform 2020-09-29 15:32:32 +03:00
Nikolay Krasko
2df030f583 as42: Apply 201 <-> AS41 diff 2020-09-29 15:32:32 +03:00
Nikolay Krasko
17e43aadaa Introduce AS42 bunch 2020-09-29 15:32:32 +03:00
Dmitry Petrov
1fc459ab4c JVM_IR KT-42260 add abstract overrides for generated stubs 2020-09-29 14:06:12 +03:00
Alexander Udalov
445b2d6eb1 JVM IR: minor, unmute bytecode text test
Also fix typo in the name
2020-09-29 12:38:54 +02:00
Alexander Udalov
b497f39c29 IR: do not try to render IrUninitializedType
This will improve exception messages in case some error happens on a
function whose return type is uninitialized, as in KT-41401.
2020-09-29 12:32:45 +02:00
Ilya Goncharov
522fdb3e59 [Gradle, JS] Empty compiler plugin classpath for KotlinJsIrLink
^KT-42245 fixed
2020-09-29 12:17:38 +03:00
Mikhail Glukhikh
cebbd21a1e FIR2IR: simplify analysis of companion' callable references 2020-09-29 11:51:21 +03:00
Jinseong Jeon
3151fc8577 FIR2IR: set dispatch receiver for companion member reference
#KT-42132 fixed
2020-09-29 11:51:21 +03:00
Jinseong Jeon
01d852c006 FIR: carry annotations on delegated property accessors 2020-09-29 11:35:19 +03:00
Aleksei Cherepanov
f1aa75fdf8 [JPS] Fix startup environment for Android Studio 2020-09-29 11:30:14 +03:00
Ilmir Usmanov
6ae2951850 Minor. Do not check suffix of function for tail-call optimization hit 2020-09-29 10:04:03 +02:00
Dmitriy Novozhilov
7d277b907f [FIR] Add new backend tests to "[JPS] Run fast FIR tests" configuration 2020-09-29 10:45:16 +03:00
Victor Petukhov
8f333aef3a Introduce warning about forbidden referencing to underscore named parameter of the catch block in a future release (KT-31567) 2020-09-29 10:23:45 +03:00
Victor Petukhov
09f1764f82 Introduce warning for private inline functions which return anonymous objects without specified supertypes (KT-33917) 2020-09-29 10:23:45 +03:00
Victor Petukhov
63d825fa24 Introduce warning for secondary constructor in enums without delegation to primary constructors (KT-35870) 2020-09-29 10:23:45 +03:00
Mikhail Glukhikh
416874f9d0 [FIR] Update BB test license comments 2020-09-29 10:21:22 +03:00
Mark Punzalan
238cc7c257 [FIR] Enable BytecodeText tests for FIR.
143 out of 767 tests (18.6%) are currently failing.
2020-09-29 10:21:21 +03:00
Mark Punzalan
69cd729506 [FIR] Enable BlackBoxAgainstJavaCodegen tests for FIR.
23 out of 156 tests (14.7%) are currently failing.
2020-09-29 10:21:21 +03:00
Mark Punzalan
348ba3e08c [FIR] Enable BlackBoxInlineCodegen tests for FIR.
16 out of 638 tests (2.5%) are currently failing.
2020-09-29 10:21:21 +03:00
Dmitriy Novozhilov
53a7d69ca6 [FIR] Make FirPropertyAccessor inherits FirCallableMemberDeclaration 2020-09-29 10:17:43 +03:00
Dmitriy Novozhilov
8f1062594f [FIR] Add ability to get scopes for declarations of TYPES resolve phase 2020-09-29 10:17:43 +03:00
Dmitriy Novozhilov
cc4f72e032 [FIR] Capture type from type parameter upper bound when needed 2020-09-29 10:17:43 +03:00
Dmitriy Novozhilov
393688ad82 [FIR] Add extension to FirSession to get ConeTypeCheckerContext 2020-09-29 10:17:42 +03:00
Dmitriy Novozhilov
9e4623c52b [FIR] Fix resolution of calls on super to avoid resolve to interface methods
#KT-38400 Fixed
2020-09-29 10:17:42 +03:00
Dmitriy Novozhilov
fb871a55a3 [FIR] Don't create backing field for property without explicit type
#KT-41977 Fixed
2020-09-29 10:17:42 +03:00
Dmitriy Novozhilov
0c0a8f9849 [FIR] Properly pass type attributes for inference of lambda with type variable as expected type
#KT-41989 Fixed
#KT-37317 Fixed
2020-09-29 10:17:42 +03:00
Dmitry Petrov
d9906ae8da Minor: unmute some bytecode listing tests in JVM_IR 2020-09-28 21:48:14 +03:00
Dmitry Petrov
565c156ddb Minor: reformat and cleanup warnings in CollectionStubMethodGenerator.kt 2020-09-28 21:48:14 +03:00
Yan Zhulanow
af1ed77d15 Parcelize: Fix NPE on availability check 2020-09-29 02:37:44 +09:00
pyos
8c423729e4 JVM_IR: slightly refactor ClassCodegen
* reduce code duplication for constructing JvmDeclarationOrigin;
 * move all `visitor.visitInnerClass` calls to before `visitor.done`;
 * make the order of members more strict & remove 3 mutable fields, as
   order-dependent mutation can lead to differences with incremental
   compilation due to inline calls (thus keeping mutable state in
   ClassCodegen is in general unsafe).
2020-09-28 17:08:01 +02:00
Andrei Klunnyi
79e5177126 [KTIJ-145] Memory leak detected 2020-09-28 15:21:21 +02:00
Yaroslav Chernyshev
819e83b68b [Gradle, Cocoapods] Complete logging for corner-case pod configurations 2020-09-28 16:09:36 +03:00
Yaroslav Chernyshev
5f4aa4db27 [Gradle, Cocoapods] Improve logging when deprecated podspec path is used
#KT-41948 Fixed
2020-09-28 16:09:36 +03:00
Toshiaki Kameyama
330502a0a6 KT-22665 "Create object" quick fix produce wrong code for enum (#2883)
* "Create object" quick fix: do not suggest for enum

#KT-22665 Fixed
2020-09-28 14:02:10 +02:00
Victor Petukhov
076eacb3d1 Check implicitly inferred Nothing inside special calls properly: compare constructors instead of types
^KT-41176 Open
2020-09-28 13:27:02 +03:00
Dmitriy Novozhilov
051d64742c Make SpaceBootstrap as default bootstrap source 2020-09-28 12:45:36 +03:00
Dmitriy Novozhilov
f39adfdf15 Update version of kotlin-build-gradle-plugin dependency 2020-09-28 12:43:10 +03:00
Dmitriy Novozhilov
7aef253a36 Add SpaceBootstrap option to kotlin-build-gradle-plugin 2020-09-28 12:43:10 +03:00
Vladimir Dolzhenko
a149d38c98 Register TYPE_CODE_FRAGMENT in KtStubElementTypes
Stubbed type has to be register earlier (see IStubFileElementType#checkNotInstantiatedTooLate)

^KT-28732 Fixed
2020-09-28 11:15:04 +02:00
Alexander Udalov
243db689af Build: fix "unknown enum constant" warning on Nls.Capitalization
#KTI-88 Fixed
2020-09-25 22:17:10 +02:00
Alexander Udalov
cb5c317f91 Gradle: support moduleName option in KotlinJvmOptions
#KT-42058 Fixed
2020-09-25 22:15:55 +02:00
Ilya Kirillov
0edbdaf0c7 Wizard: use EAP Kotlin versions for running import tests 2020-09-25 21:38:36 +03:00
Toshiaki Kameyama
bc580d2fd9 Introduce "Unused result of data class copy" inspection
#KT-34121 Fixed
2020-09-25 17:18:41 +02:00
Alexander Udalov
ae6d89b100 Minor, mute new test for FIR 2020-09-25 16:50:58 +02:00
pyos
bd6ead0467 JVM_IR: check for null when converting unboxed inline classes to strings
`C?` can be unboxed into `T?` if if wraps a reference type `T!!`, but in
this case `null` is not a valid value to pass to `toString-impl`.

 #KT-42005 Fixed
2020-09-25 16:50:34 +02:00
Igor Yakovlev
d2bdab2ef5 [FIR IDE] Add find usages tests for FIR plugin 2020-09-25 17:26:22 +03:00
Igor Yakovlev
d534d92123 [FIR IDE] Implement FIR for KotlinUsageTypeProvider 2020-09-25 17:26:22 +03:00
Toshiaki Kameyama
37ba9eccc4 KT-31553 Complete Statement: Wrong auto-insertion of closing curly brace for a code block (#2378)
* Complete statement: wrap property initializer by run/when block

#KT-31553 Fixed
2020-09-25 16:04:03 +02:00
Toshiaki Kameyama
14bdcb1e26 "Create enum constant" quick fix: suggest if expected type is Any
#KT-22666 Fixed
2020-09-25 15:57:11 +02:00
Mikhael Bogdanov
31ed5430ee Minor. Update test data 2020-09-25 15:45:56 +02:00
Alexander Udalov
f8f2be3d9f Minor, improve test on suspend invoke function reference
Add WITH_RUNTIME to enable it for the old backend, check the generated
function reference methods by starting the coroutine.
2020-09-25 14:52:46 +02:00
Steven Schäfer
20a5c44e41 JVM IR: Fix types in generated function reference constructor
For references to suspend functions this fixes an IllegalStateException
in the type mapper, which is what the "suspendFunctionMethodReference"
test is about.
2020-09-25 14:52:19 +02:00
Jinseong Jeon
f3db113a82 FIR2IR: use @Target to put annotations on either property or backing field 2020-09-25 14:45:49 +03:00
Jinseong Jeon
b59832c5fd FIR: refactor annotation-related utils 2020-09-25 14:45:48 +03:00
Jinseong Jeon
c8170702c6 FIR serializer: special version requirement for @JvmField property in interface companion 2020-09-25 14:45:48 +03:00
Jinseong Jeon
dc2226b42f FIR2IR: put @JvmField on field, not property
#KT-42118 fixed
2020-09-25 14:45:48 +03:00
Mikhail Glukhikh
ae23adb6f5 FIR Java: fix exception during synthetic property enhancement 2020-09-25 14:44:13 +03:00
Mikhail Glukhikh
368de43623 FIR Java: support Java setters more properly in use-site scope 2020-09-25 14:44:11 +03:00
Mikhail Glukhikh
873ea560a9 [FIR2IR] Fix conversion of flexible class reference 2020-09-25 14:44:10 +03:00
Mikhail Glukhikh
fe8e3e99ab [FIR Java] Hide function in scope in case it's an accessor by fact
#KT-42116 Fixed
2020-09-25 14:44:09 +03:00
Dmitry Petrov
70095712eb Minor: drop new bytecode listing test that passes only in JVM_IR
Unfortunately, there's no way to mute it in JVM right now.
Corresponding case is tracked as KT-42179, anyway.
2020-09-25 13:49:53 +03:00
Toshiaki Kameyama
a2f70dfc3d KT-41298 "Remove redundant 'with' call" intention works incorrectly with non-local returns and single-expression functions (#3713)
* Remove redundant 'with' call: remove redundant 'return' keyword

#KT-41298 Fixed
2020-09-25 12:48:31 +02:00
Konstantin Tskhovrebov
8a58ada4cd Fix version parser for versions without status "1.4-M1-42-IJ2020.1-1". 2020-09-25 12:17:17 +03:00
Roman Golyshev
945edfe987 KT-41859 Place classes after typealiases in DeserializedMemberScope
This way, the order in stubs and in deserialized text would be the same

On the next stub version bump, this fix should be reworked: the order
in the `DeserializedMemberScope` should be restored, and the order in
the stubs should be fixed to match the order in `MemberComparator`

^KT-41859 Fixed
2020-09-25 09:03:12 +00:00
Dmitry Petrov
cfd62c15bf JVM_IR KT-36994 don't generate stub if present in superclass 2020-09-25 11:57:33 +03:00
Dmitry Petrov
1adce11257 Add tests for KT-40191 2020-09-25 11:57:32 +03:00
Dmitry Petrov
a45b409e23 Minor: update generated JS tests 2020-09-25 11:57:32 +03:00
Mads Ager
4e518e77ca [JVM_IR] Fix expectations for parcelize tests.
The generated bridges now have line numbers as for the JVM
backend. There are some extra (irrelevant) labels in the JVM_IR
bytecode listing compared to JVM so expectations can still not
be shared even though they are closer.
2020-09-24 20:52:22 +02:00
Alexander Udalov
6d13fe8213 Minor, add explicit type argument to workaround KT-42175 2020-09-24 19:38:26 +02:00
pyos
f30e564c90 JVM_IR: do not use fields' superQualifierSymbol to cast the receiver
It's only for computing the field owner.

 #KT-42131 Fixed
2020-09-24 18:28:23 +02:00
anastasiia.spaseeva
a57c95624d Add changelog for 1.4.20-M1 2020-09-24 18:59:56 +03:00
Dmitriy Novozhilov
0d954f1190 Change module :core:compiler.backend.common.jvm to :compiler:backend.common.jvm 2020-09-24 16:51:06 +03:00
Dmitriy Novozhilov
b343d05e14 [FIR] Implement JvmTypeMapper based on cone types 2020-09-24 16:51:06 +03:00
Dmitriy Novozhilov
a28d0e0b7f Make IrTypeMapper delegate to AbstractTypeMapper 2020-09-24 16:51:06 +03:00
Dmitriy Novozhilov
86d4d320c4 Introduce AbstractTypeMapper based on type markers 2020-09-24 16:51:06 +03:00
Dmitriy Novozhilov
7380abac13 Split AsmUtils to descriptors dependent and independent parts 2020-09-24 16:51:05 +03:00
Dmitriy Novozhilov
54a5a066e8 Introduce new module for common parts of backend utils
Mainly it needed for abstract jvm type mapper for different type systems:
  IrTypes and ConeKotlinTypes
2020-09-24 16:51:05 +03:00
Dmitriy Novozhilov
c3a89e2507 Move common part of typeSignatureMapping.kt to :core:compiler.common.jvm 2020-09-24 16:51:05 +03:00
Dmitriy Novozhilov
d215c413cc Move TypeMappingMode to :core:compiler.common.jvm 2020-09-24 16:51:05 +03:00
Dmitriy Novozhilov
4ef57c120f [FIR] Consider variance of type parameters during java type enhancement
#KT-41940 Fixed
2020-09-24 15:43:20 +03:00
Dmitriy Novozhilov
a0db510e49 [FIR] Split creating fir for java declarations to separate methods 2020-09-24 14:59:35 +03:00
Dmitriy Novozhilov
0d29d6d361 [FIR] Transform when conditions with boolean expected type
#KT-42130 Fixed
2020-09-24 14:59:35 +03:00
Dmitriy Novozhilov
68a47d6efb [FIR] Add helpers for creating diagnostics on nullable source 2020-09-24 14:59:34 +03:00
Svyatoslav Kuzmich
162d9744ff [JS IR] Fix export of constructor with default argument (KT-41275) 2020-09-24 14:58:14 +03:00
Jinseong Jeon
5b136516c4 FIR: utilize checking subtype of functional type and finding invoke symbol 2020-09-24 14:05:52 +03:00
Jinseong Jeon
b10466f6a2 FIR: extend suspend conversion to subtype of functional type 2020-09-24 14:05:52 +03:00
Toshiaki Kameyama
17176c00ae Move lambda out: don't remove block comments
#KT-35357 Fixed
2020-09-24 12:05:43 +02:00
Roman Artemev
6670e4b21d [JS IR] Fix callable reference to generic constructor
- add tests
 - fix KT-42025
2020-09-24 12:50:47 +03:00
Ilmir Usmanov
4da67bf013 Minor. Unmute tests 2020-09-24 10:08:43 +02:00
Ilmir Usmanov
f22f10febb JVM_IR: Unbox inline classes in suspend functions
if the function can be verified to safely returning unboxed
inline class.
Box the return value on resume path.
2020-09-24 10:08:41 +02:00
Victor Petukhov
ccc9b757c0 Fix failing MPP tests after 25ea3df5ca through registering InferenceCompatibilityCheckerImpl instance 2020-09-24 10:49:33 +03:00
Mads Ager
ac742123fd [JVM_IR] Generate line numbers in synthetic bridges.
The current backend does that for some bridges. We do it consistently
for all bridges.

The line number used differs. For the JVM_IR backend, we use the
line number of the class to which the bridge is added. For the
JVM backend, that does not appear to be the case for bridges
in lambdas. I prefer the line number for a lambda invoke bridge
to be the line for the lambda instead os some surrounding class.
2020-09-24 08:59:48 +02:00
Yan Zhulanow
acf1a15f3e Parcelize: Add integration test for the new kotlin-parcelize plugin 2020-09-24 15:51:00 +09:00
Yan Zhulanow
2d158ffebd Parcelize: Add tests for deprecated (kotlinx.android.parcel) annotations 2020-09-24 15:50:59 +09:00
Yan Zhulanow
1d5ab192f5 Parcelize: Support old (kotlinx.android.parcel) annotations in Parcelize plugin 2020-09-24 15:50:59 +09:00
Yan Zhulanow
f0b93bf352 Parcelize: Move back annotations from kotlinx.android.parcel, deprecate them 2020-09-24 15:50:59 +09:00
Yan Zhulanow
75a1323974 Parcelize: Add deprecation warning to Android Extensions Gradle plugin (KT-42121) 2020-09-24 15:50:58 +09:00
Yan Zhulanow
419c88d1f2 Parcelize: Publish Parcelize compiler plugin to IDE dependencies repository 2020-09-24 15:50:58 +09:00
Yan Zhulanow
0ce9003ef7 Parcelize: Add missing dependencies to Parcelize components in tests 2020-09-24 15:50:58 +09:00
Yan Zhulanow
4bd8e2f78c Parcelize: Support the new Parcelize plugin in Gradle (KT-40030) 2020-09-24 15:50:57 +09:00
Yan Zhulanow
15b2850ee0 Parcelize: Add IDE support for the Parcelize compiler plugin with sources extracted from Android Extensions plugin (KT-40030) 2020-09-24 15:50:57 +09:00
Yan Zhulanow
b7796d63d8 Parcelize: Add the Parcelize compiler plugin with sources extracted from Android Extensions plugin (KT-40030) 2020-09-24 15:50:57 +09:00
Yan Zhulanow
c9bca165bc Update generated tests in android-extension-compiler 2020-09-24 15:50:57 +09:00
Steven Schäfer
aca9478998 Parcelize: Recognize (suspend) function types as serializable 2020-09-24 15:50:56 +09:00
Steven Schäfer
a2418484bb Parcelize: More robust code for locating layoutlib.jar 2020-09-24 15:50:56 +09:00
Steven Schäfer
9bf3f105d9 Parcelize: Add a test for sealed Parcelable classes 2020-09-24 15:50:56 +09:00
Steven Schäfer
77fb0ddd32 Parcelize: Update test expectations 2020-09-24 15:50:55 +09:00
rbares
9d000529e7 Fix JVM Parcelize use of Parceler 2020-09-24 15:50:55 +09:00
Steven Schäfer
8ab6411b93 Parcelize, JVM IR: Fix types in nested containers 2020-09-24 15:50:55 +09:00
Yan Zhulanow
eaa5d08736 Move all sources for android-tests to the 'test' source set 2020-09-24 15:50:55 +09:00
Steven Schäfer
3a7cc93c4e JVM IR: More precise check for calls to the implementation method in a default stub 2020-09-24 07:53:31 +02:00
Steven Schäfer
648bc9b1c4 JVM IR: Check for cycles when inlining into default stubs 2020-09-24 07:53:31 +02:00
Steven Schäfer
111c550f3c JVM IR: More tests for inlining in $default stubs 2020-09-24 07:53:31 +02:00
Steven Schäfer
5e27d9b089 JVM IR: Make inlining in $default stubs compatible with the JVM BE
The JVM BE inlines calls to the underlying function in a $default stub
verbatim, e.g., without renaming LVT entries or regenerating anonymous
objects. This commit introduces the same behavior in the JVM IR BE.

Fixes KT-36769.
2020-09-24 07:53:31 +02:00
Steven Schäfer
bef0437edb JVM IR: Generate LVT entries for parameters in inline $default methods 2020-09-24 07:53:31 +02:00
Ilya Kirillov
347a984ce0 FIR IDE: fix tests compilation 2020-09-23 21:43:58 +03:00
Ilya Kirillov
f36cd28696 FIR IDE: introduce withFir function 2020-09-23 21:43:58 +03:00
Ilya Kirillov
a516264923 FIR IDE: introduce withFirDeclaration function 2020-09-23 21:43:57 +03:00
Ilya Kirillov
ebc2ea59cd FIR IDE: introduce WeakFirRef for low level 2020-09-23 21:43:57 +03:00
Ilya Kirillov
8ee4c4e047 FIR IDE: introduce scoped fir functions 2020-09-23 21:43:57 +03:00
Ilya Kirillov
e19d2ecc73 FIR IDE: make FirModuleResolveState functions to be internal 2020-09-23 21:43:57 +03:00
Ilya Kirillov
8e41384f6d FIR IDE: separate LowLevelFirApiFacade from completion 2020-09-23 21:43:56 +03:00
Ilya Kirillov
7cc714c598 FIR IDE: move all public low level api to separate package 2020-09-23 21:43:56 +03:00
Ilya Kirillov
a0337ec10d FIR: fix invalid increasing inner array size in ArrayMapImpl 2020-09-23 21:43:56 +03:00
Ilya Kirillov
4238fd3842 FIR IDE: fix compilation after rename registerJavaSpecificComponents -> registerJavaSpecificResolveComponents 2020-09-23 21:43:55 +03:00
Ilya Kirillov
65ef629ca7 FIR: add ensureResolved to processConstructors 2020-09-23 21:43:55 +03:00
Ilya Kirillov
a570be4e76 FIR IDE: fix compilation of AbstractFirIdeDiagnosticsCollector.kt 2020-09-23 21:43:55 +03:00
Ilya Kirillov
fa570710ee FIR IDE: move diagnostic highlighting to separate
pass
2020-09-23 21:41:54 +03:00
Ilya Kirillov
1f4aff9643 FIR: add ensureResolved to FirSealedClassInheritorsTransformer 2020-09-23 21:41:53 +03:00
Ilya Kirillov
1c0bbaf225 FIR: add ensureResolved to FirExposedVisibilityDeclarationChecker 2020-09-23 21:41:53 +03:00
Ilya Kirillov
04fca93b1e FIR IDE: fix completion on parenthesized expression 2020-09-23 21:41:52 +03:00
Ilya Kirillov
879cf3b049 FIR IDE: do not fail whole completion on exception in lookup element creation 2020-09-23 21:41:52 +03:00
Ilya Kirillov
e9fb79741a FIR IDE: fix completion in initializer 2020-09-23 21:41:51 +03:00
Roman Golyshev
1ab6595ae2 FIR Completion: Use name filtering in completion contributor 2020-09-23 21:41:51 +03:00
Roman Golyshev
75d8710bf6 FIR IDE: Add name filtering to scope KtScope and implementations 2020-09-23 21:41:50 +03:00
Roman Golyshev
dc600e3caf FIR IDE: Fix buildKtType for ConeDefinitelyNotNullType 2020-09-23 21:41:49 +03:00
Ilya Kirillov
74298aae32 FIR IDE: invalidate sessions on exception 2020-09-23 21:41:48 +03:00
Ilya Kirillov
a743b80d17 FIR IDE: reuse up-to-date fir sessions 2020-09-23 21:41:47 +03:00
Ilya Kirillov
22c2d34b14 FIR IDE: add debug info when can not build KtType 2020-09-23 21:41:46 +03:00
Ilya Kirillov
a52262bf97 FIR IDE: run completion resolve under lock 2020-09-23 21:41:45 +03:00
Ilya Kirillov
f1c808384e FIR IDE: do not resolve symbols by transitive module dependencies 2020-09-23 21:41:44 +03:00
Ilya Kirillov
01875635db FIR IDE: do not resolve whole firFile in completion 2020-09-23 21:41:44 +03:00
Ilya Kirillov
2cfbfabe04 FIR IDE: do not recreate transformer phases & ScopeSession 2020-09-23 21:41:42 +03:00
Ilya Kirillov
9a99703f24 FIR IDE: implement incremental function analysis 2020-09-23 21:41:41 +03:00
Ilya Kirillov
8bcba00bb7 FIR IDE: do not resolve declarations if they are already resolved when we are inside lock 2020-09-23 21:41:40 +03:00
Ilya Kirillov
fc64d8d5e8 FIR IDE: reanalyse dependent modules only then they change 2020-09-23 21:41:40 +03:00
Ilya Kirillov
07be30c5db FIR IDE: separate fir session for current module from dependent modules session 2020-09-23 21:41:39 +03:00
Ilya Kirillov
ab897752de FIR IDE: remove invalid comments from FirIdeSessionFactory 2020-09-23 21:41:39 +03:00
Ilya Kirillov
4045c8fbf4 FIR IDE: fix invalid order of classes in classIdIfNonLocal 2020-09-23 21:41:38 +03:00
Ilya Kirillov
766063ba77 FIR IDE: optimize search for FirDeclaration by KtDeclaration 2020-09-23 21:41:37 +03:00
Ilya Kirillov
36e57545e8 FIR IDE: simplify psiModificationTrackerBasedCachedValue 2020-09-23 21:41:36 +03:00
Ilya Kirillov
73451b1616 FIR IDE: reresolve libraries only when they change 2020-09-23 21:41:35 +03:00
Ilya Kirillov
c48cc615dd FIR IDE: use KtAnalysisSession as receiver 2020-09-23 21:41:35 +03:00
Ilya Kirillov
d4786e06a9 FIR IDE: ignore PCE when running lazy resolve phase 2020-09-23 21:41:34 +03:00
Ilya Kirillov
9130392eb9 FIR IDE: resolve symbol to status to get it modality 2020-09-23 21:41:34 +03:00
Ilya Kirillov
0c47d42659 FIR IDE: add failing multiModuleLazyResolve test 2020-09-23 21:41:33 +03:00
Ilya Kirillov
a3a59131b5 FIR IDE: fix passing whenWithHeiarchy test 2020-09-23 21:41:32 +03:00
Roman Golyshev
6d0a5a0bb2 KT-41346 Implement NoReorderImplementation without reordering
- See the documentation for `DeserializedMemberScopeHelper` for the full
info about the fix and the issue
- Add `preserveDeclarationsOrdering` setting to
`DeserializationConfiguration`
- Enable this setting in `DeserializerForClassfileDecompiler`
- Also, use `List` instead of `Collection` to pass members to
`DeserializedMemberScope`. It is done to emphasize that the order of
the members is important and may be used
- Review: https://jetbrains.team/p/kt/review/1627
- ^KT-41346 Fixed
2020-09-23 15:27:51 +00:00
Roman Golyshev
bf371ff98a KT-41346 Refactor computeNonDeclared*
Change the signature of the `computeNonDeclared*` methods so they expect
mutable lists - it better suits their contracts. Also, add a little
documentations about the contract

Also, change `Collection` to `List` for incoming protos to `emphasize`
that their order might be used
2020-09-23 15:27:50 +00:00
Roman Golyshev
b1097c49d3 KT-41346 Move Implementation to DeserializedMemberScope 2020-09-23 15:27:49 +00:00
Roman Golyshev
5596bf33d8 KT-41346 Move related code to OptimizedImplementation
This does not change any semantics, only moves the code around
2020-09-23 15:27:49 +00:00
Roman Golyshev
c8878f862d KT-41346 Introduce inner OptimizedImplementation class
Make it implement `Implementation` and move definitions
there
2020-09-23 15:27:48 +00:00
Roman Golyshev
683dd57f24 KT-41346 Extract Implementation interface
This is a temporary interface to make refactoring easier
2020-09-23 15:27:47 +00:00
Roman Golyshev
341a7478ed KT-41346 Move removing non-available functions to protected method
This would allow to stricten contract on `computeNonDeclaredFunctions`
2020-09-23 15:27:47 +00:00
Roman Golyshev
4f4c25ca5e KT-41346 Cleanup DeserializedMemberScope 2020-09-23 15:27:46 +00:00
Ilya Kirillov
622f71bd65 Fix binary compatibility with AS
#KT-42061 fixed
2020-09-23 18:25:07 +03:00
Dmitry Petrov
1c4567c999 Add tests for KT-40152 2020-09-23 18:14:21 +03:00
Dmitry Petrov
cd37301ea2 Minor: TARGET_BACKEND=JVM in JVM-specific tests 2020-09-23 18:14:21 +03:00
Dmitry Petrov
99dbeecc40 Some more bytecode listing tests for JVM_IR 2020-09-23 18:14:20 +03:00
Victor Petukhov
25ea3df5ca Put fix in 9123c4f73baf77f8a50dede6c890c46f5ffafd6c under the inference compatibility flag 2020-09-23 17:15:58 +03:00
Victor Petukhov
bfb46befa5 Mark projection of a nullable captured type as not null during simplification constrains with it and a nullable type variable
^KT-41913 Fixed
2020-09-23 17:15:57 +03:00
Dmitriy Novozhilov
0f868ff83f [TEST] Regenerate tests 2020-09-23 17:12:14 +03:00
Alexander Udalov
84df996204 JVM IR: fix "step over" for inline function calls in conditions
Reimplement the same hacky approach used in the old backend (see
cc2fe6b0c6).

Previously, the debugger incorrectly stepped into Collections.kt on
"step over" inline function calls from stdlib like 'any'.

Since `if` and `when` expressions are represented the same way in IR,
the behavior is fixed for both of them. It's not the case in the old JVM
backend, where stepping over `when` conditions still suffers from the
same problem, which the newly added test checks.
2020-09-23 15:54:15 +02:00
Toshiaki Kameyama
4144adf4ee Make internal: don't suggest in interface
#KT-35346 Fixed
2020-09-23 15:34:09 +02:00
Toshiaki Kameyama
6e8565917e MapGetWithNotNullAssertionOperatorInspection: decrease severity to INFORMATION
#KT-33096 Fixed
2020-09-23 14:52:14 +02:00
Dmitriy Novozhilov
5e73e28695 [FIR-TEST] Fix psi consistency test due to 5efd533f 2020-09-23 15:32:09 +03:00
Dmitriy Novozhilov
10e7c0f1b2 [TEST] Fix long literal in testdata broken in 4374c06 2020-09-23 15:22:03 +03:00
Toshiaki Kameyama
a2bde2ffb2 Redundant overriding method: do not report when super method is not called
#KT-34959 Fixed
2020-09-23 14:12:06 +02:00
Roman Artemev
76ed09482f [IR BE] Fix inline class lowering
- provide additional type parameters from context when transforming
 constructor into static function.
 - fix KT-41771
 - add test
2020-09-23 14:49:38 +03:00
pyos
5954db18cb JVM_IR: fix lifting of arguments to object super constructors
If the arguments are reordered, they can not only be reads of temporary
variables, but also implicit type casts of said reads.

Fixes #KT-42002
2020-09-23 13:49:16 +02:00
Dmitriy Novozhilov
4d5e54cab6 [FIR] Unwrap definitely not null when matching overrides
#KT-41984 Fixed
2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
08b5f3ddde [FIR] Remove unused list with java.lang.Object member names 2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
896103b94b [FIR] Properly resolve implicit invoke calls
#KT-41990 Fixed
2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
a8e81e9ad1 [FIR] Add special node for implicit invoke calls 2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
696c8f07b4 [FIR] Add pretty toString to CallKind 2020-09-23 14:05:11 +03:00
Dmitriy Novozhilov
40a9bb6eac [FIR] Assume nullable types as good types for ILT approximation
#KT-41982 Fixed
2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
f069857492 [FIR] Cleanup annotations transform in FirExpressionsResolveTransformer 2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
0e91c8f048 [FIR] Create synthetic properties for members of java annotations
#KT-41939 Fixed
2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
da3a676c2a [FIR] Get rid of FirIntegerLiteralTypeScope and corresponding stuff 2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
4374c06537 [FIR] Approximate all integer literals which resolved in independent mode
#KT-42016
2020-09-23 14:05:10 +03:00
Dmitriy Novozhilov
5efd533f55 [FIR] Desugar unary plus and minus as part of integer literal
#KT-42016
2020-09-23 14:05:09 +03:00
Dmitriy Novozhilov
a018847f85 [FIR] Properly deserialize type attributes for type arguments
#KT-41991 Fixed
2020-09-23 14:05:09 +03:00
Dmitriy Novozhilov
a274216f14 [FIR] Check that expected lambda type is extension function using cone expected type
#KT-41991 In progress
2020-09-23 14:05:09 +03:00
Dmitriy Novozhilov
57a57d10da [FIR] Add rendering for attribites of cone types 2020-09-23 14:05:07 +03:00
Alexander Udalov
d48307ec34 JVM IR: do not copy type parameters into suspend lambda classes
Declarations inside that class are referencing the type parameters of
the containing function anyway, since we don't do any remapping. So the
resulting IR is slightly more correct, and doesn't lead to type
parameter/argument size mismatch error on IrBased/Wrapped-descriptors.

This reverts a part of 01da7f289b, which looks like it was no longer
necessary after 8d0ffa1444.

 #KT-42028 Fixed
2020-09-23 12:21:37 +02:00
Toshiaki Kameyama
bdf502edef Override/Implement members: don't add 'external' modifier
#KT-33466 Fixed
2020-09-23 11:51:08 +02:00
Vladimir Dolzhenko
4e5c61cd2f Notify if gradle points to invalid JDK
^KT-41141 Fixed
2020-09-23 09:44:07 +00:00
Vladimir Dolzhenko
be20a8bd80 Configure modules Kotlin language settings in a background with a progress
^KT-41936 Fixed
2020-09-23 09:18:52 +00:00
Dmitriy Dolovov
f0cbd6b1a5 HMPP: Avoid NPE during Kotlin facet serialization
^KT-42029
2020-09-23 10:39:11 +03:00
Mikhail Glukhikh
4653a16450 [FIR2IR] Add problematic test with in/out clash during approximation 2020-09-23 09:01:45 +03:00
Mikhail Glukhikh
3a57a541f4 FIR mangler: support captured types 2020-09-23 09:01:42 +03:00
Mikhail Glukhikh
b64b32e06b FIR: keep captured types in substitution scope 2020-09-23 09:00:57 +03:00
Mikhail Glukhikh
b7059a3eeb FIR: perform type approximation when completion isn't required 2020-09-23 09:00:57 +03:00
Mikhail Glukhikh
0310272738 FIR: perform more proper type approximation in completion
Note: test data change is questionable here
2020-09-23 09:00:57 +03:00
Mikhail Glukhikh
14cfc62745 FIR: fix calculation of type arguments for bare types 2020-09-23 09:00:57 +03:00
Mikhail Glukhikh
3c3aa3210e FIR: use FROM_EXPRESSION, not FOR_SUBTYPING capt. types in substitution 2020-09-23 09:00:56 +03:00
Mikhail Glukhikh
86d1a3be37 FIR serializer: throw exception on getting ConeIntegerLiteralType
This commit assumes that ILTs are forbidden
at the end of resolve, at least in public API
2020-09-23 09:00:56 +03:00
Mikhail Glukhikh
5a919cc827 FIR element serializer: drop duplicated approximation code 2020-09-23 09:00:56 +03:00
Mikhail Glukhikh
104f088d4e FIR serializer: throw exception on getting ConeCapturedType
This commit assumes that captured types are forbidden
at the end of resolve, at least in public API
2020-09-23 09:00:56 +03:00
Georgy Bronnikov
83ee705c0a IR: make IrClassReference.classType mutable 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
9d22ef948c IR: rework ScopeValidator 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
377940a6ea IR: handle IrVararg.varargElementType in RemapTypes 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
a542bb6af7 IR: check IrClassReference.classType in ScopeValidator 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
728c55973a IR: handle MemberAccessExpression type parameters in RemapTypes 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
3041a2815c IR: handle varargElementType in LocalDeclarationsLowering 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
8990344bb2 Varargs: add test 2020-09-22 23:53:41 +03:00
Georgy Bronnikov
67d7bf3269 IR: take care of supertypes when copying IrTypeParameters 2020-09-22 23:53:40 +03:00
Georgy Bronnikov
916d66c220 IR: add ScopeValidator 2020-09-22 23:53:40 +03:00
Georgy Bronnikov
382f423ab9 Mute a test under DCE 2020-09-22 23:53:40 +03:00
Georgy Bronnikov
33a2c69122 IR: remap types in LocalDeclarationsLowering 2020-09-22 23:53:40 +03:00
Georgy Bronnikov
1f3d344835 IR: add RemapTypes.kt 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
df1d9a0113 IR: make IrTypeParameter.superTypes persistent mutable field 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
a409976d28 IR: make IrValueParameter.varargElementType mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
a3763e8276 IR: make IrTypeAlias.expandedType mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
78fc690f29 IR: make IrLocaldelegatedProperty.type mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
09a906cc9a IR: make IrTypeOperatorCall.typeOperand mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
d9681e535d IR: make IrField.type mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov
5065b1a4c6 Make IrValueDeclaration.type mutable 2020-09-22 23:53:38 +03:00
Georgy Bronnikov
1f37795e08 IR: make IrExpression.type mutable 2020-09-22 23:53:38 +03:00
Alexander Udalov
fde7fc6951 JVM IR: use correct file for final test output check in debugger tests
Before this change, a test with incorrect .ir.out could pass if the test
execution result was equivalent to the main .out file, which was a bit
confusing.
2020-09-22 19:15:35 +02:00
Mads Ager
78483930bc [JVM_IR] Fix offsets in constant propagation optimization.
Loads of temporary variables that contain constants are replaced
with a copy of the constant. This avoids locals loads and stores.
However, the copy of the constant needs to have the offset of
the load and not of the original constant.

Fixes KT-41963.
2020-09-22 19:12:06 +02:00
Alexander Udalov
f273edeb8e Build: upgrade language to 1.3 in cli, compiler plugins and Gradle plugin
The language/API version restriction here is to make sure the code works
with Gradle of earlier versions, but all versions of Gradle that we
support already depend on Kotlin 1.3+.
2020-09-22 19:10:58 +02:00
Alexander Udalov
5755c32c84 Minor, fix appendln deprecation warnings in cli
Can't use appendLine yet because this module is compiled with API
version 1.3.
2020-09-22 19:10:58 +02:00
Toshiaki Kameyama
f20a6b7fe1 Change function signature: add/change receiver type
#KT-21799 Fixed
2020-09-22 18:07:24 +02:00
Mads Ager
9f3ce099ee [JVM_IR] Fix line numbers for function reference invoke methods. 2020-09-22 16:59:46 +02:00
Ilya Goncharov
16b2379cd7 [Gradle, JS] Use new npm versions 2020-09-22 16:57:21 +03:00
Ilya Goncharov
9f9cb4f57e [Gradle, JS] Parallelize requests 2020-09-22 16:57:21 +03:00
Ilya Goncharov
a86dd8b5ba [Gradle, JS] Refactor with coroutines 2020-09-22 16:57:21 +03:00
Ilya Goncharov
4986e8c9cc [Gradle, JS] Fetch NPM package versions in separate module 2020-09-22 16:57:21 +03:00
Ilya Goncharov
db90c9cc88 [Gradle, JS] Move from NpmVersions 2020-09-22 16:57:21 +03:00
Mikhael Bogdanov
7d4a734791 Fix nullability of typePath parameter
#KT-41484 Fixed
2020-09-22 15:37:02 +02:00
Dmitry Petrov
0539b2b389 Mute some FIR->JVM_IR box tests
FIR generates delegated class members incorrectly (with non-substituted
signatures).
2020-09-22 16:32:27 +03:00
Dmitry Petrov
c03573fc18 JVM_IR fix override equivalence check for collection stub generation
KT-42043 KT-42033
2020-09-22 15:26:34 +03:00
Pavel Kirpichenkov
fdc134ff66 [NI] Use compatibility mode for KT-41934 2020-09-22 15:06:12 +03:00
Pavel Kirpichenkov
1465e10f12 Add language feature for inference compatibility mode
The feature is intended for updates in the inference algorithm
that change behaviour compared to the previous stable version.
2020-09-22 15:06:12 +03:00
Pavel Kirpichenkov
896fbbd1a3 [NI] Add extra ordering for ready-for-fixation variables
Helps fixing to more specific type in the following situations:
Type1 <: Var1
Var2 <: Var1
Var2 <: Type2

Type1 and Type2 may also be nullable and non-nullable versions of the same type.
Note that no additional constraints can be inferred from such constraints before fixation.
Resulting types for variables will always Type1 and Type2 may also be nullable and non-nullable versions of the same type.
Fixing Var1 first will make Var2's type more specific while fixing Var2 first
will make Var1's type less specific. The first is preferrable in general.
2020-09-22 15:06:12 +03:00
Kirill Shmakov
ec8465859c Support rerun of MPP tests for jvm target 2020-09-22 14:44:22 +03:00
Kirill Shmakov
23642d2f86 Support rerun of common MPP tests
This is to fix #KT-36909
2020-09-22 14:44:19 +03:00
Toshiaki Kameyama
c09c0468d4 Replace deprecated symbol usage: move named lambda argument outside parentheses
#KT-31523 Fixed
2020-09-22 10:51:36 +02:00
Toshiaki Kameyama
d9cf4ee732 Add intention to evaluate compile time expression
#KT-40251 Fixed
2020-09-22 10:46:54 +02:00
Mark Punzalan
8cac3f654c [FIR] Handle pre/postfix dec/increment of labeled expression 2020-09-22 11:06:27 +03:00
Mark Punzalan
f55ff8eb1b [FIR] Capture receiver for pre/postfix dec/increment of qualified access
This prevents double-evaluation of the receiver expression, which may
have side-effects. E.g.: a.b++
2020-09-22 10:20:46 +03:00
Mikhail Glukhikh
393189db8d FIR JVM serializer: fix compilation after rebase 2020-09-22 09:54:43 +03:00
pyos
6e143a2656 JVM_IR: collect free type parameters when serializing FIR metadata
The "free" in "createFreeFakeLambdaDescriptor" and such refers to the
fact that there are no references to type parameters from outside the
current declaration. This is necessary because at the point where the
metadata is written, the type parameters may not even be in scope (e.g.
local delegated properties are serialized at class level, but may refer
to function-scope type parameters).
2020-09-22 09:35:50 +03:00
pyos
aa58ed9234 JVM_IR: partially implement FIR local delegated property reflection
Type parameter references are broken, just like for lambdas. Also, the
code is super ugly.
2020-09-22 09:35:45 +03:00
Alexander Udalov
6f622920e7 Minor, deduplicate matching JVM_OLD/JVM_IR duplicateJvmSignature tests 2020-09-21 18:49:36 +02:00
Mads Ager
05c662ec55 [JVM_IR] Remove line numbers from delegated member functions.
This fixes smart step into for delegated member functions.
Additionally, we align on the string "memberFunctionName(...)"
for expression non-null checks for both JVM_IR and JVM
backends.
2020-09-21 18:49:08 +02:00
Leonid Startsev
eea4ff33a0 Adapt serialization exceptions constructor calls to signature change
(see https://github.com/Kotlin/kotlinx.serialization/pull/1054)
2020-09-21 17:10:12 +03:00
Leonid Startsev
fe5dbf75fa Add diagnostic to check whether provided custom serializer matches
type of the property.

Check for serializer type mismatch only when custom serializer is present

Otherwise, there are too many false positives on e.g. PolymorphicSerializer

#KT-36329 Fixed

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/830
2020-09-21 17:10:12 +03:00
Leonid Startsev
bc432ecb85 Improve remove/specify type intentions in Explicit API mode
Do not suggest to remove type for public declarations

 #KT-38915 Fixed

Do not show intention to specify type when corresponding quickfix is available

 #KT-39026 Fixed
2020-09-21 17:10:10 +03:00
Leonid Startsev
5f0e7c3c3f Check return type of internal @PublishedApi functions in Explicit API mode
#KT-38981 Fixed
2020-09-21 17:03:06 +03:00
Mikhail Glukhikh
a9972913a6 [FIR TEST] Add some FIR_IDENTICAL to fix recently changed tests 2020-09-21 16:20:37 +03:00
Andrey Uskov
c9054e7a04 Added possibility to split gradle-integration-tests locally
Added property `gradle.integration.tests.split.tasks` for splitting
gradle-integration-tests into several tasks locally (like it happens
at TeamCity)
2020-09-21 13:34:32 +03:00
Andrey Uskov
d151f0e573 Fixed splitting gradle tests into different tasks 2020-09-21 13:34:25 +03:00
Dmitry Savvinov
769c741d87 Revert "Pack jvm builtins into kotlin-stdlib shipped with idea plugin"
This reverts commit 0b5aedb0a2.
2020-09-18 17:30:44 +03:00
Dmitry Savvinov
6db70bb97d Minor: fix forgotten testdata after 6a55475392 2020-09-18 16:42:49 +03:00
Ilya Gorbunov
0b5aedb0a2 Pack jvm builtins into kotlin-stdlib shipped with idea plugin
This lessens the possibility that kotlin plugin will get different
variants of builtins in the classpath, thus making builtins resources
loading less order-dependent.
2020-09-18 15:11:45 +03:00
Leonid Startsev
f2cf64aec7 Create plugin context before launching actual psi2ir process.
Because IrPluginContextImpl constructor creates new instance of
BuiltinSymbolsBase (with symbols for stdlib declarations like `arrayOf` etc),
there should be at least one pass of `declareUnboundSymbolsAsDependencies`
between creation and usage in plugin. Such pass is located between psi2ir
and compiler plugins application. If plugin context is created inside lambda,
right before plugins are applied, the symbols will remain unbound.

 #KT-41764 Fixed
2020-09-18 14:58:38 +03:00
Dmitry Petrov
ee3ada4e55 JVM_IR KT-40304 KT-41998 special handling for 'removeAt' 2020-09-18 14:27:36 +03:00
Kirill Shmakov
9008944860 Use target of the test in rerun dialog
This is to fix #KT-37799
2020-09-18 13:15:41 +03:00
Ilmir Usmanov
b406022315 Mark Unit unspillable if it is merged with unspillable Unit
#KT-42004: Fixed
2020-09-17 23:23:14 +02:00
Alexander Udalov
f6e4705d9c Regenerate KotlinSteppingTestGenerated 2020-09-17 22:16:47 +02:00
Mads Ager
a62ffbf992 [JVM_IR] Ignore fwBackingField stepping test.
The test relies on fixes not yet landed, so it currently fails.
2020-09-17 22:14:30 +02:00
Georgy Bronnikov
8343ca093c IR: bugfix in wrapped, IR-based descriptors 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
c2bdedfbae JVM_IR: remove descriptor usage from JvmSignatureClashDetector 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
c7f10c272a JVM_IR: remove .toKotlinType() from PromisedValue 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
7c5e255fa3 JVM_IR: remove .toKotlinType() from IrInlineIntrinsicsSupport 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
991a832d8c JVM_IR: remove KotlinType reference from jvm/ir/IrUtils.kt 2020-09-17 19:16:03 +03:00
Georgy Bronnikov
3c0fbd5f45 IR: remove .toKotlinType() usage from coerceToUnit calls in lowerings 2020-09-17 19:16:03 +03:00
Dmitry Savvinov
6a55475392 Dont show warning for KT-21515 with LV>=1.3 2020-09-17 18:33:19 +03:00
Dmitriy Novozhilov
57ceb0fa20 [FIR] Don't create call to this in generated provideDelegate for top-level extension properies 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
a666eee67b [FIR] Properly deserialize annotations on typealias and underlying type 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
748049daa3 [FIR] Don't call inline lambda twice in withFullBodyResolve 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
f9de2621b2 [FIR] Minor, fix TODO in constantValues
KT-8507
2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
535de7bdc8 [FIR] Cleanup code of FirTypeDeserializer.kt 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
8deab3559e [FIR] Get rid of FirDeserializationComponents 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
d4cc98fab1 [FIR] Safe VersionRequirementTable in deserialized declarations 2020-09-17 17:23:26 +03:00
Dmitriy Novozhilov
7c5160a968 [FIR] Remove meaningless TODO's 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
73c8059884 [FIR] Properly deserialize arrays in annotation arguments 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
ae819ff059 [FIR] Add configurable typeRef to FirArrayOfCallBuilder 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
d4891cb464 [FIR] Move Jsr305State from FirSession to separate component 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
93d63f7c66 [FIR] Get rid of FirResolvedFunctionTypeRef 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
edab50ac61 [FIR] Get rid of FirResolvedTypeRef.isSuspend 2020-09-17 17:23:25 +03:00
Dmitriy Novozhilov
6c5cf8eda3 [FIR] Cleanup code in body resolve 2020-09-17 17:23:24 +03:00
Dmitriy Novozhilov
d4038f35b6 [FIR] Make BodyResolveComponents an abstract class 2020-09-17 17:23:24 +03:00
Ilmir Usmanov
dfd7f33bd3 Minor. Add test with reified type parameter 2020-09-17 16:14:07 +02:00
Ilmir Usmanov
9ecf5dc9af Support is/as operations on suspend callable reference conversion 2020-09-17 16:14:04 +02:00
Vladimir Dolzhenko
dfe6c42f63 Remove 203 version from idea range for kotlin plugin 1.4.20
^KT-41976 Fixed
2020-09-17 11:58:46 +02:00
Vladimir Dolzhenko
985f2b839c Add regression tests to cover Unused symbol with private anonymous object property
^KT-39454 Fixed
2020-09-17 11:54:53 +02:00
Jinseong Jeon
d1ba69044e FIR: update the type of anonymous function as SAM 2020-09-17 12:45:26 +03:00
Ilmir Usmanov
f960201f52 Ignore type parameters of inline class
when checking whether we can return unboxed inline class
from suspend function
2020-09-17 11:20:48 +02:00
Dmitry Petrov
fbfe56e0cc JVM_IR KT-41915 compare Kotlin signatures when adding collection stubs 2020-09-17 11:37:29 +03:00
Toshiaki Kameyama
0e4bd70c29 Redundant nullable return type: fix false positive with elvis return
#KT-41878 Fixed
2020-09-17 09:49:02 +02:00
Vladimir Dolzhenko
51d405e950 Add json output for IDE performance tests 2020-09-17 08:57:08 +02:00
Jinseong Jeon
72dea05854 FIR2IR: approximate type argument if reified 2020-09-17 09:43:46 +03:00
Jinseong Jeon
721248f883 FIR: migrate type-related utils to relevant file 2020-09-17 09:32:52 +03:00
Mikhail Glukhikh
0436a555d5 [FIR serializer] Support type approximation
Before this commit we relied on a fact that exotic types aren't
possible at serialization stage. However, in non-ABI mode we can get
even a private function (e.g. top-level private), so we have to perform
this approximation.
2020-09-17 09:19:34 +03:00
Mikhail Glukhikh
94a30ff904 [FIR] Drop redundant type check 2020-09-17 09:16:00 +03:00
Roman Artemev
4da7e762fe [IR] Skip hidden parameters in WrappedDescriptors 2020-09-17 00:57:17 +03:00
Roman Artemev
1da2830e2b [IR] Support hidden parameters in ir builder 2020-09-17 00:57:16 +03:00
Roman Artemev
b84084d54e [IR] Support hidden parameters in IrMangler
- make them be skipped in signature
2020-09-17 00:57:16 +03:00
Roman Artemev
8209b70a2f [KLIB] Support isHidden flag in deserialization 2020-09-17 00:57:16 +03:00
Roman Artemev
83d6255294 [KLIB] Support isHidden in proto flags 2020-09-17 00:57:16 +03:00
Roman Artemev
f01941d1dd [IR] Support isHidden is IrFactory API
- add API to create a hidden value parameter
2020-09-17 00:57:16 +03:00
Roman Artemev
79e2886da1 [IR] Add isHidden flag into IrValueParameter 2020-09-17 00:57:15 +03:00
Ilya Kirillov
be16fa76ab Wizard: fix not auto-updated artifactId on project name change
#KT-41695 fixed
2020-09-17 00:29:48 +03:00
Ilya Kirillov
ca3b327592 Wizard: add missing jvm target version for tests in Groovy DSL
#KT-41958 fixed
2020-09-17 00:29:48 +03:00
Ilya Kirillov
ee2f0f45fc Wizard: ignore Kotlin repo in tests
They may differ sometimes as they depend on the latest Kotlin release
2020-09-17 00:29:47 +03:00
pyos
9b157fd291 JVM_IR: remove a descriptor-related hack from InterfaceLowering
It will break with FIR.
2020-09-16 18:58:40 +02:00
pyos
dd913ef450 JVM_IR: move common metadata serialization code to ClassCodegen 2020-09-16 18:58:40 +02:00
pyos
a06181771f IR: make DescriptorMetadataSource a subtype of MetadataSource
FirMetadataSource is a metadata source too.
2020-09-16 18:58:40 +02:00
Alexander Udalov
86cc5840ed JVM IR: unmute stepping test noParameterExtensionLambdaArgumentCallInInline3.kt
Bytecode generated by JVM IR ensures that on multiline expressions,
every call is stepped over, which seems better than in the old backend.

Also remove kt34905.kt since it duplicates this test case.
2020-09-16 17:52:27 +02:00
Alexander Udalov
0cccc61654 JVM IR: unmute stepping test smartStepIntoInterfaceImpl.kt
The only difference seems to be that step into IImpl.fooOverride is
actually supported in JVM_IR. Also fix slightly incorrect line numbers
in the comments.
2020-09-16 17:52:27 +02:00
Mads Ager
e943d76266 [JVM_IR] Rebase fwBackingField stepping test.
The difference is that JVM_IR generates line numbers for the
constructor field initialization.

In this case:

```
29: class B {
30:   // comment
31:   val bPropVal: Int,
32:   // comment
33:   var bProbVar: Int
34: ) {
```

the line numbers for the field initializations are 31 and 33 where
in the current backend the whole constructor has line number 29.
2020-09-16 17:51:22 +02:00
Лихолетов Михаил
cfc1ebb4be [FIR] Support several annotation argument diagnostics 2020-09-16 16:53:31 +03:00
Mikhail Glukhikh
0c13d3197c [FIR] Fix non-serializable type argument at the end of resolve 2020-09-16 16:53:29 +03:00
Dmitry Petrov
54d5494ecd JVM_IR special handling for 'remove' collection method stub 2020-09-16 15:36:16 +03:00
Kirill Shmakov
e6e47f8848 Make watchOS test runnable on another bitness 2020-09-16 14:58:28 +03:00
Alexey Tsvetkov
c56952a01e Provide message collector for Java IC analysis
#KT-37446 Fixed
2020-09-16 14:04:51 +03:00
Victor Petukhov
17db188b0e Add regression test for already fixed issue KT-41396 2020-09-16 14:02:32 +03:00
Alexander Anisimov
5e46e5355d Merge pull request #3706 from 1anisim/patch-2
Update ReadMe.md
2020-09-16 13:59:12 +03:00
Igor Yakovlev
57ebd0e13a [FIR IDE] Remove unused code and add logging to LightClassProvider
Remove not used icons from independed icons provider
Add class logging to KotlinUsageTypeProvider
Remove redundant comments from LightClassProvider
2020-09-16 10:47:47 +03:00
Igor Yakovlev
be4fcd626c [FIR IDE] Separate searchers from descriptor usage
KotlinConstructorDelegationCallReferenceSearcher
KotlinConventionMethodReferencesSearcher
KotlinDefinitionsSearcher
KotlinOverridingMethodReferenceSearcher
KotlinPropertyAccessorsReferenceSearcher
KotlinTodoSearcher
2020-09-16 10:47:47 +03:00
Abduqodiri Qurbonzoda
36e6247125 Add more details about bit shift operations #KT-41112 2020-09-16 04:05:12 +03:00
Abduqodiri Qurbonzoda
1c0ac850e8 Incorrect documentation for rangeTo function #KT-41356 2020-09-16 04:05:12 +03:00
Steven Schäfer
56c4a27887 Android Synthetics: Resolve unbound symbols in the AndroidIrExtension 2020-09-15 22:36:50 +02:00
Steven Schäfer
fe466f3dc6 Android Synthetics: Update test infrastructure 2020-09-15 22:36:50 +02:00
Alexander Udalov
fb183ec3f8 Never use JVM IR to compile coroutines-experimental
JVM IR backend doesn't support old coroutines, so we disable it via
-Xno-use-ir, just as for the main source set. This option has no effect
for the current master builds, but will be necessary once JVM IR is
enabled project-wide.
2020-09-15 19:59:14 +02:00
Alexander Udalov
f6187b9d64 Remove dependency of fir:tree:tree-generator on kotlin-reflect
This dependency was unused. It allows to avoid waiting for compiling
kotlin-reflect (which includes descriptors, deserialization, etc.)
before compiling FIR modules and thus improves total build time.
2020-09-15 19:59:14 +02:00
Ilmir Usmanov
58146c4452 Keep DebugMetadata annotation when regenerate lambda with state-machine
When a suspend lambda does not capture crossinline lambda, it is
generated with as state-machine, since it does not inline anything.
However, when regenerating, the inliner used to remove all DebugMetadata
annotations to avoid duplication. This lead to missing annotation if
the lambda is regenerated, but state-machine is not regenerated.
This change fixes the blind spot by readding the annotation after
regeneration.
 #KT-41789 Fixed
2020-09-15 19:57:02 +02:00
Kirill Shmakov
12489ef1b4 Show run test gutters only when appropriate
This is to fix KT-36370
2020-09-15 19:09:52 +03:00
Victor Petukhov
8cabfda832 Add regression test for already fixed issue KT-41885 2020-09-15 19:03:16 +03:00
Ivan Gavrilovic
7c360c0068 Kotlin Gradle plugin - use build service to share incremental compilation info
For large projects, incremental comilation mapping information may be quite
large. With configuration caching enabled, each task gets its own copy of that
state, and for a project with 1400 subprojects, this resulted in 3.6GB of additional
state stored (once task graph is cached).

This change introduces IncrementalModuleInfoProvider which allows build service
to be used if configuration caching is enabled, and it falls back to static
constant otherwise.
2020-09-15 15:19:56 +03:00
Igor Yakovlev
16d51eb510 [FIR IDE] Add ReadWriteAccessChecker FIR stub 2020-09-15 11:25:07 +03:00
Igor Yakovlev
7a19bc32a7 [FIR IDE] Add base implementation of find usages of overrides 2020-09-15 11:25:07 +03:00
Igor Yakovlev
f05630fcab [FIR IDE] Enabled search services and added services stubs 2020-09-15 11:25:07 +03:00
Igor Yakovlev
1a10275d0d [FIR IDE] Enabled usages services and added services stubs 2020-09-15 11:25:06 +03:00
Igor Yakovlev
75347d06b9 [FIR IDE] Move IconProvider in fir independed module 2020-09-15 11:25:06 +03:00
Igor Yakovlev
e30f09d513 [FIR IDE] Separate find usages logic from descriptors 2020-09-15 11:25:06 +03:00
Pavel Kirpichenkov
b102042dd8 Minor: add regression test for KT-41806 2020-09-15 10:52:47 +03:00
Jinseong Jeon
2fad935ce2 FIR deserializer: load inline/external flags properly 2020-09-15 10:21:35 +03:00
Sergey Bogolepov
2154c94100 [Native] Add tests for resolvable properties 2020-09-15 13:54:10 +07:00
Sergey Bogolepov
5a0a853d9b [Native] Add simple symbol mechanism to konan.properties
Java Properties format is extremely trivial and does not support any
kind of references or variables. It makes konan.properties repetitive.
This commits adds support of perl-like `$` sigil which allows to
reference properties inside values.
2020-09-15 13:54:09 +07:00
Pavel Punegov
fc35b5398c Mute test in Native 2020-09-14 23:41:47 +03:00
Nikita Bobko
0b2d05ee30 Minor: dereference archiveFile when logging it
Previously it was "Plugin artifacts packed to task ':zipPlugin' property 'archiveFile'"
After fix it's    "Plugin artifacts packed to /home/bobko/jb/kotlin/build/kotlin-plugin.zip"

`archiveFile` has type `Provider<RegularFile>`
2020-09-14 21:37:09 +03:00
Aleksei Cherepanov
c64c319231 JPS. Suppress "Add new files to git" during portable artifacts extraction 2020-09-14 19:06:43 +03:00
Roman Golyshev
7e2269a3cf Update completion-ranking-kotlin dependency (0.1.2 -> 0.1.3) 2020-09-14 15:19:36 +00:00
Mikhail Glukhikh
97ebf2867a [FIR] Get rid of type mismatch suppression during diagnostic casting 2020-09-14 18:08:33 +03:00
Mikhail Glukhikh
6fd3b011ca [FIR] Simplify substitution for unsafe-variant type parameter types
#KT-41792 Fixed
2020-09-14 18:08:31 +03:00
Mikhail Glukhikh
e1b4108e4a [FIR2IR] Mute some tests due to captured type problems 2020-09-14 18:08:30 +03:00
Mikhail Glukhikh
aa897db132 [FIR] Introduce UnsafeVariance attribute (see KT-41792) 2020-09-14 18:08:29 +03:00
Mikhail Glukhikh
e4aaae9ae7 FIR call completion: approximate type argument types
This commit removes some captured / ILT types at the end of resolve
2020-09-14 18:08:28 +03:00
Mikhail Glukhikh
3b828ac62b [FIR] Bad test data fixes (around captured types) 2020-09-14 18:08:27 +03:00
Mikhail Glukhikh
cf5480a398 [FIR] Questionable test data fixes (around captured types) 2020-09-14 18:08:26 +03:00
Mikhail Glukhikh
4605a65f41 [FIR] Good test data fixes (around captured types) 2020-09-14 17:56:39 +03:00
Mikhail Glukhikh
c2d9fc469a Get rid of exception at ConeKotlinType.varargElementType 2020-09-14 17:56:37 +03:00
Mikhail Glukhikh
2f61a2f56f [FIR] Provide correct comparison of captured types 2020-09-14 17:56:36 +03:00
Mikhail Glukhikh
b5f8fec213 FIR substitution: use standard approximation to remove captured types 2020-09-14 17:56:35 +03:00
Mikhail Glukhikh
7a73787680 [FIR] Use captureFromArguments in createSubstitution
This commit breaks ~57 resolve tests because captured types
now exists at the end of FIR resolve
2020-09-14 17:56:34 +03:00
Mikhail Glukhikh
e83f3bbf04 Introduce substitution to ConeTypeContext.captureFromArguments
This commit itself does not influence anything
2020-09-14 17:56:33 +03:00
Mikhail Glukhikh
414842343d [FIR2IR] Add another problematic test with captured type argument 2020-09-14 17:56:32 +03:00
Mikhail Glukhikh
267382d86b [FIR2IR] Add problematic test with incorrect type argument
NB: we should not have <E> as AbstractFirBasedSymbol type argument,
because it isn't accessible in the current scope. Star expected instead.
2020-09-14 17:56:30 +03:00
Dmitry Petrov
b395771d01 KT-37050 don't generate redundant special bridges
Loosely based on https://github.com/JetBrains/kotlin/pull/3662
2020-09-14 16:13:34 +03:00
Alexander Udalov
f0282bcfdf JVM IR: add module name for internal functions before "$default"
The change is a bit complicated because the name mapping logic is
refactored so that we would compute the needed suffix first (either
module name, or multifile part class name), and then shove it into the
mangled name between the original function name and "$default", if the
function in question is the default arguments adapter.

The main motivation for this change was to fix KT-41809, but as a side
effect, private functions with default arguments in multifile parts now
also contain the file name, just like normal private functions.

 #KT-41809 Fixed
2020-09-14 13:18:24 +02:00
Alexander Udalov
93f38e1c61 JVM IR: minor, use more specific types in MethodSignatureMapper 2020-09-14 13:18:24 +02:00
Alexander Udalov
2a0f64ebcb JVM IR: do not generate Deprecated(HIDDEN) class as synthetic
#KT-41810 Fixed
2020-09-14 13:18:24 +02:00
Ivan Gavrilovic
162dc3aa0c KT-41295: Friend paths and compiler options compatible with conf caching
This change fixes serialization of friend paths and it uses
a file collection to record all friend paths. Also, when
computing the tested classpath for android projects, we now avoid
resolving the file collection until necessary.

Fixes: KT-41295
Test: ConfigurationCacheForAndroidIT
2020-09-14 13:31:52 +03:00
Dmitriy Novozhilov
be916e556a [FIR] Properly update type of block after postponed analysis of it's content 2020-09-14 11:46:06 +03:00
Dmitriy Novozhilov
535898c8a4 [FIR] Fix processing integer operator calls for not integer types 2020-09-14 10:57:10 +03:00
Dmitriy Novozhilov
def647c094 [FIR] Don't constraints for return expressions of lambda if it has Unit return type 2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
8e0d0d2fd8 Remove redundant safe call to fix FIR compilation 2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
4929417aea Remove redundant type arguments to fix compilation with FIR
#KT-41835
2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
324aaaddad [FIR] Rename createArrayOf to createArrayType 2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
3b941a8f43 [FIR] Complete types of array literals in annotations 2020-09-14 10:57:09 +03:00
Dmitriy Novozhilov
fbe964c074 [FIR] Transform annotations on safe calls 2020-09-14 10:57:08 +03:00
Jinseong Jeon
0bd7de158c FIR: update suspend lambda type during declaration resolution 2020-09-14 10:20:45 +03:00
Jinseong Jeon
680dd64211 FIR2IR: pick return target based on matched IrFunction 2020-09-14 10:09:51 +03:00
Jinseong Jeon
6ebad9589a FIR2IR: set proper IR origin for iterator in ranges 2020-09-14 10:09:45 +03:00
Mikhail Glukhikh
578e707ab9 FIR2IR: set VARIABLE_AS_FUNCTION origin only for invoke receivers 2020-09-14 10:09:32 +03:00
Mikhail Glukhikh
f0a2a62405 [FIR2IR] Minor: coneTypeSafe -> coneType 2020-09-14 09:18:46 +03:00
Jinseong Jeon
89ffce22d8 FIR2IR: set proper IR origin for variable as function 2020-09-14 09:05:08 +03:00
Andrey Uskov
bf3a7e5fea Add more tasks in Gradle build for running GradleIT in parallel 2020-09-13 22:48:12 +03:00
Nikolay Krasko
a7f57646bf Prevent rebuilding by avoid registering doFirst on source tasks (KTI-324)
Do the check for empty directories at the build end instead.

Registering doFirst makes constant recompile when switching from Kotlin to Kotlin
Native composite with the reason:

```
The task was not up-to-date because of the following reasons:
One or more additional actions for task ':kotlin:kotlin-stdlib-common:compileKotlinCommon' have changed.
```

Exact reason why actions are different is not clear (there's a single
action in both builds in comparison), but probably the reason in
different types due to usage of composite build.

 #KTI-324 Fixed
2020-09-13 19:18:01 +03:00
Alexander Udalov
9250d86915 JVM IR: generate field for private companion object in interface as synthetic 2020-09-13 09:13:27 +02:00
Alexander Udalov
fc141a52da IR: minor, make IrClass.companionObject return IrClass 2020-09-13 09:13:26 +02:00
Alexander Udalov
2f86554d5a IR: don't produce fake overrides for static and private declarations
Note that only irrelevantStaticProperty.kt failed before this change.
Having private declarations caused no problems, but it seems incorrect,
so it's fixed now and irrelevantPrivateDeclarations is added just in
case.

 #KT-41848 Fixed
2020-09-12 20:01:34 +02:00
Roman Golyshev
703150e3ad FIR IDE: Refactor LowLevelFirApiFacade.kt 2020-09-12 11:49:36 +00:00
Roman Golyshev
edb277b30a FIR Completion: Enable passing tests 2020-09-12 11:49:36 +00:00
Roman Golyshev
dcc22d3e5d FIR IDE: Fix completion in property setters
Property consists of getter and setter (both optional). The setter
have a single `value` parameter with type

Because of it, we have to make a separate 'frankenstein setter' with
original resolved header, but with the body of the fake one

It seems that getters does not have such issues
2020-09-12 11:49:35 +00:00
Roman Golyshev
5c1520305b FIR IDE: Build symbols from any FirValueParameter 2020-09-12 11:49:35 +00:00
Roman Golyshev
ae8933dbd2 FIR IDE: Correctly handle properties in KtFirCompletionCandidateChecker
- Introduce `EnclosingDeclarationContext` to remove code duplication
2020-09-12 11:49:34 +00:00
Roman Golyshev
6fd871d0ba FIR IDE: Add building completion context for properties 2020-09-12 11:49:33 +00:00
Roman Golyshev
58965d1e71 FIR IDE: Implement RawFirBuilder::buildPropertyWithBody, add tests 2020-09-12 11:49:33 +00:00
Georgy Bronnikov
5f57311015 JVM_IR: remove .toKotlinType() from intrinsics.Equals 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
2c1735c211 JVM_IR: remove descriptor usage from JvmOptimizationLowering 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
a14c9018b1 JVM_IR: remove descriptor usage from SyntheticAccessorLowering 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
3327524e18 JVM_IR: remove descriptor usage from TypeAliasAnnotationMethodsLowering 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
905978a458 JVM_IR: remove descriptor usage from JvmCachedDeclarations 2020-09-12 12:59:12 +03:00
Georgy Bronnikov
92b03e7ede JVM_IR: Remove descriptor usage from IrSourceCompilerForInline 2020-09-12 12:59:03 +03:00
Georgy Bronnikov
0a66dbf2b5 JVM_IR: remove descriptor usage in CompareTo intrinsic 2020-09-12 12:58:29 +03:00
1anisim
b202cf0f55 Apply suggestions from code review
Co-authored-by: Alexander Udalov <udalov@users.noreply.github.com>
2020-09-10 15:30:33 +03:00
1anisim
33d3e1f13e Update ReadMe.md 2020-09-10 14:13:42 +03:00
1anisim
cf9f120d55 Update ReadMe.md
Added a section about Multiplatform Capabilities, highlighted KMM
2020-09-08 14:54:47 +03:00
19689 changed files with 696625 additions and 395319 deletions

9
.bunch
View File

@@ -1,7 +1,4 @@
201
202
203_202
193
as40_193
as41
as42_as41
201
as41_201
as42

3
.gitignore vendored
View File

@@ -59,3 +59,6 @@ node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-js-runner/lib/
local.properties
buildSrcTmp/
distTmp/
outTmp/

View File

@@ -101,4 +101,4 @@
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
</codeStyleSettings>
</code_scheme>
</component>
</component>

View File

@@ -10,6 +10,7 @@
<w>commonizers</w>
<w>commonizes</w>
<w>commonizing</w>
<w>interop</w>
<w>jetbrains</w>
<w>konan</w>
<w>kotlinx</w>

View File

@@ -0,0 +1,27 @@
<component name="ProjectDictionaryState">
<dictionary name="svyatoslav.kuzmich">
<words>
<w>anyfunc</w>
<w>copysign</w>
<w>eqref</w>
<w>exnref</w>
<w>externref</w>
<w>funcref</w>
<w>jetbrains</w>
<w>kotlinx</w>
<w>ktor</w>
<w>optref</w>
<w>popcnt</w>
<w>rotl</w>
<w>rotr</w>
<w>simd</w>
<w>sqrt</w>
<w>testsuite</w>
<w>uninstantiable</w>
<w>unlinkable</w>
<w>vtable</w>
<w>wabt</w>
<w>xopt</w>
</words>
</dictionary>
</component>

View File

@@ -10,7 +10,10 @@
<w>kapt</w>
<w>kotlinc</w>
<w>mutators</w>
<w>parcelable</w>
<w>parceler</w>
<w>parcelers</w>
<w>parcelize</w>
<w>repl</w>
<w>testdata</w>
<w>uast</w>

View File

@@ -453,4 +453,4 @@
<option name="ignoreNonEmtpyLoops" value="false" />
</inspection_tool>
</profile>
</component>
</component>

View File

@@ -10,7 +10,7 @@
</option>
<option name="taskNames">
<list>
<option value=":compiler:generateTests" />
<option value=":compiler:tests-for-compiler-generator:generateTests" />
<option value=":compiler:tests-java8:generateTests" />
<option value=":compiler:tests-against-klib:generateTests" />
<option value=":js:js.tests:generateTests" />
@@ -22,4 +22,4 @@
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<method />
</configuration>
</component>
</component>

View File

@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":compiler:fir:checkers:generateCheckersComponents" />
<option value=":idea:idea-frontend-fir:generateCode" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

10876
ChangeLog.md

File diff suppressed because it is too large Load Diff

View File

@@ -2,10 +2,14 @@
[![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/Kotlin_KotlinPublic_Compiler.svg)](https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_Compiler?branch=%3Cdefault%3E&buildTypeTab=overview&mode=builds)
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin/kotlin-maven-plugin.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.jetbrains.com/scans?search.rootProjectNames=Kotlin)
# Kotlin Programming Language
Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
Welcome to [Kotlin](https://kotlinlang.org/)!
It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/) and open-source contributors.
Some handy links:
* [Kotlin Site](https://kotlinlang.org/)
* [Getting Started Guide](https://kotlinlang.org/docs/tutorials/getting-started.html)
@@ -14,10 +18,21 @@ Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
* [Issue Tracker](https://youtrack.jetbrains.com/issues/KT)
* [Forum](https://discuss.kotlinlang.org/)
* [Kotlin Blog](https://blog.jetbrains.com/kotlin/)
* [Subscribe to Kotlin YouTube channel](https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw)
* [Follow Kotlin on Twitter](https://twitter.com/kotlin)
* [Public Slack channel](https://slack.kotlinlang.org/)
* [TeamCity CI build](https://teamcity.jetbrains.com/project.html?tab=projectOverview&projectId=Kotlin)
## Kotlin Multiplatform capabilities
Support for multiplatform programming is one of Kotlins key benefits. It reduces time spent writing and maintaining the same code for [different platforms](https://kotlinlang.org/docs/reference/mpp-supported-platforms.html) while retaining the flexibility and benefits of native programming.
* [Kotlin Multiplatform Mobile](https://kotlinlang.org/lp/mobile/) for sharing code between Android and iOS
* [Getting Started with Kotlin Multiplatform Mobile Guide](https://kotlinlang.org/docs/mobile/create-first-app.html)
* [Kotlin Multiplatform Benefits](https://kotlinlang.org/docs/reference/multiplatform.html)
* [Share code on all platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-all-platforms)
* [Share code on similar platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-similar-platforms)
## Editing Kotlin
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
@@ -44,8 +59,8 @@ You also can use [Gradle properties](https://docs.gradle.org/current/userguide/b
Note: The JDK 6 for MacOS is not available on Oracle's site. You can install it by
```bash
$ brew tap caskroom/versions
$ brew cask install java6
$ brew tap homebrew/cask-versions
$ brew install --cask java6
```
On Windows you might need to add long paths setting to the repo:
@@ -94,13 +109,13 @@ Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
### Building for different versions of IntelliJ IDEA and Android Studio
Kotlin plugin is intended to work with several recent versions of IntelliJ IDEA and Android Studio. Each platform is allowed to have a different set of features and might provide a slightly different API. Instead of using several parallel Git branches, project stores everything in a single branch, but files may have counterparts with version extensions (\*.as32, \*.172, \*.181). The primary file is expected to be replaced with its counterpart when targeting non-default platform.
Kotlin plugin is intended to work with several recent versions of IntelliJ IDEA and Android Studio. Each platform is allowed to have a different set of features and might provide a slightly different API. Instead of using several parallel Git branches, the project stores everything in a single branch, but files may have counterparts with version extensions (\*.as32, \*.172, \*.181). The primary file is expected to be replaced with its counterpart when targeting a non-default platform.
More detailed description of this scheme can be found at https://github.com/JetBrains/bunches/blob/master/ReadMe.md.
A More detailed description of this scheme can be found at https://github.com/JetBrains/bunches/blob/master/ReadMe.md.
Usually, there's no need to care about multiple platforms as all features are enabled everywhere by default. Additional counterparts should be created if there's an expected difference in behavior or an incompatible API usage is required **and** there's no reasonable workaround to save source compatibility. Kotlin plugin contains a pre-commit check that shows a warning if a file has been updated without its counterparts.
Development for some particular platform is possible after 'switching' that can be done with [Bunch Tool](https://github.com/JetBrains/bunches/releases) from the command line.
Development for some particular platform is possible after 'switching' that can be done with the [Bunch Tool](https://github.com/JetBrains/bunches/releases) from the command line.
```sh
cd kotlin-project-dir

View File

@@ -16,18 +16,24 @@
package org.jetbrains.kotlin.ant
import org.apache.tools.ant.types.Path
import org.apache.tools.ant.types.Reference
import org.apache.tools.ant.BuildException
import org.apache.tools.ant.taskdefs.Execute
import org.apache.tools.ant.taskdefs.Redirector
import org.apache.tools.ant.types.*
import java.io.File.pathSeparator
import java.io.File.separator
class Kotlin2JvmTask : KotlinCompilerBaseTask() {
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
var includeRuntime: Boolean = true
var includeRuntime: Boolean = false
var moduleName: String? = null
var noReflect: Boolean = false
private val cmdl = CommandlineJava()
var fork: Boolean = false
private var compileClasspath: Path? = null
fun setClasspath(classpath: Path) {
@@ -73,4 +79,47 @@ class Kotlin2JvmTask : KotlinCompilerBaseTask() {
if (noReflect) args.add("-no-reflect")
if (includeRuntime) args.add("-include-runtime")
}
override fun execute() {
if (!fork)
super.execute()
else {
exec()
}
}
private fun exec() {
val javaHome = System.getProperty("java.home")
val javaBin = javaHome + separator + "bin" + separator + "java"
val redirector = Redirector(this)
fillArguments()
val command = ArrayList<String>()
command.add(javaBin)
command.addAll(cmdl.vmCommand.arguments) // jvm args
command.add("-Dorg.jetbrains.kotlin.cliMessageRenderer=FullPath") // same MessageRenderer as non-forking mode
command.add("-cp")
command.add(KotlinAntTaskUtil.compilerJar.canonicalPath)
command.add(compilerFqName)
command.addAll(args) // compiler args
// streamHandler: used to handle the input and output streams of the subprocess.
// watchdog: a watchdog for the subprocess or <code>null</code> to disable a timeout for the subprocess.
// TODO: support timeout for the subprocess
val exe = Execute(redirector.createHandler(), null)
exe.setAntRun(getProject())
exe.commandline = command.toTypedArray()
log("Executing command: ${command.joinToString(" ")}", LogLevel.DEBUG.level)
log("Compiling ${src!!.list().toList()} => [${output!!.canonicalPath}]")
val exitCode = exe.execute()
redirector.complete()
if (failOnError && exitCode != 0) {
throw BuildException("Compile failed; see the compiler error output for details.")
}
}
fun createJvmarg(): Commandline.Argument {
return cmdl.createVmArgument()
}
}

View File

@@ -80,7 +80,7 @@ abstract class KotlinCompilerBaseTask : Task() {
fillSpecificArguments()
}
final override fun execute() {
override fun execute() {
fillArguments()
val compilerClass = KotlinAntTaskUtil.getOrCreateClassLoader().loadClass(compilerFqName)

View File

@@ -40,9 +40,7 @@ dependencies {
compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") }
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijPluginDep("java"))
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
}

View File

@@ -152,7 +152,7 @@ abstract class AbstractSimpleFileBenchmark {
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
val session = createSession(env, scope)
val firProvider = session.firProvider as FirProviderImpl
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, stubMode = false)
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)
val totalTransformer = FirTotalResolveProcessor(session)
val firFile = builder.buildFirFile(file).also(firProvider::recordFile)

View File

@@ -7,6 +7,7 @@ plugins {
dependencies {
compileOnly(project(":core:util.runtime"))
compileOnly(project(":compiler:backend.common.jvm"))
compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:cli-common"))
compileOnly(project(":compiler:frontend.java"))

View File

@@ -17,9 +17,6 @@ interface BuildMetaInfo {
val compilerBuildVersion: String
val languageVersionString: String
val apiVersionString: String
val coroutinesEnable: Boolean
val coroutinesWarn: Boolean
val coroutinesError: Boolean
val multiplatformEnable: Boolean
val metadataVersionMajor: Int
val metadataVersionMinor: Int
@@ -35,9 +32,6 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -53,9 +47,6 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
compilerBuildVersion = KotlinCompilerVersion.VERSION,
languageVersionString = languageVersion.versionString,
apiVersionString = args.apiVersion ?: languageVersion.versionString,
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
multiplatformEnable = args.multiPlatform,
ownVersion = OWN_VERSION,
coroutinesVersion = COROUTINES_VERSION,

View File

@@ -15,9 +15,6 @@ data class CommonBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -32,9 +29,6 @@ data class CommonBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -47,9 +41,6 @@ data class CommonBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -0,0 +1,12 @@
/*
* 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.build
import java.io.Serializable
enum class ExecutionStrategy : Serializable {
DAEMON, IN_PROCESS, OUT_OF_PROCESS
}

View File

@@ -15,9 +15,6 @@ data class JsBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -32,9 +29,6 @@ data class JsBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -47,9 +41,6 @@ data class JsBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
/**
@@ -27,9 +26,6 @@ data class JvmBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -47,9 +43,6 @@ data class JvmBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -62,9 +55,6 @@ data class JvmBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -0,0 +1,31 @@
/*
* 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.build
/**
* Bytecode version was in the Kotlin metadata ([Metadata.bytecodeVersion]) since 1.0, but it was never used meaningfully in the compiler,
* outside of one very special case regarding experimental coroutines, which is now obsolete. It is still used in incremental compilation
* caches though. We should probably just pretend that the bytecode version of any Kotlin file from now on is equal to the latest observed
* bytecode version, `1.0.3` (see [INSTANCE]).
*/
class JvmBytecodeBinaryVersion(vararg numbers: Int) {
val major: Int = numbers.getOrNull(0) ?: -1
val minor: Int = numbers.getOrNull(1) ?: -1
val patch: Int = numbers.getOrNull(2) ?: -1
override fun toString(): String = buildString {
append(major)
if (minor != -1) {
append(".$minor")
if (patch != -1) append(".$patch")
}
}
companion object {
@JvmField
val INSTANCE = JvmBytecodeBinaryVersion(1, 0, 3)
}
}

View File

@@ -0,0 +1,24 @@
/*
* 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.build.report
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.RemoteBuildMetricsReporter
open class BuildReporter(
protected open val icReporter: ICReporter,
protected open val buildMetricsReporter: BuildMetricsReporter
) : ICReporter by icReporter, BuildMetricsReporter by buildMetricsReporter
class RemoteBuildReporter(
override val icReporter: RemoteICReporter,
override val buildMetricsReporter: RemoteBuildMetricsReporter
) : BuildReporter(icReporter, buildMetricsReporter), RemoteReporter {
override fun flush() {
icReporter.flush()
buildMetricsReporter.flush()
}
}

View File

@@ -3,7 +3,7 @@
* 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.incremental
package org.jetbrains.kotlin.build.report
import org.jetbrains.kotlin.cli.common.ExitCode
import java.io.File
@@ -17,3 +17,5 @@ interface ICReporter {
fun reportMarkDirtyMember(affectedFiles: Iterable<File>, scope: String, name: String)
fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String)
}

View File

@@ -1,9 +1,9 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.incremental
package org.jetbrains.kotlin.build.report
import java.io.File

View File

@@ -0,0 +1,9 @@
/*
* 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.build.report
interface RemoteICReporter : ICReporter,
RemoteReporter

View File

@@ -0,0 +1,11 @@
/*
* 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.build.report
interface RemoteReporter {
fun flush()
}

View File

@@ -0,0 +1,37 @@
/*
* 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.build.report.metrics
import java.io.Serializable
enum class BuildAttributeKind : Serializable {
REBUILD_REASON;
companion object {
const val serialVersionUID = 0L
}
}
enum class BuildAttribute(val kind: BuildAttributeKind) : Serializable {
NO_BUILD_HISTORY(BuildAttributeKind.REBUILD_REASON),
CACHE_CORRUPTION(BuildAttributeKind.REBUILD_REASON),
UNKNOWN_CHANGES_IN_GRADLE_INPUTS(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNEXPECTED_PSI(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNKNOWN_QUALIFIER(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_REMOVED_ENTRY(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_IS_NOT_FOUND(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_CANNOT_BE_READ(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_NO_KNOWN_BUILDS(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_NON_INCREMENTAL_BUILD_IN_DEP(BuildAttributeKind.REBUILD_REASON),
IN_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
OUT_OF_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
IC_IS_NOT_ENABLED(BuildAttributeKind.REBUILD_REASON);
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,30 @@
/*
* 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.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildAttributes : Serializable {
private val myAttributes =
EnumMap<BuildAttribute, Int>(
BuildAttribute::class.java
)
fun add(attr: BuildAttribute, count: Int = 1) {
myAttributes[attr] = myAttributes.getOrDefault(attr, 0) + count
}
fun addAll(other: BuildAttributes) {
other.myAttributes.forEach { (attr, n) -> add(attr, n) }
}
fun asMap(): Map<BuildAttribute, Int> = myAttributes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,22 @@
/*
* 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.build.report.metrics
import java.io.Serializable
data class BuildMetrics(
val buildTimes: BuildTimes = BuildTimes(),
val buildAttributes: BuildAttributes = BuildAttributes()
) : Serializable {
fun addAll(other: BuildMetrics) {
buildTimes.addAll(other.buildTimes)
buildAttributes.addAll(other.buildAttributes)
}
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,28 @@
/*
* 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.build.report.metrics
interface BuildMetricsReporter {
fun startMeasure(metric: BuildTime, startNs: Long)
fun endMeasure(metric: BuildTime, endNs: Long)
fun addAttribute(attribute: BuildAttribute)
fun getMetrics(): BuildMetrics
fun addMetrics(metrics: BuildMetrics?)
}
inline fun <T> BuildMetricsReporter.measure(metric: BuildTime, fn: () -> T): T {
val start = System.nanoTime()
startMeasure(metric, start)
try {
return fn()
} finally {
val end = System.nanoTime()
endMeasure(metric, end)
}
}

View File

@@ -0,0 +1,47 @@
/*
* 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.build.report.metrics
import java.util.*
class BuildMetricsReporterImpl : BuildMetricsReporter {
private val myBuildTimeStartNs: EnumMap<BuildTime, Long> =
EnumMap(
BuildTime::class.java
)
private val myBuildTimes = BuildTimes()
private val myBuildAttributes = BuildAttributes()
override fun startMeasure(metric: BuildTime, startNs: Long) {
if (metric in myBuildTimeStartNs) {
error("$metric was restarted before it finished")
}
myBuildTimeStartNs[metric] = startNs
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
val startNs = myBuildTimeStartNs.remove(metric) ?: error("$metric finished before it started")
val durationNs = endNs - startNs
myBuildTimes.add(metric, durationNs)
}
override fun addAttribute(attribute: BuildAttribute) {
myBuildAttributes.add(attribute)
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
buildTimes = myBuildTimes,
buildAttributes = myBuildAttributes
)
override fun addMetrics(metrics: BuildMetrics?) {
if (metrics == null) return
myBuildAttributes.addAll(metrics.buildAttributes)
myBuildTimes.addAll(metrics.buildTimes)
}
}

View File

@@ -0,0 +1,43 @@
/*
* 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.build.report.metrics
import java.io.Serializable
@Suppress("Reformat")
enum class BuildTime(val parent: BuildTime? = null) : Serializable {
GRADLE_TASK,
CLEAR_OUTPUT(GRADLE_TASK),
BACKUP_OUTPUT(GRADLE_TASK),
RESTORE_OUTPUT_FROM_BACKUP(GRADLE_TASK),
CONNECT_TO_DAEMON(GRADLE_TASK),
CLEAR_JAR_CACHE(GRADLE_TASK),
RUN_COMPILER(GRADLE_TASK),
NON_INCREMENTAL_COMPILATION_IN_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_OUT_OF_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_DAEMON(RUN_COMPILER),
INCREMENTAL_COMPILATION(RUN_COMPILER),
IC_CALCULATE_INITIAL_DIRTY_SET(INCREMENTAL_COMPILATION),
IC_ANALYZE_CHANGES_IN_DEPENDENCIES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_FIND_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_CHANGES_IN_JAVA_SOURCES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_ANALYZE_CHANGES_IN_ANDROID_LAYOUTS(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_DETECT_REMOVED_CLASSES(IC_CALCULATE_INITIAL_DIRTY_SET),
CLEAR_OUTPUT_ON_REBUILD(INCREMENTAL_COMPILATION),
IC_UPDATE_CACHES(INCREMENTAL_COMPILATION),
INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
NON_INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
IC_WRITE_HISTORY_FILE(INCREMENTAL_COMPILATION);
companion object {
const val serialVersionUID = 0L
val children by lazy {
values().filter { it.parent != null }.groupBy { it.parent }
}
}
}

View File

@@ -0,0 +1,29 @@
/*
* 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.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildTimes : Serializable {
private val myBuildTimes = EnumMap<BuildTime, Long>(BuildTime::class.java)
fun addAll(other: BuildTimes) {
for ((bt, timeNs) in other.myBuildTimes) {
add(bt, timeNs)
}
}
fun add(buildTime: BuildTime, timeNs: Long) {
myBuildTimes[buildTime] = myBuildTimes.getOrDefault(buildTime, 0) + timeNs
}
fun asMap(): Map<BuildTime, Long> = myBuildTimes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -0,0 +1,25 @@
/*
* 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.build.report.metrics
object DoNothingBuildMetricsReporter : BuildMetricsReporter {
override fun startMeasure(metric: BuildTime, startNs: Long) {
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
}
override fun addAttribute(attribute: BuildAttribute) {
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
BuildTimes(),
BuildAttributes()
)
override fun addMetrics(metrics: BuildMetrics?) {}
}

View File

@@ -0,0 +1,11 @@
/*
* 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.build.report.metrics
import org.jetbrains.kotlin.build.report.RemoteReporter
interface RemoteBuildMetricsReporter : BuildMetricsReporter,
RemoteReporter

View File

@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.incremental
import com.intellij.util.io.EnumeratorStringDescriptor
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
import org.jetbrains.kotlin.metadata.deserialization.supertypes
@@ -34,12 +35,15 @@ interface IncrementalCacheCommon {
val thisWithDependentCaches: Iterable<AbstractIncrementalCache<*>>
fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName>
fun getSubtypesOf(className: FqName): Sequence<FqName>
fun getSupertypesOf(className: FqName): Sequence<FqName>
fun getSourceFileIfClass(fqName: FqName): File?
fun markDirty(removedAndCompiledSources: Collection<File>)
fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
fun getComplementaryFilesRecursive(dirtyFiles: Collection<File>): Collection<File>
fun updateComplementaryFiles(dirtyFiles: Collection<File>, expectActualTracker: ExpectActualTrackerImpl)
fun dump(): String
fun isSealed(className: FqName): Boolean?
}
/**
@@ -50,6 +54,7 @@ abstract class AbstractIncrementalCache<ClassName>(
protected val pathConverter: FileToPathConverter
) : BasicMapsOwner(workingDir), IncrementalCacheCommon {
companion object {
private val CLASS_ATTRIBUTES = "class-attributes"
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
@@ -71,6 +76,7 @@ abstract class AbstractIncrementalCache<ClassName>(
result
}
internal val classAttributesMap = registerMap(ClassAttributesMap(CLASS_ATTRIBUTES.storageFile))
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile, pathConverter))
@@ -90,6 +96,14 @@ abstract class AbstractIncrementalCache<ClassName>(
override fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
override fun getSupertypesOf(className: FqName): Sequence<FqName> {
return supertypesMap[className].asSequence()
}
override fun isSealed(className: FqName): Boolean? {
return classAttributesMap[className]?.isSealed
}
override fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
@@ -118,6 +132,7 @@ abstract class AbstractIncrementalCache<ClassName>(
supertypesMap[child] = parents
classFqNameToSourceMap[child] = srcFile
classAttributesMap[child] = ICClassesAttributes(ProtoBuf.Modality.SEALED == Flags.MODALITY.get(proto.flags))
}
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
@@ -152,14 +167,17 @@ abstract class AbstractIncrementalCache<ClassName>(
}
}
removedFqNames.forEach { classFqNameToSourceMap.remove(it) }
removedFqNames.forEach {
classFqNameToSourceMap.remove(it)
classAttributesMap.remove(it)
}
}
protected class ClassFqNameToSourceMap(
storageFile: File,
private val pathConverter: FileToPathConverter
) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
operator fun set(fqName: FqName, sourceFile: File) {
storage[fqName.asString()] = pathConverter.toPath(sourceFile)
}

View File

@@ -19,12 +19,14 @@ package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.supertypes
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.deserialization.getClassId
class ChangesCollector {
private val removedMembers = hashMapOf<FqName, MutableSet<String>>()
private val changedParents = hashMapOf<FqName, MutableSet<FqName>>()
private val changedMembers = hashMapOf<FqName, MutableSet<String>>()
private val areSubclassesAffected = hashMapOf<FqName, Boolean>()
@@ -47,6 +49,10 @@ class ChangesCollector {
changes.add(ChangeInfo.SignatureChanged(fqName, areSubclassesAffected))
}
for ((fqName, changedParents) in changedParents) {
changes.add(ChangeInfo.ParentsChanged(fqName, changedParents))
}
return changes
}
@@ -79,12 +85,12 @@ class ChangesCollector {
}
if (oldData == null) {
newData!!.collectAll(isRemoved = false, collectAllMembersForNewClass = collectAllMembersForNewClass)
newData!!.collectAll(isRemoved = false, isAdded = true, collectAllMembersForNewClass = collectAllMembersForNewClass)
return
}
if (newData == null) {
oldData.collectAll(isRemoved = true)
oldData.collectAll(isRemoved = true, isAdded = false)
return
}
@@ -98,6 +104,7 @@ class ChangesCollector {
collectSignature(oldData, diff.areSubclassesAffected)
}
collectChangedMembers(fqName, diff.changedMembersNames)
addChangedParents(fqName, diff.changedSupertypes)
}
is PackagePartProtoData -> {
collectSignature(oldData, areSubclassesAffected = true)
@@ -121,10 +128,11 @@ class ChangesCollector {
private fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>): Set<String> =
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
private fun ProtoData.collectAll(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) =
//TODO remember all sealed parent classes
private fun ProtoData.collectAll(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) =
when (this) {
is PackagePartProtoData -> collectAllFromPackage(isRemoved)
is ClassProtoData -> collectAllFromClass(isRemoved, collectAllMembersForNewClass)
is ClassProtoData -> collectAllFromClass(isRemoved, isAdded, collectAllMembersForNewClass)
}
private fun PackagePartProtoData.collectAllFromPackage(isRemoved: Boolean) {
@@ -143,7 +151,7 @@ class ChangesCollector {
}
}
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) {
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) {
val classFqName = nameResolver.getClassId(proto.fqName).asSingleFqName()
val kind = Flags.CLASS_KIND.get(proto.flags)
@@ -162,6 +170,23 @@ class ChangesCollector {
collectSignature(classFqName, areSubclassesAffected = true)
}
if (isRemoved || isAdded) {
collectChangedParents(classFqName, proto.supertypeList)
}
}
private fun addChangedParents(fqName: FqName, parents: Collection<FqName>) {
if (parents.isNotEmpty()) {
changedParents.getOrPut(fqName) { HashSet() }.addAll(parents)
}
}
private fun ClassProtoData.collectChangedParents(fqName: FqName, parents: Collection<ProtoBuf.Type>) {
val changedParentsFqNames = parents.map { type ->
nameResolver.getClassId(type.className).asSingleFqName()
}
addChangedParents(fqName, changedParentsFqNames)
}
private fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {

View File

@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.name.parentOrNull
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
import java.io.DataInput
import java.io.DataOutput
import java.io.File
@@ -326,7 +327,7 @@ private class ProtoDataProvider(private val serializerProtocol: SerializerExtens
proto.`package`.apply {
val packageNameId = getExtensionOrNull(serializerProtocol.packageFqName)
val packageFqName = packageNameId?.let { FqName(nameResolver.getPackageFqName(it)) } ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -347,7 +348,7 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
proto.`package`.apply {
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -412,4 +413,4 @@ private class PackageMetadataMap(storageFile: File) : BasicStringMap<ByteArray>(
operator fun get(packageName: String) = storage[packageName]
override fun dumpValue(value: ByteArray): String = "Package metadata: ${value.md5()}"
}
}

View File

@@ -94,6 +94,10 @@ open class IncrementalJvmCache(
fun sourcesByInternalName(internalName: String): Collection<File> =
internalNameToSource[internalName]
fun getAllPartsOfMultifileFacade(facade: JvmClassName): Collection<String>? {
return multifileFacadeToParts[facade]
}
fun isMultifileFacade(className: JvmClassName): Boolean =
className in multifileFacadeToParts
@@ -145,6 +149,7 @@ open class IncrementalJvmCache(
}
protoMap.remove(className, changesCollector)
classFqNameToSourceMap.remove(className.fqNameForClassNameWithoutDollars)
classAttributesMap.remove(className.fqNameForClassNameWithoutDollars)
internalNameToSource.remove(className.internalName)
// TODO NO_CHANGES? (delegates only)
@@ -271,6 +276,7 @@ open class IncrementalJvmCache(
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
return put(kotlinClass, changesCollector)
}
@@ -282,10 +288,12 @@ open class IncrementalJvmCache(
// from files compiled during last round.
// However there is no need to compare old and new data in this case
// (also that would fail with exception).
@Synchronized
fun storeModuleMapping(className: JvmClassName, bytes: ByteArray) {
storage[className.internalName] = ProtoMapValue(isPackageFacade = false, bytes = bytes, strings = emptyArray())
}
@Synchronized
private fun put(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val header = kotlinClass.classHeader
@@ -308,6 +316,7 @@ open class IncrementalJvmCache(
operator fun get(className: JvmClassName): ProtoMapValue? =
storage[className.internalName]
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -324,6 +333,8 @@ open class IncrementalJvmCache(
private inner class JavaSourcesProtoMap(storageFile: File) :
BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
@Synchronized
fun process(jvmClassName: JvmClassName, newData: SerializedJavaClass, changesCollector: ChangesCollector) {
val key = jvmClassName.internalName
val oldData = storage[key]
@@ -335,6 +346,7 @@ open class IncrementalJvmCache(
)
}
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -374,6 +386,7 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -390,6 +403,7 @@ open class IncrementalJvmCache(
}
}
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -415,6 +429,8 @@ open class IncrementalJvmCache(
private inner class MultifileClassFacadeMap(storageFile: File) :
BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
@Synchronized
operator fun set(className: JvmClassName, partNames: Collection<String>) {
storage[className.internalName] = partNames
}
@@ -425,6 +441,7 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -434,6 +451,8 @@ open class IncrementalJvmCache(
private inner class MultifileClassPartMap(storageFile: File) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
@Synchronized
fun set(partName: String, facadeName: String) {
storage[partName] = facadeName
}
@@ -441,6 +460,7 @@ open class IncrementalJvmCache(
fun get(partName: JvmClassName): String? =
storage[partName.internalName]
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -522,6 +542,7 @@ open class IncrementalJvmCache(
return result
}
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -547,6 +568,7 @@ open class IncrementalJvmCache(
private fun functionNameBySignature(signature: String): String =
signature.substringBefore("(")
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -568,6 +590,7 @@ sealed class ChangeInfo(val fqName: FqName) {
class SignatureChanged(fqName: FqName, val areSubclassesAffected: Boolean) : ChangeInfo(fqName)
class ParentsChanged(fqName: FqName, val parentsChanged: Collection<FqName>) : ChangeInfo(fqName)
protected open fun toStringProperties(): String = "fqName = $fqName"

View File

@@ -21,6 +21,7 @@ data class IncrementalModuleEntry(
class IncrementalModuleInfo(
val projectRoot: File,
val rootProjectBuildDir: File,
val dirToModule: Map<File, IncrementalModuleEntry>,
val nameToModules: Map<String, Set<IncrementalModuleEntry>>,
val jarToClassListFile: Map<File, File>,
@@ -28,6 +29,6 @@ class IncrementalModuleInfo(
val jarToModule: Map<File, IncrementalModuleEntry>
) : Serializable {
companion object {
private const val serialVersionUID = 0L
private const val serialVersionUID = 1L
}
}

View File

@@ -17,19 +17,18 @@
package org.jetbrains.kotlin.incremental
import com.intellij.util.containers.MultiMap
import com.intellij.util.containers.StringInterner
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.components.Position
import org.jetbrains.kotlin.incremental.components.ScopeKind
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.createStringInterner
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
import java.io.IOException
import java.util.*
open class LookupStorage(
targetDataDir: File,
pathConverter: FileToPathConverter
@@ -212,8 +211,8 @@ open class LookupStorage(
class LookupTrackerImpl(private val delegate: LookupTracker) : LookupTracker {
val lookups = MultiMap.createSet<LookupSymbol, String>()
val pathInterner = StringInterner()
private val interner = StringInterner()
val pathInterner = createStringInterner()
private val interner = createStringInterner()
override val requiresPosition: Boolean
get() = delegate.requiresPosition

View File

@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.build.JvmSourceRoot
import org.jetbrains.kotlin.build.isModuleMappingFile
import org.jetbrains.kotlin.build.report.ICReporter
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
@@ -31,6 +32,7 @@ import org.jetbrains.kotlin.progress.CompilationCanceledStatus
import org.jetbrains.kotlin.resolve.sam.SAM_LOOKUP_NAME
import org.jetbrains.kotlin.utils.addToStdlib.flattenTo
import java.io.File
import java.nio.file.Files
import java.util.*
import kotlin.collections.HashSet
import kotlin.collections.LinkedHashSet
@@ -66,7 +68,7 @@ fun makeModuleFile(
friendDirs
)
val scriptFile = File.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml")
val scriptFile = Files.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml").toFile()
scriptFile.writeText(builder.asText().toString())
return scriptFile
}
@@ -134,7 +136,8 @@ fun LookupStorage.update(
data class DirtyData(
val dirtyLookupSymbols: Collection<LookupSymbol> = emptyList(),
val dirtyClassesFqNames: Collection<FqName> = emptyList()
val dirtyClassesFqNames: Collection<FqName> = emptyList(),
val dirtyClassesFqNamesForceRecompile: Collection<FqName> = emptyList()
)
fun ChangesCollector.getDirtyData(
@@ -144,6 +147,9 @@ fun ChangesCollector.getDirtyData(
val dirtyLookupSymbols = HashSet<LookupSymbol>()
val dirtyClassesFqNames = HashSet<FqName>()
val sealedParents = HashMap<FqName, MutableSet<FqName>>()
val notSealedParents = HashSet<FqName>()
for (change in changes()) {
reporter.reportVerbose { "Process $change" }
@@ -168,10 +174,35 @@ fun ChangesCollector.getDirtyData(
}
fqNames.mapTo(dirtyLookupSymbols) { LookupSymbol(SAM_LOOKUP_NAME.asString(), it.asString()) }
} else if (change is ChangeInfo.ParentsChanged) {
fun FqName.isSealed(): Boolean {
if (notSealedParents.contains(this)) return false
if (sealedParents.containsKey(this)) return true
return isSealed(this, caches).also { sealed ->
if (sealed) {
sealedParents[this] = HashSet()
} else {
notSealedParents.add(this)
}
}
}
change.parentsChanged.forEach { parent ->
if (parent.isSealed()) {
sealedParents.getOrPut(parent) { HashSet() }.add(change.fqName)
}
}
}
}
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames)
val forceRecompile = HashSet<FqName>().apply {
addAll(sealedParents.keys)
//we should recompile all inheritors with parent sealed class: add known subtypes
addAll(sealedParents.keys.flatMap { withSubtypes(it, caches) })
//we should recompile all inheritors with parent sealed class: add new subtypes
addAll(sealedParents.values.flatten())
}
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames, forceRecompile)
}
fun mapLookupSymbolsToFiles(
@@ -215,6 +246,11 @@ fun mapClassesFqNamesToFiles(
return fqNameToAffectedFiles.values.flattenTo(HashSet())
}
fun isSealed(
fqName: FqName,
caches: Iterable<IncrementalCacheCommon>
): Boolean = caches.any { it.isSealed(fqName) ?: false }
fun withSubtypes(
typeFqName: FqName,
caches: Iterable<IncrementalCacheCommon>

View File

@@ -28,12 +28,14 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.util.*
data class Difference(
val isClassAffected: Boolean = false,
val areSubclassesAffected: Boolean = false,
val changedMembersNames: Set<String> = emptySet()
val changedMembersNames: Set<String> = emptySet(),
val changedSupertypes: Set<FqName> = emptySet()
)
sealed class ProtoData
@@ -187,6 +189,7 @@ class DifferenceCalculatorForClass(
var isClassAffected = false
var areSubclassesAffected = false
val changedSupertypes = HashSet<FqName>()
val names = hashSetOf<String>()
val classIsSealed = newProto.isSealed && oldProto.isSealed
@@ -247,12 +250,21 @@ class DifferenceCalculatorForClass(
ProtoBufClassKind.FLAGS,
ProtoBufClassKind.FQ_NAME,
ProtoBufClassKind.TYPE_PARAMETER_LIST,
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST,
ProtoBufClassKind.JS_EXT_CLASS_ANNOTATION_LIST -> {
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST -> {
isClassAffected = true
areSubclassesAffected = true
val oldSupertypes = oldProto.supertypeList.map { oldNameResolver.getClassId(it.className).asSingleFqName() }
val newSupertypes = newProto.supertypeList.map { newNameResolver.getClassId(it.className).asSingleFqName() }
val changed = (oldSupertypes union newSupertypes) subtract (oldSupertypes intersect newSupertypes)
changedSupertypes.addAll(changed)
}
ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME,
ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID -> {
// TODO
@@ -281,7 +293,7 @@ class DifferenceCalculatorForClass(
}
}
return Difference(isClassAffected, areSubclassesAffected, names)
return Difference(isClassAffected, areSubclassesAffected, names, changedSupertypes)
}
}

View File

@@ -30,6 +30,7 @@ open class BasicMapsOwner(val cachesDir: File) {
protected val String.storageFile: File
get() = File(cachesDir, this + "." + CACHE_EXTENSION)
@Synchronized
protected fun <K, V, M : BasicMap<K, V>> registerMap(map: M): M {
maps.add(map)
return map
@@ -47,6 +48,7 @@ open class BasicMapsOwner(val cachesDir: File) {
forEachMapSafe("flush") { it.flush(memoryCachesOnly) }
}
@Synchronized
private fun forEachMapSafe(actionName: String, action: (BasicMap<*, *>) -> Unit) {
val actionExceptions = LinkedHashMap<String, Exception>()
maps.forEach {
@@ -66,5 +68,6 @@ open class BasicMapsOwner(val cachesDir: File) {
}
@TestOnly
@Synchronized
fun dump(): String = maps.joinToString("\n\n") { it.dump() }
}

View File

@@ -17,9 +17,11 @@
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
import java.io.IOException
/**
@@ -30,7 +32,6 @@ class CachingLazyStorage<K, V>(
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
@@ -80,8 +81,10 @@ class CachingLazyStorage<K, V>(
try {
storage?.close()
} finally {
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
}
}
}

View File

@@ -0,0 +1,51 @@
/*
* 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.incremental.storage
import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.name.FqName
import java.io.DataInput
import java.io.DataOutput
import java.io.File
internal data class ICClassesAttributes(val isSealed: Boolean)
internal object ICClassesAttributesExternalizer : DataExternalizer<ICClassesAttributes> {
override fun read(input: DataInput): ICClassesAttributes {
return ICClassesAttributes(input.readBoolean())
}
override fun save(output: DataOutput, value: ICClassesAttributes) {
output.writeBoolean(value.isSealed)
}
}
internal open class ClassAttributesMap(
storageFile: File
) : BasicStringMap<ICClassesAttributes>(storageFile, ICClassesAttributesExternalizer) {
override fun dumpValue(value: ICClassesAttributes): String = value.toString()
operator fun set(key: FqName, value: ICClassesAttributes) {
storage[key.asString()] = value
}
operator fun get(key: FqName): ICClassesAttributes? = storage[key.asString()]
fun remove(key: FqName) {
storage.remove(key.asString())
}
}

View File

@@ -20,18 +20,18 @@ import org.jetbrains.kotlin.incremental.dumpCollection
import org.jetbrains.kotlin.name.FqName
import java.io.File
internal open class ClassOneToManyMap(
storageFile: File
) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
internal open class ClassOneToManyMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
override fun dumpValue(value: Collection<String>): String = value.dumpCollection()
@Synchronized
fun add(key: FqName, value: FqName) {
storage.append(key.asString(), listOf(value.asString()))
}
operator fun get(key: FqName): Collection<FqName> =
storage[key.asString()]?.map(::FqName) ?: setOf()
storage[key.asString()]?.map(::FqName) ?: setOf()
@Synchronized
operator fun set(key: FqName, values: Collection<FqName>) {
if (values.isEmpty()) {
remove(key)
@@ -41,10 +41,14 @@ internal open class ClassOneToManyMap(
storage[key.asString()] = values.map(FqName::asString)
}
@Synchronized
fun remove(key: FqName) {
storage.remove(key.asString())
}
// Access to caches could be done from multiple threads (e.g. JPS worker and RMI). The underlying collection is already synchronized,
// thus we need synchronization of this method and all modification methods.
@Synchronized
fun removeValues(key: FqName, removed: Set<FqName>) {
val notRemoved = this[key].filter { it !in removed }
this[key] = notRemoved

View File

@@ -25,8 +25,7 @@ internal class DirtyClassesJvmNameMap(storageFile: File) : AbstractDirtyClassesM
internal class DirtyClassesFqNameMap(storageFile: File) : AbstractDirtyClassesMap<FqName>(FqNameTransformer, storageFile)
internal abstract class AbstractDirtyClassesMap<Name>(
private val nameTransformer: NameTransformer<Name>,
storageFile: File
private val nameTransformer: NameTransformer<Name>, storageFile: File
) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
fun markDirty(className: Name) {
storage[nameTransformer.asString(className)] = true
@@ -37,10 +36,10 @@ internal abstract class AbstractDirtyClassesMap<Name>(
}
fun getDirtyOutputClasses(): Collection<Name> =
storage.keys.map { nameTransformer.asName(it) }
storage.keys.map { nameTransformer.asName(it) }
fun isDirty(className: Name): Boolean =
storage.contains(nameTransformer.asString(className))
storage.contains(nameTransformer.asString(className))
override fun dumpValue(value: Boolean) = ""
}

View File

@@ -0,0 +1,34 @@
/*
* 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.incremental.storage
import java.io.File
open class IncrementalFileToPathConverter(val rootProjectDir: File?) : FileToPathConverter {
//project root dir
private val projectDirPath = rootProjectDir?.normalize()?.absolutePath
override fun toPath(file: File): String {
val path = file.normalize().absolutePath
return when {
projectDirPath == null || !path.startsWith(projectDirPath) -> path
else -> PROJECT_DIR_PLACEHOLDER + path.substring(projectDirPath.length)
}
}
override fun toFile(path: String): File =
when {
rootProjectDir != null && path.startsWith(PROJECT_DIR_PLACEHOLDER) -> rootProjectDir.resolve(path.substring(PATH_PREFIX.length))
else -> File(path)
}
private companion object {
private const val PROJECT_DIR_PLACEHOLDER = "${'$'}PROJECT_DIR$"
//use only for prefix length because it OS dependent
private const val PATH_PREFIX = "$PROJECT_DIR_PLACEHOLDER/"
}
}

View File

@@ -17,9 +17,11 @@
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
import java.io.IOException
class NonCachingLazyStorage<K, V>(
@@ -27,7 +29,6 @@ class NonCachingLazyStorage<K, V>(
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
@@ -76,11 +77,12 @@ class NonCachingLazyStorage<K, V>(
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
} finally {
storage = null
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
}
}
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized

View File

@@ -1,106 +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.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.JpsPersistentHashMap
import java.io.File
class NonCachingLazyStorage<K, V>(
private val storageFile: File,
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: JpsPersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): JpsPersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
storage = createMap()
return storage
}
return null
}
@Synchronized
private fun getStorageOrCreateNew(): JpsPersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
override val keys: Collection<K>
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendDataWithoutCache(key, value)
}
@Synchronized
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
}
JpsPersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
override fun flush(memoryCachesOnly: Boolean) {
val existingStorage = storage ?: return
if (memoryCachesOnly) {
if (existingStorage.isDirty) {
existingStorage.dropMemoryCaches()
}
} else {
existingStorage.force()
}
}
@Synchronized
override fun close() {
storage?.close()
}
private fun createMap(): JpsPersistentHashMap<K, V> =
JpsPersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.build
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.junit.Assert.assertNotEquals
import org.junit.Test
@@ -34,10 +33,7 @@ class BuildMetaInfoTest : TestCase() {
"bytecodeVersionMinor",
"bytecodeVersionPatch",
"compilerBuildVersion",
"coroutinesEnable",
"coroutinesError",
"coroutinesVersion",
"coroutinesWarn",
"isEAP",
"languageVersionString",
"metadataVersionMajor",
@@ -71,14 +67,12 @@ class BuildMetaInfoTest : TestCase() {
@Test
fun testJvmEquals() {
val args1 = K2JVMCompilerArguments()
args1.coroutinesState = CommonCompilerArguments.ENABLE
val info1 = JvmBuildMetaInfo.create(args1)
val args2 = K2JVMCompilerArguments()
args2.coroutinesState = CommonCompilerArguments.WARN
val info2 = JvmBuildMetaInfo.create(args2)
assertNotEquals(info1, info2)
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
assertEquals(info1, info2)
assertEquals(info1, info2.copy())
}
}

View File

@@ -0,0 +1,62 @@
/*
* 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.incremental.storage
import org.jetbrains.kotlin.TestWithWorkingDir
import org.junit.Test
import java.io.File
internal class IncrementalFileToPathConverterTest : TestWithWorkingDir() {
val separator: String = File.separator
@Test
fun testPathTransform() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testComplicatedProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("first$separator..${separator}testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testInccorectProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir$separator"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testFileOutOfProject() {
val relativeFilePath = "..${separator}testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${workingDir.absolutePath}${separator}testFile.txt", transformedPath)
}
@Test
fun testFileWithExtraSlash() {
val relativeFilePath = "testFile.txt$separator"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}${separator}testFile.txt", transformedPath)
}
private fun testPathTransformation(projectRoot: File, relativeFilePath: String): String {
val pathConverter = IncrementalFileToPathConverter(projectRoot)
val testFile = projectRoot.resolve(relativeFilePath)
val transformedPath = pathConverter.toPath(testFile)
assertEquals(testFile.normalize().absolutePath, pathConverter.toFile(transformedPath).normalize().absolutePath)
return transformedPath
}
}

View File

@@ -22,12 +22,12 @@ data class BuildLogFinder(
private val isDataContainerBuildLogEnabled: Boolean = false,
private val isGradleEnabled: Boolean = false,
private val isJsEnabled: Boolean = false,
private val isJsIrEnabled: Boolean = false, // TODO rename as it is used for metadata-only test
private val isScopeExpansionEnabled: Boolean = false
private val isScopeExpansionEnabled: Boolean = false,
private val isKlibEnabled: Boolean = false
) {
companion object {
private const val JS_LOG = "js-build.log"
private const val JS_IR_LOG = "js-ir-build.log"
private const val KLIB_LOG = "klib-build.log"
private const val SCOPE_EXPANDING_LOG = "build-with-scope-expansion.log"
private const val GRADLE_LOG = "gradle-build.log"
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
@@ -43,7 +43,7 @@ data class BuildLogFinder(
val files = names.filter { File(dir, it).isFile }.toSet()
val matchedName = when {
isScopeExpansionEnabled && SCOPE_EXPANDING_LOG in files -> SCOPE_EXPANDING_LOG
isJsIrEnabled && JS_IR_LOG in files -> JS_IR_LOG
isKlibEnabled && KLIB_LOG in files -> KLIB_LOG
isJsEnabled && JS_LOG in files -> JS_LOG
isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG
isJsEnabled && JS_JPS_LOG in files -> JS_JPS_LOG

View File

@@ -151,29 +151,35 @@ private fun classFileToString(classFile: File): String {
val traceVisitor = TraceClassVisitor(PrintWriter(out))
ClassReader(classFile.readBytes()).accept(traceVisitor, 0)
val classHeader = LocalFileKotlinClass.create(classFile)?.classHeader
val classHeader = LocalFileKotlinClass.create(classFile)?.classHeader ?: return ""
if (!classHeader.metadataVersion.isCompatible()) {
error("Incompatible class ($classHeader): $classFile")
}
val annotationDataEncoded = classHeader?.data
if (annotationDataEncoded != null) {
ByteArrayInputStream(BitEncoding.decodeBytes(annotationDataEncoded)).use {
input ->
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.CLASS, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> {
ByteArrayInputStream(BitEncoding.decodeBytes(classHeader.data!!)).use { input ->
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
if (!classHeader.metadataVersion.isCompatible()) {
error("Incompatible class ($classHeader): $classFile")
}
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE ->
out.write("\n------ file facade proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.CLASS ->
out.write("\n------ class proto -----\n${DebugProtoBuf.Class.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART ->
out.write("\n------ multi-file part proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
else -> throw IllegalStateException()
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE ->
out.write("\n------ file facade proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.CLASS ->
out.write("\n------ class proto -----\n${DebugProtoBuf.Class.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART ->
out.write("\n------ multi-file part proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
else -> error(classHeader.kind)
}
}
}
KotlinClassHeader.Kind.MULTIFILE_CLASS -> {
out.write("\n------ multi-file facade data -----\n")
out.write(classHeader.data!!.joinToString("\n"))
}
KotlinClassHeader.Kind.SYNTHETIC_CLASS -> {
// Synthetic class has no metadata, thus there can be no differences in it.
}
KotlinClassHeader.Kind.UNKNOWN -> error("Should not meet unknown classes here: $classFile")
}
return out.toString()

View File

@@ -17258,6 +17258,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
boolean hasFlags();
@@ -17268,6 +17269,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
int getFlags();
@@ -17463,6 +17465,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public boolean hasFlags() {
@@ -17475,6 +17478,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public int getFlags() {
@@ -17894,6 +17898,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public boolean hasFlags() {
@@ -17906,6 +17911,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public int getFlags() {
@@ -17918,6 +17924,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public Builder setFlags(int value) {
@@ -17933,6 +17940,7 @@ public final class DebugProtoBuf {
*hasAnnotations
*Visibility
*isSecondary
*hasNonStableParameterNames
* </pre>
*/
public Builder clearFlags() {
@@ -18307,6 +18315,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
boolean hasFlags();
@@ -18325,6 +18334,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
int getFlags();
@@ -18723,6 +18733,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public boolean hasFlags() {
@@ -18743,6 +18754,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public int getFlags() {
@@ -19639,6 +19651,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public boolean hasFlags() {
@@ -19659,6 +19672,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public int getFlags() {
@@ -19679,6 +19693,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public Builder setFlags(int value) {
@@ -19702,6 +19717,7 @@ public final class DebugProtoBuf {
*isExternal
*isSuspend
*isExpect
*hasNonStableParameterNames
* </pre>
*/
public Builder clearFlags() {

View File

@@ -4656,7 +4656,8 @@ public final class DebugJvmProtoBuf {
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*
* <pre>
* isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
* first bit: isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
* second bit: is all-compatibility mode or not, 1 - yes, 0 - no
* </pre>
*/
public static final

View File

@@ -7,7 +7,7 @@ import proguard.gradle.ProGuardTask
buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
bootstrapKotlinRepo?.let(::maven)
@@ -27,9 +27,11 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("serialization", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.17.2")
}
}
@@ -50,7 +52,6 @@ pill {
excludedDirs(
"out",
"buildSrc/build",
"buildSrc/prepare-deps/android-dx/build",
"buildSrc/prepare-deps/intellij-sdk/build"
)
}
@@ -72,7 +73,7 @@ val kotlinVersion by extra(
} ?: buildNumber
)
val kotlinLanguageVersion by extra("1.4")
val kotlinLanguageVersion by extra("1.5")
allprojects {
group = "org.jetbrains.kotlin"
@@ -129,6 +130,7 @@ extra["JDK_18"] = jdkPath("1.8")
extra["JDK_9"] = jdkPath("9")
extra["JDK_10"] = jdkPath("10")
extra["JDK_11"] = jdkPath("11")
extra["JDK_15"] = jdkPath("15")
// allow opening the project without setting up all env variables (see KT-26413)
if (!kotlinBuildProperties.isInIdeaSync) {
@@ -164,20 +166,18 @@ extra["versions.jansi"] = "1.16"
extra["versions.jline"] = "3.3.1"
extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2"
extra["versions.ant"] = "1.10.7"
extra["versions.android"] = "2.3.1"
val coroutinesVersion = if (Platform[192].orHigher()) "1.3.7" else "1.1.1"
extra["versions.kotlinx-coroutines-core"] = coroutinesVersion
extra["versions.kotlinx-coroutines-jdk8"] = coroutinesVersion
extra["versions.kotlinx-coroutines-core"] = "1.3.8"
extra["versions.kotlinx-coroutines-jdk8"] = "1.3.8"
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0"
extra["versions.robolectric"] = "4.0"
extra["versions.org.springframework"] = "4.2.0.RELEASE"
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.2"
extra["versions.completion-ranking-kotlin"] = "0.1.3"
extra["versions.r8"] = "2.0.88"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
@@ -187,13 +187,14 @@ 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.4.20-dev-16314"
extra["versions.kotlin-native"] = "1.5-dev-17775"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val useJvmIrBackend by extra(project.getBooleanProperty("kotlin.build.useIR") ?: false)
val useJvmIrBackend by extra(project.kotlinBuildProperties.useIR)
val useJvmFir by extra(project.kotlinBuildProperties.useFir)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
@@ -229,6 +230,7 @@ extra["compilerModules"] = arrayOf(
":compiler:frontend",
":compiler:frontend.common",
":compiler:frontend.java",
":compiler:frontend:cfg",
":compiler:cli-common",
":compiler:ir.tree",
":compiler:ir.tree.impl",
@@ -271,6 +273,7 @@ extra["compilerModules"] = arrayOf(
":core:deserialization.common.jvm",
":core:compiler.common",
":core:compiler.common.jvm",
":compiler:backend.common.jvm",
":core:descriptors",
":core:descriptors.jvm",
":core:descriptors.runtime",
@@ -290,7 +293,9 @@ extra["compilerModules"] = arrayOf(
":compiler:fir:jvm",
":compiler:fir:checkers",
":compiler:fir:entrypoint",
":compiler:fir:analysis-tests"
":compiler:fir:analysis-tests",
":compiler:fir:analysis-tests:legacy-fir-tests",
":wasm:wasm.ir"
)
extra["compilerModulesForJps"] = listOf(
@@ -316,12 +321,24 @@ extra["compilerModulesForJps"] = listOf(
":compiler:compiler.version"
)
// TODO: fix remaining warnings and remove this property.
extra["tasksWithWarnings"] = listOf(
":kotlin-stdlib:compileTestKotlin",
":kotlin-stdlib-jdk7:compileTestKotlin",
":kotlin-stdlib-jdk8:compileTestKotlin",
":plugins:uast-kotlin:compileKotlin",
":plugins:uast-kotlin:compileTestKotlin"
)
val tasksWithWarnings: List<String> by extra
val coreLibProjects = listOfNotNull(
":kotlin-stdlib",
":kotlin-stdlib-common",
":kotlin-stdlib-js",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-test",
":kotlin-test:kotlin-test-annotations-common",
":kotlin-test:kotlin-test-common",
":kotlin-test:kotlin-test-jvm",
@@ -329,8 +346,7 @@ val coreLibProjects = listOfNotNull(
":kotlin-test:kotlin-test-junit5",
":kotlin-test:kotlin-test-testng",
":kotlin-test:kotlin-test-js".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlin-reflect",
":kotlin-coroutines-experimental-compat"
":kotlin-reflect"
)
val gradlePluginProjects = listOf(
@@ -339,7 +355,8 @@ val gradlePluginProjects = listOf(
":kotlin-allopen",
":kotlin-annotation-processing-gradle",
":kotlin-noarg",
":kotlin-sam-with-receiver"
":kotlin-sam-with-receiver",
":kotlin-parcelize-compiler"
)
apply {
@@ -403,8 +420,7 @@ allprojects {
jcenter()
maven(protobufRepo)
maven(intellijRepo)
maven("https://dl.bintray.com/kotlin/ktor")
maven("https://kotlin.bintray.com/kotlin-dependencies")
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)
@@ -441,6 +457,26 @@ allprojects {
if (useJvmIrBackend) {
useIR = true
}
if (useJvmFir) {
freeCompilerArgs += "-Xuse-fir"
freeCompilerArgs += "-Xabi-stability=stable"
}
}
}
if (!kotlinBuildProperties.isInJpsBuildIdeaSync && !kotlinBuildProperties.useFir && !kotlinBuildProperties.disableWerror) {
// For compiler and stdlib, allWarningsAsErrors is configured in the corresponding "root" projects
// (compiler/build.gradle.kts and libraries/commonConfiguration.gradle).
val projectsWithWarningsAsErrors = listOf("core", "plugins").map { File(it).absoluteFile }
if (projectsWithWarningsAsErrors.any(projectDir::startsWith)) {
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
if (path !in tasksWithWarnings) {
kotlinOptions {
allWarningsAsErrors = true
}
}
}
}
}
@@ -462,17 +498,7 @@ allprojects {
}
tasks.withType<Test> {
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true }
}
tasks.withType<SourceTask>().configureEach {
doFirst {
source.visit {
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
}
}
}
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
}
normalization {
@@ -534,16 +560,33 @@ 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"
val proguardMessage = "proguard is ${kotlinBuildProperties.proguard.toOnOff()}"
val jarCompressionMessage = "jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()}"
val profileMessage = "$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
"Use -Pteamcity=<true|false> to reproduce CI/local build"
logger.warn("\n\n$profileMessage")
logger.warn(
"$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
"Use -Pteamcity=<true|false> to reproduce CI/local build"
)
allTasks.filterIsInstance<org.gradle.jvm.tasks.Jar>().forEach { task ->
task.entryCompression = if (kotlinBuildProperties.jarCompression)
@@ -558,7 +601,7 @@ val dist = tasks.register("dist") {
}
val syncMutedTests = tasks.register("syncMutedTests") {
dependsOn(":compiler:tests-mutes:run")
dependsOn(":compiler:tests-mutes:tc-integration:run")
}
val copyCompilerToIdeaPlugin by task<Copy> {
@@ -588,7 +631,10 @@ tasks {
listOf("clean", "assemble", "install").forEach { taskName ->
register("coreLibs${taskName.capitalize()}") {
coreLibProjects.forEach { projectName -> dependsOn("$projectName:$taskName") }
for (projectName in coreLibProjects) {
if (projectName.startsWith(":kotlin-test:") && taskName == "install") continue
dependsOn("$projectName:$taskName")
}
}
}
@@ -619,6 +665,7 @@ tasks {
dependsOn("dist")
dependsOn(
":compiler:test",
":compiler:tests-common-new:test",
":compiler:container:test",
":compiler:tests-java8:test",
":compiler:tests-spec:test",
@@ -640,8 +687,11 @@ tasks {
}
register("wasmCompilerTest") {
// TODO: fix once
// dependsOn(":js:js.tests:wasmTest")
dependsOn(":js:js.tests:wasmTest")
// Windows WABT release requires Visual C++ Redistributable
if (!kotlinBuildProperties.isTeamcityBuild || !org.gradle.internal.os.OperatingSystem.current().isWindows) {
dependsOn(":wasm:wasm.ir:test")
}
}
register("nativeCompilerTest") {
@@ -652,6 +702,7 @@ tasks {
dependsOn(":compiler:fir:raw-fir:psi2fir:test")
dependsOn(":compiler:fir:raw-fir:light-tree2fir:test")
dependsOn(":compiler:fir:analysis-tests:test")
dependsOn(":compiler:fir:analysis-tests:legacy-fir-tests:test")
dependsOn(":compiler:fir:fir2ir:test")
}
@@ -661,6 +712,7 @@ tasks {
":compiler:fir:raw-fir:psi2fir:test",
":compiler:fir:raw-fir:light-tree2fir:test",
":compiler:fir:analysis-tests:test",
":compiler:fir:analysis-tests:legacy-fir-tests:test",
":compiler:fir:fir2ir:test",
":plugins:fir:fir-plugin-prototype:test"
)
@@ -696,7 +748,6 @@ tasks {
}
register("miscCompilerTest") {
dependsOn("wasmCompilerTest")
dependsOn("nativeCompilerTest")
dependsOn("firCompilerTest")
@@ -704,14 +755,18 @@ tasks {
dependsOn("scriptingTest")
dependsOn(":kotlin-build-common:test")
dependsOn(":compiler:incremental-compilation-impl:test")
dependsOn(":compiler:incremental-compilation-impl:testJvmICWithJdk11")
dependsOn(":core:descriptors.runtime:test")
dependsOn("jvmCompilerIntegrationTest")
dependsOn(":plugins:parcelize:parcelize-compiler:test")
}
register("toolsTest") {
dependsOn(":tools:kotlinp:test")
dependsOn(":native:kotlin-klib-commonizer:test")
dependsOn(":native:kotlin-klib-commonizer-api:test")
}
register("examplesTest") {
@@ -758,7 +813,6 @@ tasks {
if (Ide.IJ()) {
register("idea-new-project-wizard-tests") {
dependsOn("dist")
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
@@ -768,18 +822,38 @@ tasks {
}
register("idea-plugin-performance-tests") {
dependsOn("dist")
dependsOn(
":idea:performanceTests:performanceTest"
"dist",
":idea:performanceTests:performanceTest",
":idea:performanceTests:aggregateResults"
)
}
register("idea-fir-plugin-performance-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-fir-performance-tests:ideaFirPerformanceTest"
)
}
register("idea-fir-plugin-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-fir:test",
":idea:idea-frontend-api:test",
":idea:idea-frontend-fir:test",
":idea:idea-frontend-fir:idea-fir-low-level-api:test"
)
}
register("android-ide-tests") {
dependsOn("dist")
dependsOn(
":plugins:android-extensions-ide:test",
":idea:idea-android:test",
":kotlin-annotation-processing:test"
":kotlin-annotation-processing:test",
":plugins:parcelize:parcelize-ide:test"
)
}
@@ -811,12 +885,24 @@ tasks {
":generators:test"
)
if (Ide.IJ()) {
dependsOn("idea-new-project-wizard-tests")
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
)
}
}
register("ideaIntegrationsTests") {
if (Ide.IJ()) {
dependsOn(":idea:idea-new-project-wizard:test")
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
dependsOn(":kotlin-annotation-processing-base:test")
dependsOn(":kotlin-annotation-processing-cli:test")
}
register("gradleIdeTest") {
@@ -831,10 +917,11 @@ tasks {
":idea:idea-gradle:test",
":idea:test",
":compiler:test",
":compiler:container:test",
":js:js.tests:test"
)
if (Ide.IJ193.orHigher())
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
@@ -859,21 +946,26 @@ tasks {
}
}
register("publishGradlePluginArtifacts") {
idePluginDependency {
dependsOnKotlinGradlePluginPublish()
}
}
register("publishIdeArtifacts") {
idePluginDependency {
dependsOn(
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-dist-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:compiler-components-for-jps:publish",
":prepare:ide-plugin-dependencies:parcelize-compiler-plugin-for-ide:publish",
":kotlin-script-runtime:publish",
":kotlin-script-util:publish",
":kotlin-scripting-common:publish",
@@ -886,9 +978,7 @@ tasks {
":kotlin-stdlib-jdk7:publish",
":kotlin-stdlib-jdk8:publish",
":kotlin-reflect:publish",
":kotlin-main-kts:publish",
":kotlin-stdlib-js:publish",
":kotlin-test:kotlin-test-js:publish"
":kotlin-main-kts:publish"
)
}
}
@@ -955,7 +1045,7 @@ val zipPlugin by task<Zip> {
setExecutablePermissions()
doLast {
logger.lifecycle("Plugin artifacts packed to $archiveFile")
logger.lifecycle("Plugin artifacts packed to ${archiveFile.get()}")
}
}

View File

@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
extra["versions.native-platform"] = "0.14"
buildscript {
@@ -5,15 +7,15 @@ buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
extra["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
maven("https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-dependencies")
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
} else {
jcenter()
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
}
project.bootstrapKotlinRepo?.let {
@@ -22,7 +24,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -79,14 +81,12 @@ extra["intellijReleaseType"] = when {
else -> "releases"
}
extra["versions.androidDxSources"] = "5.0.0_r2"
extra["customDepsOrg"] = "kotlin.build"
repositories {
jcenter()
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
gradlePluginPortal()
extra["bootstrapKotlinRepo"]?.let {
@@ -97,8 +97,8 @@ repositories {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
implementation("com.gradle.publish:plugin-publish-plugin:0.11.0")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
@@ -112,6 +112,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("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
}
samWithReceiver {
@@ -126,6 +127,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += listOf(
"-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check", "-Xsuppress-version-warnings"
)
}
tasks["build"].dependsOn(":prepare-deps:build")
allprojects {

View File

@@ -255,9 +255,8 @@ fun buildIvyRepositoryTask(
inputs.files(configuration)
outputs.upToDateWhen {
configuration.resolvedConfiguration.resolvedArtifacts.single()
.moduleDirectory()
.exists()
val repoMarker = configuration.resolvedConfiguration.resolvedArtifacts.single().moduleDirectory().resolve(".marker")
repoMarker.exists()
}
doFirst {
@@ -266,8 +265,9 @@ fun buildIvyRepositoryTask(
artifact.storeDirectory().cleanStore()
if (moduleDirectory.exists()) {
logger.info("Path ${moduleDirectory.absolutePath} already exists, skipping unpacking.")
val repoMarker = File(moduleDirectory, ".marker")
if (repoMarker.exists()) {
logger.info("Path ${repoMarker.absolutePath} already exists, skipping unpacking.")
return@doFirst
}
@@ -326,6 +326,8 @@ fun buildIvyRepositoryTask(
)
}
}
repoMarker.createNewFile()
}
}
}

View File

@@ -14,13 +14,13 @@ pluginManagement {
buildscript {
repositories {
if (cacheRedirectorEnabled == 'true') {
maven { url "https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-dependencies" }
maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
} else {
maven { url "https://kotlin.bintray.com/kotlin-dependencies" }
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
}
}
@@ -46,12 +46,12 @@ if (target_AppCode_Clion) {
} else if (target_AndroidStudio) {
logger.info("Including modules for AS (mobile plugin) in buildSrc/settings.gradle")
include ":prepare-deps:cocoa-common-binaries"
include ":prepare-deps:appcode-binaries"
include ":prepare-deps:lldb-framework"
include ":prepare-deps:lldb-frontend"
project(":prepare-deps:cocoa-common-binaries").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/cocoa-common-binaries")
project(":prepare-deps:appcode-binaries").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/appcode-binaries")
project(":prepare-deps:lldb-framework").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/lldb-framework")
project(":prepare-deps:lldb-frontend").projectDir =
@@ -69,4 +69,4 @@ if (target_AppCode_Clion) {
} else {
logger.info("Not including extra modules in buildSrc/settings.gradle")
}
}

View File

@@ -18,3 +18,5 @@ val KotlinBuildProperties.proguard: Boolean get() = postProcessing && getBoolean
val KotlinBuildProperties.jarCompression: Boolean get() = getBoolean("kotlin.build.jar.compression", isTeamcityBuild)
val KotlinBuildProperties.ignoreTestFailures: Boolean get() = getBoolean("ignoreTestFailures", isTeamcityBuild)
val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", false)

View File

@@ -54,11 +54,12 @@ var Project.javaHome: String?
extra["javaHome"] = v
}
fun Project.generator(fqName: String, sourceSet: SourceSet? = null) = smartJavaExec {
fun Project.generator(fqName: String, sourceSet: SourceSet? = null, configure: JavaExec.() -> Unit = {}) = smartJavaExec {
classpath = (sourceSet ?: testSourceSet).runtimeClasspath
mainClass.set(fqName)
workingDir = rootDir
systemProperty("line.separator", "\n")
configure()
}
fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let {

View File

@@ -54,7 +54,7 @@ enum class Ide(val platform: Platform) : CompatibilityPredicate {
AS36(Platform.P192),
AS40(Platform.P193),
AS41(Platform.P201),
AS42(Platform.P201);
AS42(Platform.P202);
val kind = Kind.values().first { it.shortName == name.take(2) }
val version = name.dropWhile { !it.isDigit() }.toInt()

View File

@@ -71,18 +71,6 @@ fun Project.noDefaultJar() {
}
}
fun <T : Task> Project.runtimeJarArtifactBy(
task: TaskProvider<T>,
artifactRef: Any,
body: ConfigurablePublishArtifact.() -> Unit = {}
) {
addArtifact("archives", task, artifactRef, body)
addArtifact("runtimeJar", task, artifactRef, body)
configurations.findByName("runtime")?.let {
addArtifact(it.name, task, artifactRef, body)
}
}
fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> = runtimeJar(getOrCreateTask("jar", body)) { }
fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {}): TaskProvider<T> {
@@ -103,7 +91,11 @@ fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {})
body()
}
project.runtimeJarArtifactBy(task, task)
project.addArtifact("archives", task, task)
project.addArtifact("runtimeJar", task, task)
project.configurations.findByName("runtime")?.let {
project.addArtifact(it.name, task, task)
}
val runtimeJar = configurations.maybeCreate("runtimeJar").apply {
isCanBeConsumed = true

View File

@@ -9,10 +9,13 @@
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ExternalModuleDependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import java.io.File
@@ -112,6 +115,50 @@ fun DependencyHandler.projectTests(name: String): ProjectDependency = project(na
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
fun Project.testApiJUnit5(
vintageEngine: Boolean = false,
runner: Boolean = false,
suiteApi: Boolean = false
) {
with(dependencies) {
val platformVersion = commonVer("org.junit", "junit-bom")
testApi(platform("org.junit:junit-bom:$platformVersion"))
testApi("org.junit.jupiter:junit-jupiter")
if (vintageEngine) {
testApi("org.junit.vintage:junit-vintage-engine:$platformVersion")
}
val componentsVersion = commonVer("org.junit.platform", "")
val components = mutableListOf(
"org.junit.platform:junit-platform-commons",
"org.junit.platform:junit-platform-launcher"
)
if (runner) {
components += "org.junit.platform:junit-platform-runner"
}
if (suiteApi) {
components += "org.junit.platform:junit-platform-suite-api"
}
for (component in components) {
testApi("$component:$componentsVersion")
}
addDependencyTo<ExternalModuleDependency>(this, "testImplementation", intellijDep()) {
// This dependency is needed only for FileComparisonFailure
includeJars("idea_rt", rootProject = rootProject)
isTransitive = false
}
// This is needed only for using FileComparisonFailure, which relies on JUnit 3 classes
add("testRuntimeOnly", commonDep("junit:junit"))
}
}
private fun DependencyHandler.testApi(dependencyNotation: Any) {
add("testApi", dependencyNotation)
}
val Project.protobufVersion: String get() = findProperty("versions.protobuf") as String
val Project.protobufRepo: String

View File

@@ -5,10 +5,13 @@ import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.TaskProvider
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.*
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.project
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import java.io.File
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
const val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
val packagesToRelocate =
listOf(
@@ -31,21 +34,23 @@ val packagesToRelocate =
// But due to the shadow plugin bug (https://github.com/johnrengelman/shadow/issues/262) it is not possible to use
// packagesToRelocate list to for the include list. Therefore the exclude list has to be created.
val packagesToExcludeFromDummy =
listOf("org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt")
listOf(
"org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt"
)
private fun ShadowJar.configureEmbeddableCompilerRelocation(withJavaxInject: Boolean = true) {
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
@@ -67,8 +72,8 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler", configuration = "runtimeJar"))
return tasks.register<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDirectory.set(project.file(File(buildDir, "libs")))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(compilerJar)
body()
}
@@ -107,8 +112,8 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(
)
return tasks.register<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDirectory.set(project.file(File(buildDir, "libs")))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(compilerDummyJar)
configureEmbeddableCompilerRelocation(withJavaxInject = false)
body()
@@ -119,7 +124,7 @@ fun Project.rewriteDepsToShadedJar(
originalJarTask: TaskProvider<out Jar>, shadowJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {}
): TaskProvider<out Jar> {
originalJarTask.configure {
classifier = "original"
archiveClassifier.set("original")
}
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
@@ -132,7 +137,7 @@ fun Project.rewriteDepsToShadedJar(
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
classifier = ""
archiveClassifier.set("original")
body()
}
return shadowJarTask

View File

@@ -10,12 +10,12 @@ import net.rubygrapefruit.platform.WindowsRegistry.Key.HKEY_LOCAL_MACHINE
import org.gradle.internal.os.OperatingSystem
enum class JdkMajorVersion(private val mandatory: Boolean = true) {
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10(false), JDK_11(false);
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10(false), JDK_11(false), /*15.0*/JDK_15(false);
fun isMandatory(): Boolean = mandatory
}
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"))
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"), JdkMajorVersion.JDK_15 to listOf("JDK_15_0"))
data class JdkId(val explicit: Boolean, val majorVersion: JdkMajorVersion, var version: String, var homeDir: File)
@@ -101,8 +101,12 @@ fun MutableCollection<JdkId>.discoverJdks(project: Project) {
}
}
private val macOsJavaHomeOutRegexes = listOf(Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""))
private val macOsJavaHomeOutRegexes =
listOf(
Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\)\s+"[^"]*"\s+-\s+"[^"]*"\s(.+)""")
)
fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) {
val procBuilder = ProcessBuilder("/usr/libexec/java_home", "-V").redirectErrorStream(true)

View File

@@ -76,8 +76,6 @@ fun Project.jpsStandalone() = "kotlin.build:jps-standalone:${rootProject.extra["
fun Project.nodeJSPlugin() = "kotlin.build:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}"
fun Project.androidDxJar() = "org.jetbrains.kotlin:android-dx:${rootProject.extra["versions.androidBuildTools"]}"
fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:${rootProject.extra["versions.intellijSdk"]}"
fun Project.kotlinxCollectionsImmutable() = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${rootProject.extra["versions.kotlinx-collections-immutable"]}"
@@ -132,12 +130,10 @@ object IntellijRootUtils {
}
}
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project) =
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).toTypedArray(), rootProject = project.rootProject)
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean) =
@Suppress("UNCHECKED_CAST")
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean = { true }): Unit =
includeJars(
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter { jarsFilterPredicate(it) }.toTypedArray(),
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter(jarsFilterPredicate).toTypedArray(),
rootProject = project.rootProject
)

View File

@@ -18,8 +18,12 @@ import java.util.*
internal const val PLUGIN_MARKER_SUFFIX = ".gradle.plugin"
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
fun Project.isSonatypePublish(): Boolean =
hasProperty("isSonatypePublish") && property("isSonatypePublish") as Boolean
val pluginDevelopment = extensions.getByType<PluginBundleExtension>()
val publishingExtension = extensions.getByType<PublishingExtension>()
val mainPublication = publishingExtension.publications[KotlinBuildPublishingPlugin.PUBLICATION_NAME] as MavenPublication
@@ -32,7 +36,12 @@ fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
tasks.named<PublishToMavenRepository>(
"publish${markerPublication.name.capitalize(Locale.ROOT)}PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository"
).configureRepository()
).apply {
configureRepository()
configure {
onlyIf { !isSonatypePublish() }
}
}
}
}

View File

@@ -41,7 +41,7 @@ open class DexMethodCount : DefaultTask() {
dependsOn(jar)
}
@Internal // plain output properties are not supported, mark as internal to suppress warning from validateTaskProperties
@Internal // plain output properties are not supported, mark as internal to suppress warning from validatePlugins
lateinit var counts: Counts
@get:OutputFile

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/
@@ -8,7 +8,6 @@ package plugins
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.attributes.Usage
import org.gradle.api.component.AdhocComponentWithVariants
import org.gradle.api.component.SoftwareComponentFactory
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.publish.PublishingExtension
@@ -17,13 +16,12 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
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.net.URI
import java.util.*
import javax.inject.Inject
class KotlinBuildPublishingPlugin @Inject constructor(
private val componentFactory: SoftwareComponentFactory
) : Plugin<Project> {
@@ -47,7 +45,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
}
}
val kotlinLibraryComponent = componentFactory.adhoc(ADHOC_COMPONENT_NAME) as AdhocComponentWithVariants
val kotlinLibraryComponent = componentFactory.adhoc(ADHOC_COMPONENT_NAME)
components.add(kotlinLibraryComponent)
kotlinLibraryComponent.addVariantsFromConfiguration(publishedCompile) { mapToMavenScope("compile") }
kotlinLibraryComponent.addVariantsFromConfiguration(publishedRuntime) { mapToMavenScope("runtime") }
@@ -73,56 +71,11 @@ class KotlinBuildPublishingPlugin @Inject constructor(
create<MavenPublication>(PUBLICATION_NAME) {
from(kotlinLibraryComponent)
pom {
packaging = "jar"
name.set(humanReadableName(project))
description.set(project.description ?: humanReadableName(project))
url.set("https://kotlinlang.org/")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/JetBrains/kotlin")
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
}
developers {
developer {
name.set("Kotlin Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}
}
}
}
repositories {
maven {
name = REPOSITORY_NAME
url = file("${project.rootDir}/build/repo").toURI()
configureKotlinPomAttributes(project)
}
}
}
configure<SigningExtension> {
setRequired(provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
})
sign(extensions.getByType<PublishingExtension>().publications[PUBLICATION_NAME])
}
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
tasks.named<PublishToMavenRepository>("publish${PUBLICATION_NAME}PublicationTo${REPOSITORY_NAME}Repository")
.configureRepository()
configureDefaultPublishing()
}
companion object {
@@ -133,13 +86,84 @@ class KotlinBuildPublishingPlugin @Inject constructor(
const val COMPILE_CONFIGURATION = "publishedCompile"
const val RUNTIME_CONFIGURATION = "publishedRuntime"
@UseExperimental(ExperimentalStdlibApi::class)
fun humanReadableName(project: Project) =
project.name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
}
}
fun TaskProvider<PublishToMavenRepository>.configureRepository() = configure {
@OptIn(ExperimentalStdlibApi::class)
private fun humanReadableName(name: String) =
name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
fun MavenPublication.configureKotlinPomAttributes(project: Project, explicitDescription: String? = null) {
val publication = this
pom {
packaging = "jar"
name.set(humanReadableName(publication.artifactId))
description.set(explicitDescription ?: project.description ?: humanReadableName(publication.artifactId))
url.set("https://kotlinlang.org/")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/JetBrains/kotlin")
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
}
developers {
developer {
name.set("Kotlin Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}
}
}
fun Project.configureDefaultPublishing() {
configure<PublishingExtension> {
repositories {
maven {
name = KotlinBuildPublishingPlugin.REPOSITORY_NAME
url = file("${project.rootDir}/build/repo").toURI()
}
}
}
configureSigning()
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
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() =
configure { configureRepository() }
private fun PublishToMavenRepository.configureRepository() {
dependsOn(project.rootProject.tasks.named("preparePublication"))
doFirst {
val preparePublication = project.rootProject.tasks.named("preparePublication").get()
@@ -157,4 +181,4 @@ fun TaskProvider<PublishToMavenRepository>.configureRepository() = configure {
}
}
}
}
}

View File

@@ -1,3 +1,4 @@
@file:Suppress("DEPRECATION")
package plugins
import org.codehaus.groovy.runtime.InvokerHelper
@@ -16,10 +17,8 @@ import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import kotlin.properties.Delegates
/**
* Configures a Kotlin module for publication.
*
*/
open class PublishedKotlinModule : Plugin<Project> {

View File

@@ -30,6 +30,7 @@ val SourceSet.projectDefault: Project.() -> Unit
}
"test" -> {
java.srcDirs("test", "tests")
this@projectDefault.resources.srcDir("testResources")
}
}
}

View File

@@ -1,17 +1,6 @@
/*
* Copyright 2010-2017 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.
* 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.
*/
@@ -31,50 +20,65 @@ import java.lang.Character.isUpperCase
import java.nio.file.Files
import java.nio.file.Path
fun Task.dependsOnKotlinPluginInstall() {
dependsOn(
":kotlin-allopen:install",
":kotlin-noarg:install",
":kotlin-sam-with-receiver:install",
":kotlin-android-extensions:install",
":kotlin-build-common:install",
":kotlin-compiler-embeddable:install",
":native:kotlin-native-utils:install",
":kotlin-util-klib:install",
":kotlin-util-io:install",
":kotlin-compiler-runner:install",
":kotlin-daemon-embeddable:install",
":kotlin-daemon-client:install",
":kotlin-gradle-plugin-api:install",
":kotlin-gradle-plugin:install",
":kotlin-gradle-plugin-model:install",
":kotlin-reflect:install",
":kotlin-annotation-processing-gradle:install",
":kotlin-test:kotlin-test-common:install",
":kotlin-test:kotlin-test-annotations-common:install",
":kotlin-test:kotlin-test-jvm:install",
":kotlin-test:kotlin-test-js:install",
":kotlin-test:kotlin-test-junit:install",
":kotlin-gradle-subplugin-example:install",
":kotlin-stdlib-common:install",
":kotlin-stdlib:install",
":kotlin-stdlib-jdk8:install",
":kotlin-stdlib-js:install",
":examples:annotation-processor-example:install",
":kotlin-script-runtime:install",
":kotlin-scripting-common:install",
":kotlin-scripting-jvm:install",
":kotlin-scripting-compiler-embeddable:install",
":kotlin-scripting-compiler-impl-embeddable:install",
":kotlin-test-js-runner:install",
":native:kotlin-klib-commonizer-embeddable:install"
)
val kotlinGradlePluginAndItsRequired = arrayOf(
":kotlin-allopen",
":kotlin-noarg",
":kotlin-sam-with-receiver",
":kotlin-android-extensions",
":kotlin-parcelize-compiler",
":kotlin-build-common",
":kotlin-compiler-embeddable",
":native:kotlin-native-utils",
":kotlin-util-klib",
":kotlin-util-io",
":kotlin-compiler-runner",
":kotlin-daemon-embeddable",
":kotlin-daemon-client",
":kotlin-gradle-plugin-api",
":kotlin-gradle-plugin",
":kotlin-gradle-plugin-model",
":kotlin-reflect",
":kotlin-annotation-processing-gradle",
":kotlin-test",
":kotlin-gradle-subplugin-example",
":kotlin-stdlib-common",
":kotlin-stdlib",
":kotlin-stdlib-jdk8",
":kotlin-stdlib-js",
":examples:annotation-processor-example",
":kotlin-script-runtime",
":kotlin-scripting-common",
":kotlin-scripting-jvm",
":kotlin-scripting-compiler-embeddable",
":kotlin-scripting-compiler-impl-embeddable",
":kotlin-test-js-runner",
":native:kotlin-klib-commonizer-embeddable",
":native:kotlin-klib-commonizer-api"
)
fun Task.dependsOnKotlinGradlePluginInstall() {
kotlinGradlePluginAndItsRequired.forEach {
dependsOn("${it}:install")
}
}
fun Task.dependsOnKotlinGradlePluginPublish() {
kotlinGradlePluginAndItsRequired.forEach {
project.rootProject.tasks.findByPath("${it}:publish")?.let { task ->
dependsOn(task)
}
}
}
/**
* @param parallel is redundant if @param jUnit5Enabled is true, because
* JUnit5 supports parallel test execution by itself, without gradle help
*/
fun Project.projectTest(
taskName: String = "test",
parallel: Boolean = false,
shortenTempRootName: Boolean = false,
jUnit5Enabled: Boolean = false,
body: Test.() -> Unit = {}
): TaskProvider<Test> = getOrCreateTask(taskName) {
doFirst {
@@ -108,12 +112,29 @@ fun Project.projectTest(
}
}
include {
val path = it.path
if (it.isDirectory) {
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 {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
if (jUnit5Enabled) {
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
} else {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
}
}
}
@@ -153,7 +174,7 @@ fun Project.projectTest(
var subProjectTempRoot: Path? = null
doFirst {
val teamcity = rootProject.findProperty("teamcity") as? Map<Any?, *>
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
@@ -176,10 +197,10 @@ fun Project.projectTest(
}
}
if (parallel) {
if (parallel && !jUnit5Enabled) {
maxParallelForks =
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
?: Math.max(Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4, 1)
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
}
body()
}

View File

@@ -0,0 +1,30 @@
/*
* 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.
*/
import com.gradle.enterprise.gradleplugin.testdistribution.TestDistributionExtension
import org.gradle.api.tasks.testing.Test
import org.gradle.internal.os.OperatingSystem
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
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)
maxRemoteExecutors.set(20)
if (isTeamcityBuild) {
requirements.set(setOf("os=${OperatingSystem.current().familyName}"))
} else {
maxLocalExecutors.set(0)
}
configure()
}
}
fun Test.isTestDistributionEnabled(): Boolean =
extensions.findByType(TestDistributionExtension::class.java)?.enabled?.orNull ?: false

View File

@@ -1,14 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
isD8Enabled = project.findProperty('android.enableD8').toBoolean()
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:4.1.2'
}
}
apply plugin: 'com.android.application'
@@ -20,7 +17,7 @@ repositories {
android {
compileSdkVersion 26
buildToolsVersion "28.0.3"
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "org.jetbrains.kotlin.android.tests"
@@ -40,14 +37,6 @@ android {
packagingOptions { exclude 'META-INF/build.txt' }
//TODO run under java 6, cause there is error on implicit 'stream' import in 'asWithMutable' test
lintOptions {
abortOnError false
}
compileOptions {
incremental = false
}
dexOptions {
dexInProcess false
@@ -60,11 +49,9 @@ android {
resultsDir = "build/test/results"
}
if (isD8Enabled) {
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
flavorDimensions "box"
@@ -86,15 +73,20 @@ android {
dimension "box"
}
common_ir0 {
dimension "box"
}
if (isD8Enabled) {
jvm80 {
dimension "box"
}
common_ir1 {
dimension "box"
}
reflectjvm80 {
dimension "box"
}
common_ir2 {
dimension "box"
}
reflect_ir0 {
dimension "box"
}
}

View File

@@ -1,3 +1,2 @@
#don't try to download android specific tools within gradle: licence acceptance will be required
android.builder.sdkDownload=false
android.enableD8=true
android.builder.sdkDownload=false

View File

@@ -6,25 +6,27 @@ plugins {
}
dependencies {
compile(project(":compiler:util"))
compile(project(":compiler:cli"))
compile(project(":compiler:frontend"))
compile(project(":compiler:backend"))
compile(kotlinStdlib())
compile(project(":kotlin-reflect"))
compile(projectTests(":compiler:tests-common"))
compile(commonDep("junit:junit"))
Platform[193].orLower {
compileOnly(intellijDep()) { includeJars("openapi") }
}
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":core:descriptors"))
testCompile(project(":core:descriptors.jvm"))
testCompile(project(":compiler:util"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler:frontend"))
testCompile(project(":compiler:backend"))
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":compiler:frontend.java"))
testCompile(kotlinStdlib())
testCompile(project(":kotlin-reflect"))
testCompile(projectTests(":compiler:tests-common"))
testCompile(commonDep("junit:junit"))
testApi(projectTests(":compiler:test-infrastructure"))
testApi(projectTests(":compiler:test-infrastructure-utils"))
testApi(projectTests(":compiler:tests-compiler-utils"))
testApi(projectTests(":compiler:tests-common-new"))
testCompile(projectTests(":jps-plugin"))
testCompile(commonDep("junit:junit"))
Platform[193].orLower {
testCompile(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
@@ -36,15 +38,15 @@ dependencies {
Platform[201].orLower {
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) }
}
Platform[192].orHigher {
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
}
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
testCompile(jpsStandalone()) { includeJars("jps-model") }
testCompile(jpsBuildTest())
testCompile("org.junit.platform:junit-platform-launcher:${commonVer("org.junit.platform", "")}")
}
sourceSets {
"main" { projectDefault() }
"main" { }
"test" { projectDefault() }
}

View File

@@ -1,62 +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.android.tests;
import org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase;
import org.junit.Ignore;
import java.io.File;
import java.io.IOException;
@Ignore
public class AndroidJpsBuildTestCase extends BaseKotlinJpsBuildTestCase {
private static final String PROJECT_NAME = "android-module";
private static final String SDK_NAME = "Android_SDK";
private final File workDir = new File(AndroidRunner.getPathManager().getTmpFolder());
public void doTest() {
initProject();
rebuildAllModules();
buildAllModules().assertSuccessful();
}
@Override
protected String getProjectName() {
return "android-module";
}
@Override
protected void runTest() {
doTest();
}
@Override
public String getName() {
return "AndroidJpsTest";
}
@Override
protected File doGetProjectDir() throws IOException {
return workDir;
}
private void initProject() {
addJdk(SDK_NAME, AndroidRunner.getPathManager().getPlatformFolderInAndroidSdk() + "/android.jar");
loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr");
}
}

View File

@@ -25,7 +25,7 @@ import org.junit.runners.AllTests;
import java.io.File;
//@RunWith(AllTests.class)
@RunWith(AllTests.class)
public class AndroidRunner {
private static PathManager pathManager;
@@ -46,12 +46,8 @@ public class AndroidRunner {
CodegenTestsOnAndroidGenerator.generate(pathManager);
System.out.println("Run tests on android...");
TestSuite suite = CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
//AndroidJpsBuildTestCase indirectly depends on UsefulTestCase which compiled against java 8
//TODO: Need add separate run configuration for AndroidJpsBuildTestCase
//suite.addTest(new AndroidJpsBuildTestCase());
return suite;
System.out.println("Run tests on Android...");
return CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
}
public void tearDown() throws Exception {

View File

@@ -20,7 +20,9 @@ import com.intellij.openapi.util.Ref
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.test.KotlinBaseTest
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.sourceFileProvider
import java.io.File
import java.util.regex.Pattern
@@ -34,28 +36,24 @@ private data class OldPackageAndNew(val oldFqName: FqName, val newFqName: FqName
internal fun patchFilesAndAddTest(
testFile: File,
testFiles: List<KotlinBaseTest.TestFile>,
module: TestModule,
services: TestServices,
filesHolder: CodegenTestsOnAndroidGenerator.FilesWriter
): FqName? {
if (testFiles.any { it.name.endsWith(".java") }) {
//TODO support java files
return null
}
val ktFiles = testFiles.filter { it.name.endsWith(".kt") }
if (ktFiles.isEmpty()) return null
): FqName {
val newPackagePrefix = testFile.path.replace("\\\\|-|\\.|/".toRegex(), "_")
val oldPackage = Ref<FqName>()
val isJvmName = Ref<Boolean>(false)
val testFiles = module.files
val isSingle = testFiles.size == 1
val resultFiles = testFiles.map {
val fileName = if (isSingle) it.name else testFile.name.substringBeforeLast(".kt") + "/" + it.name
val content = services.sourceFileProvider.getContentOfSourceFile(it)
TestClassInfo(
fileName,
changePackage(newPackagePrefix, it.content, oldPackage, isJvmName),
changePackage(newPackagePrefix, content, oldPackage, isJvmName),
oldPackage.get(),
isJvmName.get(),
getGeneratedClassName(File(fileName), it.content, newPackagePrefix, oldPackage.get())
getGeneratedClassName(File(fileName), content, newPackagePrefix, oldPackage.get())
)
}
val packages =

View File

@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.android.tests
import com.intellij.openapi.Disposable
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.io.FileUtil
@@ -13,20 +12,34 @@ import com.intellij.openapi.util.io.FileUtilRt
import org.jetbrains.kotlin.cli.common.output.writeAllTo
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.codegen.CodegenTestCase
import org.jetbrains.kotlin.codegen.CodegenTestFiles
import org.jetbrains.kotlin.codegen.GenerationUtils
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.*
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendKinds
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
import org.jetbrains.kotlin.test.services.*
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.impl.BackendKindExtractorImpl
import org.jetbrains.kotlin.test.services.impl.TemporaryDirectoryManagerImpl
import org.jetbrains.kotlin.test.services.sourceProviders.AdditionalDiagnosticsSourceFilesProvider
import org.jetbrains.kotlin.test.services.sourceProviders.CodegenHelpersSourceFilesProvider
import org.jetbrains.kotlin.test.services.sourceProviders.CoroutineHelpersSourceFilesProvider
import org.jetbrains.kotlin.test.util.KtTestUtil
import org.junit.Assert
import java.io.File
import java.io.FileWriter
import java.io.IOException
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.Path
import kotlin.io.path.createTempDirectory
import kotlin.test.assertTrue
data class ConfigurationKey(val kind: ConfigurationKind, val jdkKind: TestJdkKind, val configuration: String)
@@ -41,17 +54,18 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
//keep it globally to avoid test grouping on TC
private val generatedTestNames = hashSetOf<String>()
private val COMMON = FlavorConfig("common", 3);
private val REFLECT = FlavorConfig("reflect", 1);
private val JVM8 = FlavorConfig("jvm8", 1);
private val JVM8REFLECT = FlavorConfig("reflectjvm8", 1);
private val COMMON = FlavorConfig(TargetBackend.ANDROID,"common", 3)
private val REFLECT = FlavorConfig(TargetBackend.ANDROID, "reflect", 1)
class FlavorConfig(private val prefix: String, val limit: Int) {
private val COMMON_IR = FlavorConfig(TargetBackend.ANDROID_IR, "common_ir", 3)
private val REFLECT_IR = FlavorConfig(TargetBackend.ANDROID_IR,"reflect_ir", 1)
class FlavorConfig(private val backend: TargetBackend, private val prefix: String, val limit: Int) {
private var writtenFilesCount = 0
fun printStatistics() {
println("FlavorTestCompiler: $prefix, generated file count: $writtenFilesCount")
println("FlavorTestCompiler for $backend: $prefix, generated file count: $writtenFilesCount")
}
fun getFlavorForNewFiles(newFilesCount: Int): String {
@@ -97,7 +111,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
it.setExecutable(true)
}
}
File("./gradlew.bat").copyTo(File(projectRoot, "gradlew.bat"));
File("./gradlew.bat").copyTo(File(projectRoot, "gradlew.bat"))
val file = File(target, "gradle-wrapper.properties")
file.readLines().map {
when {
@@ -134,27 +148,47 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
private fun generateTestsAndFlavourSuites() {
println("Generating test files...")
generateTestMethodsForDirectories(File("compiler/testData/codegen/box"), File("compiler/testData/codegen/boxInline"))
val folders = arrayOf(
File("compiler/testData/codegen/box"),
File("compiler/testData/codegen/boxInline")
)
generateTestMethodsForDirectories(
TargetBackend.ANDROID,
COMMON,
REFLECT,
*folders
)
generateTestMethodsForDirectories(
TargetBackend.ANDROID_IR,
COMMON_IR,
REFLECT_IR,
*folders
)
pendingUnitTestGenerators.values.forEach { it.generate() }
}
private fun generateTestMethodsForDirectories(vararg dirs: File) {
private fun generateTestMethodsForDirectories(
backend: TargetBackend,
commonFlavor: FlavorConfig,
reflectionFlavor: FlavorConfig,
vararg dirs: File
) {
val holders = mutableMapOf<ConfigurationKey, FilesWriter>()
for (dir in dirs) {
val files = dir.listFiles() ?: error("Folder with testData is empty: ${dir.absolutePath}")
processFiles(files, holders)
processFiles(files, holders, backend, commonFlavor, reflectionFlavor)
}
holders.values.forEach {
it.writeFilesOnDisk()
}
COMMON.printStatistics()
REFLECT.printStatistics()
JVM8.printStatistics()
JVM8REFLECT.printStatistics()
commonFlavor.printStatistics()
reflectionFlavor.printStatistics()
}
internal inner class FilesWriter(
@@ -238,10 +272,14 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
}
}
@OptIn(TestInfrastructureInternals::class)
@Throws(IOException::class)
private fun processFiles(
files: Array<File>,
holders: MutableMap<ConfigurationKey, FilesWriter>
holders: MutableMap<ConfigurationKey, FilesWriter>,
backend: TargetBackend,
commmonFlavor: FlavorConfig,
reflectionFlavor: FlavorConfig
) {
holders.values.forEach {
it.writeFilesOnDiskIfNeeded()
@@ -251,7 +289,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
if (file.isDirectory) {
val listFiles = file.listFiles()
if (listFiles != null) {
processFiles(listFiles, holders)
processFiles(listFiles, holders, backend, commmonFlavor, reflectionFlavor)
}
} else if (FileUtilRt.getExtension(file.name) != KotlinFileType.EXTENSION) {
// skip non kotlin files
@@ -260,14 +298,13 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
continue
}
if (!InTextDirectivesUtils.isPassingTarget(TargetBackend.JVM, file) ||
if (!InTextDirectivesUtils.isPassingTarget(backend.compatibleWith, file) ||
InTextDirectivesUtils.isIgnoredTarget(TargetBackend.ANDROID, file)
) {
continue
}
val fullFileText =
FileUtil.loadFile(file, true).replace("COROUTINES_PACKAGE", "kotlin.coroutines")
val fullFileText = FileUtil.loadFile(file, true)
if (fullFileText.contains("// WITH_COROUTINES")) {
if (fullFileText.contains("kotlin.coroutines.experimental")) continue
@@ -277,48 +314,106 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
//TODO support JvmPackageName
if (fullFileText.contains("@file:JvmPackageName(")) continue
// TODO: Support jvm assertions
if (fullFileText.contains("// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm")) continue
if (fullFileText.contains("// ASSERTIONS_MODE: jvm")) continue
if (fullFileText.contains("// MODULE: ")) continue
val targets = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fullFileText, "// JVM_TARGET:")
.also { it.remove(JvmTarget.JVM_1_6.description) }
val isJvm8Target =
if (targets.isEmpty()) false
else if (targets.contains(JvmTarget.JVM_1_8.description) && targets.size == 1) true
else continue //TODO: support other targets on Android
val isAtLeastJvm8Target = !targets.contains(JvmTarget.JVM_1_6.description)
if (isAtLeastJvm8Target && fullFileText.contains("@Target(AnnotationTarget.TYPE)")) {
//TODO: type annotations supported on sdk 26 emulator
continue
}
// TODO: support SKIP_JDK6 on new platforms
if (fullFileText.contains("// SKIP_JDK6")) continue
if (hasBoxMethod(fullFileText)) {
val testFiles = createTestFiles(file, fullFileText)
val kind = KotlinBaseTest.extractConfigurationKind(testFiles)
val jdkKind = KotlinBaseTest.getTestJdkKind(testFiles)
val testConfiguration = createTestConfiguration(file, backend)
val services = testConfiguration.testServices
val moduleStructure = try {
testConfiguration.moduleStructureExtractor.splitTestDataByModules(
file.path,
testConfiguration.directives,
).also {
services.register(TestModuleStructure::class, it)
}
} catch (e: ExceptionFromModuleStructureTransformer) {
continue
}
val module = moduleStructure.modules.singleOrNull() ?: continue
if (module.files.any { it.isJavaFile || it.isKtsFile }) continue
if (module.files.isEmpty()) continue
services.registerDependencyProvider(DependencyProviderImpl(services, moduleStructure.modules))
val keyConfiguration = CompilerConfiguration()
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
val configuratorForFlags = JvmEnvironmentConfigurator(services)
with(configuratorForFlags) {
val extractor = DirectiveToConfigurationKeyExtractor()
extractor.provideConfigurationKeys()
extractor.configure(keyConfiguration, module.directives)
}
val kind = configuratorForFlags.extractConfigurationKind(module.directives)
val jdkKind = configuratorForFlags.extractJdkKind(module.directives)
keyConfiguration.languageVersionSettings = module.languageVersionSettings
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
val compiler = if (isJvm8Target) {
if (kind.withReflection) JVM8REFLECT else JVM8
} else if (kind.withReflection) REFLECT else COMMON
val compiler = if (kind.withReflection) reflectionFlavor else commmonFlavor
val compilerConfigurationProvider = services.compilerConfigurationProvider as CompilerConfigurationProviderImpl
val filesHolder = holders.getOrPut(key) {
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind, KotlinTestUtils.getAnnotationsJar()).apply {
FilesWriter(compiler, compilerConfigurationProvider.createCompilerConfiguration(module)).also {
println("Creating new configuration by $key")
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
})
}
}
patchFilesAndAddTest(file, testFiles, filesHolder)
patchFilesAndAddTest(file, module, services, filesHolder)
}
}
}
}
private fun createTestFiles(file: File, expectedText: String): List<KotlinBaseTest.TestFile> =
CodegenTestCase.createTestFilesFromFile(file, expectedText, "kotlin.coroutines", false, TargetBackend.JVM)
private fun createTestConfiguration(testDataFile: File, backend: TargetBackend): TestConfiguration {
return TestConfigurationBuilder().apply {
configure(backend)
testInfo = KotlinTestInfo(
"org.jetbrains.kotlin.android.tests.AndroidRunner",
"test${testDataFile.nameWithoutExtension.capitalize()}",
emptySet()
)
}.build(testDataFile.path)
}
private fun TestConfigurationBuilder.configure(backend: TargetBackend) {
globalDefaults {
frontend = FrontendKinds.ClassicFrontend
targetBackend = backend
targetPlatform = JvmPlatforms.defaultJvmPlatform
dependencyKind = DependencyKind.Binary
}
useConfigurators(
::CommonEnvironmentConfigurator,
::JvmEnvironmentConfigurator
)
useAdditionalSourceProviders(
::AdditionalDiagnosticsSourceFilesProvider,
::CoroutineHelpersSourceFilesProvider,
::CodegenHelpersSourceFilesProvider,
)
assertions = JUnit5Assertions
useAdditionalService<TemporaryDirectoryManager>(::TemporaryDirectoryManagerImpl)
useAdditionalService<BackendKindExtractor>(::BackendKindExtractorImpl)
useSourcePreprocessor(*AbstractKotlinCompilerTest.defaultPreprocessors.toTypedArray())
useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray())
}
companion object {
const val GRADLE_VERSION = "5.6.4" // update GRADLE_SHA_256 on change
const val GRADLE_SHA_256 = "1f3067073041bc44554d0efe5d402a33bc3d3c93cc39ab684f308586d732a80d"
const val GRADLE_VERSION = "6.8.1" // update GRADLE_SHA_256 on change
const val GRADLE_SHA_256 = "fd591a34af7385730970399f473afabdb8b28d57fd97d6625c388d090039d6fd"
const val testClassPackage = "org.jetbrains.kotlin.android.tests"
const val testClassName = "CodegenTestCaseOnAndroid"
const val baseTestClassPackage = "org.jetbrains.kotlin.android.tests"
@@ -339,20 +434,21 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
@Throws(IOException::class)
internal fun writeAndroidSkdToLocalProperties(pathManager: PathManager) {
val sdkRoot = KotlinTestUtils.getAndroidSdkSystemIndependentPath()
val sdkRoot = KtTestUtil.getAndroidSdkSystemIndependentPath()
println("Writing android sdk to local.properties: $sdkRoot")
val file = File(pathManager.tmpFolder + "/local.properties")
FileWriter(file).use { fw -> fw.write("sdk.dir=$sdkRoot") }
}
@OptIn(ExperimentalPathApi::class)
@JvmStatic
fun main(args: Array<String>) {
val tmpFolder = createTempDir()
println("Created temporary folder for android tests: " + tmpFolder.absolutePath)
val rootFolder = File("")
val pathManager = PathManager(rootFolder.absolutePath, tmpFolder.absolutePath)
val tmpFolder = createTempDirectory().toAbsolutePath().toString()
println("Created temporary folder for android tests: $tmpFolder")
val rootFolder = Path("").toAbsolutePath().toString()
val pathManager = PathManager(rootFolder, tmpFolder)
generate(pathManager, true)
println("Android test project is generated into " + tmpFolder.absolutePath + " folder")
println("Android test project is generated into $tmpFolder folder")
}
}
}

View File

@@ -55,16 +55,6 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
runTestsOnEmulator(gradleRunner, TestSuite("D8")).apply {
rootSuite.addTest(this)
}
renameFlavorFolder()
enableD8(false)
runTestsOnEmulator(gradleRunner, TestSuite("DX")).apply {
(0 until this.countTestCases()).forEach {
val testCase = testAt(it) as TestCase
testCase.name += "_DX"
}
rootSuite.addTest(this)
}
} catch (e: RuntimeException) {
e.printStackTrace()
throw e
@@ -81,25 +71,20 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
return rootSuite
}
private fun enableD8(enable: Boolean) {
val file = File(pathManager.androidTmpFolder, "gradle.properties")
val lines = file.readLines().map {
if (it.startsWith("android.enableD8=")) {
"android.enableD8=$enable"
} else it
}
file.writeText(lines.joinToString("\n"))
}
private fun processReport(suite: TestSuite, resultOutput: String) {
private fun processReport(rootSuite: TestSuite, resultOutput: String) {
val reportFolder = File(flavorFolder())
try {
val folders = reportFolder.listFiles()
assertTrue(folders != null && folders.isNotEmpty(), "No folders in ${reportFolder.path}")
folders.forEach {
assertTrue("${it.path} is not directory") { it.isDirectory }
val isIr = it.name.contains("_ir")
val testCases = parseSingleReportInFolder(it)
testCases.forEach { aCase -> suite.addTest(aCase) }
testCases.forEach { aCase ->
if (isIr) aCase.name += "_ir"
rootSuite.addTest(aCase)
}
Assert.assertNotEquals("There is no test results in report", 0, testCases.size.toLong())
}
} catch (e: Throwable) {
@@ -107,10 +92,6 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
}
}
private fun renameFlavorFolder() {
val reportFolder = File(flavorFolder())
reportFolder.renameTo(File(reportFolder.parentFile, reportFolder.name + "_d8"))
}
private fun flavorFolder() = pathManager.tmpFolder + "/build/test/results/connected/flavors"
@@ -139,7 +120,7 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
private fun cleanAndBuildProject(gradleRunner: GradleRunner) {
gradleRunner.clean()
gradleRunner.build()
gradleRunner.assembleAndroidTest()
}
@Throws(IOException::class, SAXException::class, ParserConfigurationException::class)
@@ -158,22 +139,14 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
return (0 until testCases.length).map { i ->
val item = testCases.item(i) as Element
val failure = item.getElementsByTagName("failure")
val failure = item.getElementsByTagName("failure").takeIf { it.length != 0 }?.item(0)
val name = item.getAttribute("name")
val clazz = item.getAttribute("classname")
if (failure.length == 0) {
object : TestCase(name) {
@Throws(Throwable::class)
override fun runTest() {
}
}
} else {
object : TestCase(name) {
@Throws(Throwable::class)
override fun runTest() {
Assert.fail(failure.item(0).textContent)
object : TestCase(name) {
@Throws(Throwable::class)
override fun runTest() {
if (failure != null) {
Assert.fail(failure.textContent)
}
}
}

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.android.tests;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import java.io.File;
@@ -69,7 +69,7 @@ public class PathManager {
}
public String getAndroidSdkRoot() {
return KotlinTestUtils.getAndroidSdkSystemIndependentPath();
return KtTestUtil.getAndroidSdkSystemIndependentPath();
}
public String getAndroidModuleRoot() {

View File

@@ -121,8 +121,11 @@ public class Emulator {
public void startEmulator() {
startServer();
System.out.println("Starting emulator...");
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(getStartCommand(), null, false, "START: ", true));
System.out.println("Starting emulator with ANDROID_HOME/ANDROID_SDK_ROOT: " + pathManager.getAndroidSdkRoot());
GeneralCommandLine startCommand = getStartCommand();
startCommand.withEnvironment("ANDROID_SDK_ROOT", pathManager.getAndroidSdkRoot());
startCommand.withEnvironment("ANDROID_HOME", pathManager.getAndroidSdkRoot());
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(startCommand, null, false, "START: ", true));
printLog();
}
@@ -144,6 +147,7 @@ public class Emulator {
bootCheckCommand.addParameter("shell");
bootCheckCommand.addParameter("getprop");
bootCheckCommand.addParameter("sys.boot_completed");
int counter = 0;
RunResult execute = RunUtils.execute(bootCheckCommand);
while (counter < 20) {

View File

@@ -45,9 +45,9 @@ public class GradleRunner {
OutputUtils.checkResult(result);
}
public void build() {
public void assembleAndroidTest() {
System.out.println("Building gradle project...");
GeneralCommandLine build = generateCommandLine("build");
GeneralCommandLine build = generateCommandLine("assembleAndroidTest");
build.addParameter("--stacktrace");
build.addParameter("--warn");
RunResult result = RunUtils.execute(build);

View File

@@ -0,0 +1,8 @@
/*
* 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.backend.common
class BackendException(message: String, cause: Throwable?) : IllegalStateException(message, cause)

View File

@@ -232,12 +232,13 @@ object CodegenUtil {
}
@JvmStatic
fun reportBackendException(exception: Throwable, phase: String, fileUrl: String?): Nothing {
fun reportBackendException(exception: Throwable, phase: String, location: String?, additionalMessage: String? = null): Nothing {
// CompilationException (the only KotlinExceptionWithAttachments possible here) is already supposed
// to have all information about the context.
if (exception is KotlinExceptionWithAttachments) throw exception
throw IllegalStateException(
getExceptionMessage("Backend", "Exception during $phase", exception, fileUrl),
throw BackendException(
getExceptionMessage("Backend", "Exception during $phase", exception, location) +
additionalMessage?.let { "\n" + it }.orEmpty(),
exception
)
}

View File

@@ -0,0 +1,15 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
api(project(":core:compiler.common.jvm"))
api(project(":compiler:config.jvm"))
api(intellijCoreDep()) { includeJars("asm-all", "guava", rootProject = rootProject) }
}
sourceSets {
"main" { projectDefault() }
"test" {}
}

View File

@@ -0,0 +1,450 @@
/*
* 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 com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.PrimitiveType;
import org.jetbrains.kotlin.descriptors.Visibilities;
import org.jetbrains.kotlin.descriptors.Visibility;
import org.jetbrains.kotlin.descriptors.java.JavaVisibilities;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.name.ClassId;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
import org.jetbrains.org.objectweb.asm.Opcodes;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
import org.jetbrains.org.objectweb.asm.commons.Method;
import java.util.Map;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public class AsmUtil {
private static final int NO_FLAG_LOCAL = 0;
public static final int NO_FLAG_PACKAGE_PRIVATE = 0;
@NotNull
private static final Map<Visibility, Integer> visibilityToAccessFlag = ImmutableMap.<Visibility, Integer>builder()
.put(Visibilities.Private.INSTANCE, ACC_PRIVATE)
.put(Visibilities.PrivateToThis.INSTANCE, ACC_PRIVATE)
.put(Visibilities.Protected.INSTANCE, ACC_PROTECTED)
.put(JavaVisibilities.ProtectedStaticVisibility.INSTANCE, ACC_PROTECTED)
.put(JavaVisibilities.ProtectedAndPackage.INSTANCE, ACC_PROTECTED)
.put(Visibilities.Public.INSTANCE, ACC_PUBLIC)
.put(Visibilities.Internal.INSTANCE, ACC_PUBLIC)
.put(Visibilities.Local.INSTANCE, NO_FLAG_LOCAL)
.put(JavaVisibilities.PackageVisibility.INSTANCE, NO_FLAG_PACKAGE_PRIVATE)
.build();
public static final String CAPTURED_PREFIX = "$";
public static final String THIS = "this";
public static final String THIS_IN_DEFAULT_IMPLS = "$this";
public static final String LABELED_THIS_FIELD = THIS + "_";
public static final String CAPTURED_LABELED_THIS_FIELD = CAPTURED_PREFIX + LABELED_THIS_FIELD;
public static final String INLINE_DECLARATION_SITE_THIS = "this_";
public static final String LABELED_THIS_PARAMETER = CAPTURED_PREFIX + THIS + "$";
public static final String CAPTURED_THIS_FIELD = "this$0";
public static final String RECEIVER_PARAMETER_NAME = "$receiver";
/*
This is basically an old convention. Starting from Kotlin 1.3, it was replaced with `$this_<label>`.
Note that it is still used for inlined callable references and anonymous callable extension receivers
even in 1.3.
*/
public static final String CAPTURED_RECEIVER_FIELD = "receiver$0";
// For non-inlined callable references ('kotlin.jvm.internal.CallableReference' has a 'receiver' field)
public static final String BOUND_REFERENCE_RECEIVER = "receiver";
public static final String LOCAL_FUNCTION_VARIABLE_PREFIX = "$fun$";
private static final ImmutableMap<Integer, JvmPrimitiveType> primitiveTypeByAsmSort;
private static final ImmutableMap<Type, Type> primitiveTypeByBoxedType;
static {
ImmutableMap.Builder<Integer, JvmPrimitiveType> typeBySortBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Type, Type> typeByWrapperBuilder = ImmutableMap.builder();
for (JvmPrimitiveType primitiveType : JvmPrimitiveType.values()) {
Type asmType = Type.getType(primitiveType.getDesc());
typeBySortBuilder.put(asmType.getSort(), primitiveType);
typeByWrapperBuilder.put(asmTypeByFqNameWithoutInnerClasses(primitiveType.getWrapperFqName()), asmType);
}
primitiveTypeByAsmSort = typeBySortBuilder.build();
primitiveTypeByBoxedType = typeByWrapperBuilder.build();
}
private AsmUtil() {
}
@NotNull
public static String getCapturedFieldName(@NotNull String originalName) {
return CAPTURED_PREFIX + originalName;
}
@NotNull
public static String getLabeledThisName(@NotNull String callableName, @NotNull String prefix, @NotNull String defaultName) {
if (!Name.isValidIdentifier(callableName)) {
return defaultName;
}
return prefix + CommonVariableAsmNameManglingUtils.mangleNameIfNeeded(callableName);
}
@NotNull
public static Type boxType(@NotNull Type type) {
Type boxedType = boxPrimitiveType(type);
return boxedType != null ? boxedType : type;
}
@Nullable
public static Type boxPrimitiveType(@NotNull Type type) {
JvmPrimitiveType jvmPrimitiveType = primitiveTypeByAsmSort.get(type.getSort());
return jvmPrimitiveType != null ? asmTypeByFqNameWithoutInnerClasses(jvmPrimitiveType.getWrapperFqName()) : null;
}
@NotNull
public static Type unboxType(@NotNull Type boxedType) {
Type primitiveType = unboxPrimitiveTypeOrNull(boxedType);
if (primitiveType == null) {
throw new UnsupportedOperationException("Unboxing: " + boxedType);
}
return primitiveType;
}
@Nullable
public static Type unboxPrimitiveTypeOrNull(@NotNull Type boxedType) {
return primitiveTypeByBoxedType.get(boxedType);
}
public static boolean isBoxedPrimitiveType(@NotNull Type boxedType) {
return primitiveTypeByBoxedType.get(boxedType) != null;
}
@NotNull
public static Type unboxUnlessPrimitive(@NotNull Type boxedOrPrimitiveType) {
if (isPrimitive(boxedOrPrimitiveType)) return boxedOrPrimitiveType;
return unboxType(boxedOrPrimitiveType);
}
public static boolean isBoxedTypeOf(@NotNull Type boxedType, @NotNull Type unboxedType) {
return unboxPrimitiveTypeOrNull(boxedType) == unboxedType;
}
public static boolean isIntPrimitive(Type type) {
return type == Type.INT_TYPE || type == Type.SHORT_TYPE || type == Type.BYTE_TYPE || type == Type.CHAR_TYPE;
}
public static boolean isIntOrLongPrimitive(Type type) {
return isIntPrimitive(type) || type == Type.LONG_TYPE;
}
public static boolean isPrimitive(Type type) {
return type.getSort() != Type.OBJECT && type.getSort() != Type.ARRAY;
}
@NotNull
public static Type correctElementType(@NotNull Type type) {
String internalName = type.getInternalName();
assert internalName.charAt(0) == '[';
return Type.getType(internalName.substring(1));
}
@NotNull
public static Type getArrayType(@NotNull Type componentType) {
return Type.getType("[" + componentType.getDescriptor());
}
@Nullable
public static PrimitiveType asmPrimitiveTypeToLangPrimitiveType(Type type) {
JvmPrimitiveType jvmPrimitiveType = primitiveTypeByAsmSort.get(type.getSort());
return jvmPrimitiveType != null ? jvmPrimitiveType.getPrimitiveType() : null;
}
@NotNull
public static Method method(@NotNull String name, @NotNull Type returnType, @NotNull Type... parameterTypes) {
return new Method(name, Type.getMethodDescriptor(returnType, parameterTypes));
}
public static Type stringValueOfType(Type type) {
int sort = type.getSort();
return sort == Type.OBJECT || sort == Type.ARRAY
? OBJECT_TYPE
: sort == Type.BYTE || sort == Type.SHORT ? Type.INT_TYPE : type;
}
public static void genThrow(@NotNull InstructionAdapter v, @NotNull String exception, @Nullable String message) {
v.anew(Type.getObjectType(exception));
v.dup();
if (message != null) {
v.aconst(message);
v.invokespecial(exception, "<init>", "(Ljava/lang/String;)V", false);
}
else {
v.invokespecial(exception, "<init>", "()V", false);
}
v.athrow();
}
public static void genStringBuilderConstructor(InstructionAdapter v) {
v.visitTypeInsn(NEW, "java/lang/StringBuilder");
v.dup();
v.invokespecial("java/lang/StringBuilder", "<init>", "()V", false);
}
public static void genInvertBoolean(InstructionAdapter v) {
v.iconst(1);
v.xor(Type.INT_TYPE);
}
public static void numConst(int value, Type type, InstructionAdapter v) {
if (type == Type.FLOAT_TYPE) {
v.fconst(value);
}
else if (type == Type.DOUBLE_TYPE) {
v.dconst(value);
}
else if (type == Type.LONG_TYPE) {
v.lconst(value);
}
else if (type == Type.CHAR_TYPE || type == Type.BYTE_TYPE || type == Type.SHORT_TYPE || type == Type.INT_TYPE) {
v.iconst(value);
}
else {
throw new IllegalArgumentException("Primitive numeric type expected, got: " + type);
}
}
public static void swap(InstructionAdapter v, Type stackTop, Type afterTop) {
if (stackTop.getSize() == 1) {
if (afterTop.getSize() == 1) {
v.swap();
}
else {
v.dupX2();
v.pop();
}
}
else {
if (afterTop.getSize() == 1) {
v.dup2X1();
}
else {
v.dup2X2();
}
v.pop2();
}
}
public static void pushDefaultValueOnStack(@NotNull Type type, @NotNull InstructionAdapter v) {
v.visitInsn(defaultValueOpcode(type));
}
public static int defaultValueOpcode(@NotNull Type type) {
if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
return ACONST_NULL;
}
if (type.getSort() == Type.FLOAT) {
return FCONST_0;
}
if (type.getSort() == Type.DOUBLE) {
return DCONST_0;
}
if (type.getSort() == Type.LONG) {
return LCONST_0;
}
return ICONST_0;
}
public static Type comparisonOperandType(Type left, Type right) {
if (left == Type.DOUBLE_TYPE || right == Type.DOUBLE_TYPE) return Type.DOUBLE_TYPE;
if (left == Type.FLOAT_TYPE || right == Type.FLOAT_TYPE) return Type.FLOAT_TYPE;
if (left == Type.LONG_TYPE || right == Type.LONG_TYPE) return Type.LONG_TYPE;
if (left == Type.CHAR_TYPE || right == Type.CHAR_TYPE) return Type.CHAR_TYPE;
return Type.INT_TYPE;
}
@NotNull
public static Type numberFunctionOperandType(@NotNull Type expectedType) {
if (expectedType == Type.SHORT_TYPE || expectedType == Type.BYTE_TYPE || expectedType == Type.CHAR_TYPE) {
return Type.INT_TYPE;
}
return expectedType;
}
public static void pop(@NotNull MethodVisitor v, @NotNull Type type) {
if (type.getSize() == 2) {
v.visitInsn(Opcodes.POP2);
}
else {
v.visitInsn(Opcodes.POP);
}
}
public static void pop2(@NotNull MethodVisitor v, @NotNull Type topOfStack, @NotNull Type afterTop) {
if (topOfStack.getSize() == 1 && afterTop.getSize() == 1) {
v.visitInsn(POP2);
} else {
pop(v, topOfStack);
pop(v, afterTop);
}
}
public static void pop2(@NotNull MethodVisitor v, @NotNull Type type) {
if (type.getSize() == 2) {
v.visitInsn(Opcodes.POP2);
v.visitInsn(Opcodes.POP2);
}
else {
v.visitInsn(Opcodes.POP2);
}
}
public static void dup(@NotNull InstructionAdapter v, @NotNull Type type) {
dup(v, type.getSize());
}
private static void dup(@NotNull InstructionAdapter v, int size) {
if (size == 2) {
v.dup2();
}
else if (size == 1) {
v.dup();
}
else {
throw new UnsupportedOperationException();
}
}
public static void dupx(@NotNull InstructionAdapter v, @NotNull Type type) {
dupx(v, type.getSize());
}
private static void dupx(@NotNull InstructionAdapter v, int size) {
if (size == 2) {
v.dup2X2();
}
else if (size == 1) {
v.dupX1();
}
else {
throw new UnsupportedOperationException();
}
}
// Duplicate the element afterTop and push it on the top of the stack.
public static void dupSecond(@NotNull InstructionAdapter v, @NotNull Type topOfStack, @NotNull Type afterTop) {
if (afterTop.getSize() == 0) {
return;
}
if (topOfStack.getSize() == 0) {
dup(v, afterTop);
} else if (topOfStack.getSize() == 1 && afterTop.getSize() == 1) {
v.dup2();
v.pop();
} else {
swap(v, topOfStack, afterTop);
if (topOfStack.getSize() == 1 && afterTop.getSize() == 2) {
v.dup2X1();
} else if (topOfStack.getSize() == 2 && afterTop.getSize() == 1) {
v.dupX2();
} else /* top = 2, after top = 2 */ {
v.dup2X2();
}
}
}
public static void dup(@NotNull InstructionAdapter v, @NotNull Type topOfStack, @NotNull Type afterTop) {
if (topOfStack.getSize() == 0 && afterTop.getSize() == 0) {
return;
}
if (topOfStack.getSize() == 0) {
dup(v, afterTop);
}
else if (afterTop.getSize() == 0) {
dup(v, topOfStack);
}
else if (afterTop.getSize() == 1) {
if (topOfStack.getSize() == 1) {
dup(v, 2);
}
else {
v.dup2X1();
v.pop2();
v.dupX2();
v.dupX2();
v.pop();
v.dup2X1();
}
}
else {
//Note: it's possible to write dup3 and dup4
throw new UnsupportedOperationException("Don't know how generate dup3/dup4 for: " + topOfStack + " and " + afterTop);
}
}
public static void writeAnnotationData(
@NotNull AnnotationVisitor av, @NotNull String[] data, @NotNull String[] strings
) {
AnnotationVisitor dataVisitor = av.visitArray(JvmAnnotationNames.METADATA_DATA_FIELD_NAME);
for (String string : data) {
dataVisitor.visit(null, string);
}
dataVisitor.visitEnd();
AnnotationVisitor stringsVisitor = av.visitArray(JvmAnnotationNames.METADATA_STRINGS_FIELD_NAME);
for (String string : strings) {
stringsVisitor.visit(null, string);
}
stringsVisitor.visitEnd();
}
@NotNull
public static Type asmTypeByFqNameWithoutInnerClasses(@NotNull FqName fqName) {
return Type.getObjectType(internalNameByFqNameWithoutInnerClasses(fqName));
}
@NotNull
public static Type asmTypeByClassId(@NotNull ClassId classId) {
return Type.getObjectType(classId.asString().replace('.', '$'));
}
@NotNull
public static String internalNameByFqNameWithoutInnerClasses(@NotNull FqName fqName) {
return JvmClassName.byFqNameWithoutInnerClasses(fqName).getInternalName();
}
public static void wrapJavaClassIntoKClass(@NotNull InstructionAdapter v) {
v.invokestatic(REFLECTION, "getOrCreateKotlinClass", Type.getMethodDescriptor(K_CLASS_TYPE, getType(Class.class)), false);
}
public static void wrapJavaClassesIntoKClasses(@NotNull InstructionAdapter v) {
v.invokestatic(REFLECTION, "getOrCreateKotlinClasses", Type.getMethodDescriptor(K_CLASS_ARRAY_TYPE, getType(Class[].class)), false);
}
@Nullable
public static Integer getVisibilityAccessFlag(Visibility visibility) {
return visibilityToAccessFlag.get(visibility);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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.
*/
@file:JvmName("CommonVariableAsmNameManglingUtils")
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.resolve.jvm.checkers.isValidDalvikCharacter
fun mangleNameIfNeeded(name: String): String {
if (name.all { it.isValidCharacter() }) {
return name
}
return buildString {
for (c in name) {
if (c.isValidCharacter()) {
append(c)
} else {
val hexString = Integer.toHexString(c.toInt())
assert(hexString.length <= 4)
append("_u").append(hexString)
}
}
}
}
private fun Char.isValidCharacter(): Boolean {
return this != '$' && this != '-' && isValidDalvikCharacter(this)
}

View File

@@ -0,0 +1,13 @@
/*
* 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 in different bunch versions
object VersionIndependentOpcodes {
const val ACC_RECORD = Opcodes.ACC_RECORD
}

View File

@@ -0,0 +1,13 @@
/*
* 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
}

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