Compare commits

...

2496 Commits

Author SHA1 Message Date
Mikhael Bogdanov
147ab6fe3d Support Unit/V types in string-concat indy calls
unitComponent.kt test fails with JVM target 9+
2021-02-17 17:16:57 +01:00
Mikhael Bogdanov
f7801fdd78 Make indy-with-constants default for -jvm-target 9+
#KT-42522 Fixed
2021-02-17 17:16:57 +01:00
Mikhael Bogdanov
e7f8df810d Fail on compilation errors in AbstractBytecodeTextTest 2021-02-17 17:16:57 +01:00
Mikhael Bogdanov
1101ebb111 Support new targets in KotlinBytecodeToolWindow
#KT-30222 Fixed
2021-02-17 17:16:57 +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
16234 changed files with 497699 additions and 313228 deletions

9
.bunch
View File

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

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

@@ -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>

10623
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,6 +18,7 @@ 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)
@@ -54,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:
@@ -104,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

@@ -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

@@ -27,9 +27,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 +44,6 @@ data class JvmBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -62,9 +56,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,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

@@ -145,6 +145,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 +272,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 +284,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 +312,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 +329,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 +342,7 @@ open class IncrementalJvmCache(
)
}
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -374,6 +382,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 +399,7 @@ open class IncrementalJvmCache(
}
}
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -522,6 +532,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 +558,7 @@ open class IncrementalJvmCache(
private fun functionNameBySignature(signature: String): String =
signature.substringBefore("(")
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -568,6 +580,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

@@ -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

@@ -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

@@ -27,8 +27,9 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.20")
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")
}
@@ -51,7 +52,6 @@ pill {
excludedDirs(
"out",
"buildSrc/build",
"buildSrc/prepare-deps/android-dx/build",
"buildSrc/prepare-deps/intellij-sdk/build"
)
}
@@ -73,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"
@@ -130,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) {
@@ -165,14 +166,12 @@ 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"
@@ -188,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.30-dev-16766"
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
@@ -292,7 +292,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(
@@ -318,12 +320,27 @@ 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",
":compiler:cli:compileKotlin",
":kotlin-scripting-compiler:compileKotlin",
":plugins:uast-kotlin:compileKotlin",
":plugins:uast-kotlin:compileTestKotlin",
":plugins:uast-kotlin-idea:compileKotlin"
)
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",
@@ -331,8 +348,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(
@@ -406,8 +422,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)
@@ -443,7 +458,26 @@ allprojects {
if (useJvmIrBackend) {
useIR = true
freeCompilerArgs += "-Xir-binary-with-stable-abi"
}
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
}
}
}
}
}
@@ -466,7 +500,7 @@ allprojects {
}
tasks.withType<Test> {
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true }
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
}
normalization {
@@ -550,10 +584,11 @@ gradle.taskGraph.whenReady {
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)
@@ -568,7 +603,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> {
@@ -598,7 +633,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")
}
}
}
@@ -629,6 +667,7 @@ tasks {
dependsOn("dist")
dependsOn(
":compiler:test",
":compiler:tests-common-new:test",
":compiler:container:test",
":compiler:tests-java8:test",
":compiler:tests-spec:test",
@@ -650,8 +689,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") {
@@ -662,6 +704,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")
}
@@ -671,6 +714,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"
)
@@ -706,7 +750,6 @@ tasks {
}
register("miscCompilerTest") {
dependsOn("wasmCompilerTest")
dependsOn("nativeCompilerTest")
dependsOn("firCompilerTest")
@@ -771,7 +814,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",
@@ -781,9 +823,10 @@ tasks {
}
register("idea-plugin-performance-tests") {
dependsOn("dist")
dependsOn(
":idea:performanceTests:performanceTest"
"dist",
":idea:performanceTests:performanceTest",
":idea:performanceTests:aggregateResults"
)
}
@@ -843,12 +886,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") {
@@ -863,10 +918,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")
@@ -896,11 +952,9 @@ tasks {
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",
@@ -919,9 +973,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"
)
}
}

View File

@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
extra["versions.native-platform"] = "0.14"
buildscript {
@@ -10,10 +12,10 @@ buildscript {
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.20")
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,7 +97,7 @@ 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.20")
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")}")
@@ -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,11 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs +=
listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check")
}
tasks["build"].dependsOn(":prepare-deps:build")
allprojects {

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.20")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
}
}

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

@@ -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

@@ -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
@@ -23,7 +22,6 @@ import org.gradle.plugins.signing.SigningPlugin
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,62 +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)
}
}
}
val signingRequired = provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
}
configure<SigningExtension> {
setRequired(signingRequired)
sign(extensions.getByType<PublishingExtension>().publications[PUBLICATION_NAME])
useGpgCmd()
}
tasks.withType<Sign>().configureEach {
setOnlyIf { signingRequired.get() }
}
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
tasks.named<PublishToMavenRepository>("publish${PUBLICATION_NAME}PublicationTo${REPOSITORY_NAME}Repository")
.configureRepository()
configureDefaultPublishing()
}
companion object {
@@ -139,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()
@@ -163,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.
*/
@@ -51,11 +40,7 @@ fun Task.dependsOnKotlinPluginInstall() {
":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-test:install",
":kotlin-gradle-subplugin-example:install",
":kotlin-stdlib-common:install",
":kotlin-stdlib:install",
@@ -76,6 +61,7 @@ fun Project.projectTest(
taskName: String = "test",
parallel: Boolean = false,
shortenTempRootName: Boolean = false,
jUnit5Enabled: Boolean = false,
body: Test.() -> Unit = {}
): TaskProvider<Test> = getOrCreateTask(taskName) {
doFirst {
@@ -109,12 +95,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$"))
}
}
}
}
@@ -154,7 +157,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
@@ -180,7 +183,7 @@ fun Project.projectTest(
if (parallel) {
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

@@ -19,6 +19,10 @@ dependencies {
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"))
@@ -34,11 +38,11 @@ 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 {

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,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
}

View File

@@ -14,7 +14,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
public class AsmTypes {
private static final Map<Class<?>, Type> TYPES_MAP = new HashMap<>();

View File

@@ -26,13 +26,13 @@ import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.*;
import java.util.ArrayList;
import java.util.List;
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP;
public abstract class AbstractClassBuilder implements ClassBuilder {
protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {};
public static final RecordComponentVisitor EMPTY_RECORD_VISITOR = new RecordComponentVisitor(Opcodes.API_VERSION) {};
protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {};
private String thisName;
@@ -91,6 +91,16 @@ public abstract class AbstractClassBuilder implements ClassBuilder {
return visitor;
}
@NotNull
@Override
public RecordComponentVisitor newRecordComponent(@NotNull String name, @NotNull String desc, @Nullable String signature) {
RecordComponentVisitor visitor = getVisitor().visitRecordComponent(name, desc, signature);
if (visitor == null) {
return EMPTY_RECORD_VISITOR;
}
return visitor;
}
@Override
@NotNull
public JvmSerializationBindings getSerializationBindings() {

View File

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

View File

@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.AnnotationChecker;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt;
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker;
import org.jetbrains.kotlin.resolve.constants.*;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
@@ -497,6 +498,9 @@ public abstract class AnnotationCodegen {
public Void visitKClassValue(KClassValue value, Void data) {
KotlinType classType = value.getArgumentType(module);
innerClassConsumer.addInnerClassInfoFromAnnotation(DescriptorUtils.getClassDescriptorForType(classType));
if (InlineClassesUtilsKt.isInlineClassType(classType)) {
classType = TypeUtils.makeNullable(classType);
}
annotationVisitor.visit(name, typeMapper.mapType(classType));
return null;
}

View File

@@ -20,11 +20,9 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
import org.jetbrains.kotlin.resolve.calls.components.hasDefaultValue
import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeUniqueAsSequence
import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.kotlin.utils.mapToIndex
class ArgumentAndDeclIndex(val arg: ResolvedValueArgument, val declIndex: Int)
@@ -70,12 +68,8 @@ abstract class ArgumentGenerator {
generateExpression(declIndex, argument)
}
is DefaultValueArgument -> {
if (calleeDescriptor?.defaultValueFromJava(declIndex) == true) {
generateDefaultJava(declIndex, argument)
} else {
defaultArgs.mark(declIndex)
generateDefault(declIndex, argument)
}
defaultArgs.mark(declIndex)
generateDefault(declIndex, argument)
}
is VarargValueArgument -> {
generateVararg(declIndex, argument)
@@ -103,10 +97,6 @@ abstract class ArgumentGenerator {
throw UnsupportedOperationException("Unsupported vararg value argument #$i: $argument")
}
protected open fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
throw UnsupportedOperationException("Unsupported default java argument #$i: $argument")
}
protected open fun generateOther(i: Int, argument: ResolvedValueArgument) {
throw UnsupportedOperationException("Unsupported value argument #$i: $argument")
}
@@ -116,28 +106,6 @@ abstract class ArgumentGenerator {
}
}
private fun CallableDescriptor.defaultValueFromJava(index: Int): Boolean = DFS.ifAny(
listOf(this),
{ current -> current.original.overriddenDescriptors.map { it.original } },
{ descriptor ->
descriptor.original.overriddenDescriptors.isEmpty() &&
descriptor is JavaCallableMemberDescriptor &&
descriptor.valueParameters[index].declaresDefaultValue()
}
)
fun shouldInvokeDefaultArgumentsStub(resolvedCall: ResolvedCall<*>): Boolean {
val descriptor = resolvedCall.resultingDescriptor
val valueArgumentsByIndex = resolvedCall.valueArgumentsByIndex ?: return false
for (index in valueArgumentsByIndex.indices) {
val resolvedValueArgument = valueArgumentsByIndex[index]
if (resolvedValueArgument is DefaultValueArgument && !descriptor.defaultValueFromJava(index)) {
return true
}
}
return false
}
fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): FunctionDescriptor {
if (functionDescriptor.containingDeclaration !is ClassDescriptor) return functionDescriptor
if (functionDescriptor.overriddenDescriptors.isEmpty()) return functionDescriptor
@@ -155,4 +123,4 @@ fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): Fun
function.valueParameters.any { valueParameter -> valueParameter.hasDefaultValue() }
}
?: functionDescriptor
}
}

View File

@@ -72,12 +72,6 @@ class CallBasedArgumentGenerator(
callGenerator.putValueIfNeeded(getJvmKotlinType(i), lazyVararg, ValueKind.GENERAL_VARARG, i)
}
override fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
val argumentValue = valueParameters[i].findJavaDefaultArgumentValue(valueParameterTypes[i], codegen.typeMapper)
callGenerator.putValueIfNeeded(getJvmKotlinType(i), argumentValue)
}
override fun reorderArgumentsIfNeeded(args: List<ArgumentAndDeclIndex>) {
callGenerator.reorderArgumentsIfNeeded(args, valueParameterTypes)
}

View File

@@ -29,7 +29,8 @@ class CallableMethod(
override val generateCalleeType: Type?,
override val returnKotlinType: KotlinType?,
val isInterfaceMethod: Boolean,
private val isDefaultMethodInInterface: Boolean
private val isDefaultMethodInInterface: Boolean,
private val boxInlineClassBeforeInvoke: Boolean
) : Callable {
private val defaultImplMethod: Method by lazy(LazyThreadSafetyMode.PUBLICATION, computeDefaultMethod)
@@ -49,6 +50,9 @@ class CallableMethod(
get() = getAsmMethod().argumentTypes
override fun genInvokeInstruction(v: InstructionAdapter) {
if (boxInlineClassBeforeInvoke) {
StackValue.boxInlineClass(dispatchReceiverKotlinType!!, v)
}
v.visitMethodInsn(
invokeOpcode,
owner.internalName,

View File

@@ -19,14 +19,10 @@ package org.jetbrains.kotlin.codegen;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.FileMapping;
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
import org.jetbrains.org.objectweb.asm.ClassVisitor;
import org.jetbrains.org.objectweb.asm.FieldVisitor;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
import org.jetbrains.org.objectweb.asm.*;
public interface ClassBuilder {
@NotNull
@@ -49,6 +45,12 @@ public interface ClassBuilder {
@Nullable String[] exceptions
);
@NotNull RecordComponentVisitor newRecordComponent(
@NotNull String name,
@NotNull String desc,
@Nullable String signature
);
@NotNull
JvmSerializationBindings getSerializationBindings();

View File

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

View File

@@ -0,0 +1,10 @@
/*
* 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
fun ClassBuilder.addRecordComponent(name: String, desc: String, signature: String?) {
newRecordComponent(name, desc, signature)
}

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.codegen
@Suppress("UNUSED_PARAMETER", "unused")
fun ClassBuilder.addRecordComponent(name: String, desc: String, signature: String?) {
// newRecordComponent(name, desc, signature)
}

View File

@@ -254,17 +254,17 @@ public class ClassFileFactory implements OutputFileCollection {
public PackageCodegen forPackage(@NotNull FqName fqName, @NotNull Collection<KtFile> files) {
assert !isDone : "Already done!";
registerSourceFiles(files);
return state.getCodegenFactory().createPackageCodegen(state, files, fqName);
return new PackageCodegenImpl(state, files, fqName);
}
@NotNull
public MultifileClassCodegen forMultifileClass(@NotNull FqName facadeFqName, @NotNull Collection<KtFile> files) {
assert !isDone : "Already done!";
registerSourceFiles(files);
return state.getCodegenFactory().createMultifileClassCodegen(state, files, facadeFqName);
return new MultifileClassCodegenImpl(state, files, facadeFqName);
}
private void registerSourceFiles(Collection<KtFile> files) {
public void registerSourceFiles(@NotNull Collection<KtFile> files) {
sourceFiles.addAll(toIoFilesIgnoringNonPhysical(files));
}
@@ -272,6 +272,7 @@ public class ClassFileFactory implements OutputFileCollection {
private static List<File> toIoFilesIgnoringNonPhysical(@NotNull Collection<? extends PsiFile> psiFiles) {
List<File> result = new ArrayList<>(psiFiles.size());
for (PsiFile psiFile : psiFiles) {
if (psiFile == null) continue;
VirtualFile virtualFile = psiFile.getVirtualFile();
// We ignore non-physical files here, because this code is needed to tell the make what inputs affect which outputs
// a non-physical file cannot be processed by make

View File

@@ -26,10 +26,6 @@ import org.jetbrains.kotlin.psi.KtFile
interface CodegenFactory {
fun generateModule(state: GenerationState, files: Collection<KtFile>)
fun createPackageCodegen(state: GenerationState, files: Collection<KtFile>, fqName: FqName): PackageCodegen
fun createMultifileClassCodegen(state: GenerationState, files: Collection<KtFile>, fqName: FqName): MultifileClassCodegen
companion object {
fun doCheckCancelled(state: GenerationState) {
if (state.classBuilderMode.generateBodies) {
@@ -49,8 +45,7 @@ object DefaultCodegenFactory : CodegenFactory {
if (fileClassInfo.withJvmMultifileClass) {
filesInMultifileClasses.putValue(fileClassInfo.facadeClassFqName, file)
}
else {
} else {
filesInPackages.putValue(file.packageFqName, file)
}
}
@@ -68,23 +63,17 @@ object DefaultCodegenFactory : CodegenFactory {
}
}
override fun createPackageCodegen(state: GenerationState, files: Collection<KtFile>, fqName: FqName) =
PackageCodegenImpl(state, files, fqName)
override fun createMultifileClassCodegen(state: GenerationState, files: Collection<KtFile>, fqName: FqName) =
MultifileClassCodegenImpl(state, files, fqName)
private fun generateMultifileClass(state: GenerationState, multifileClassFqName: FqName, files: Collection<KtFile>) {
state.factory.forMultifileClass(multifileClassFqName, files).generate()
}
fun generatePackage(
state: GenerationState,
packageFqName: FqName,
jetFiles: Collection<KtFile>
state: GenerationState,
packageFqName: FqName,
ktFiles: Collection<KtFile>
) {
// We do not really generate package class, but use old package fqName to identify package in module-info.
//FqName packageClassFqName = PackageClassUtils.getPackageClassFqName(packageFqName);
state.factory.forPackage(packageFqName, jetFiles).generate()
state.factory.forPackage(packageFqName, ktFiles).generate()
}
}

View File

@@ -19,7 +19,6 @@ import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.jvm.InlineClassManglingRulesKt;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
@@ -118,8 +117,9 @@ public class ConstructorCodegen {
}
private void registerAccessorForHiddenConstructorIfNeeded(ClassConstructorDescriptor descriptor) {
if (!InlineClassManglingRulesKt.shouldHideConstructorDueToInlineClassTypeValueParameters(descriptor)) return;
context.getAccessor(descriptor, AccessorKind.NORMAL, null, null);
if (DescriptorAsmUtil.isHiddenConstructor(descriptor)) {
context.getAccessor(descriptor, AccessorKind.NORMAL, null, null);
}
}
public void generateSecondaryConstructor(
@@ -371,11 +371,13 @@ public class ConstructorCodegen {
JvmMethodParameterKind delegatingKind = delegatingParameters.get(index).getKind();
if (delegatingKind == JvmMethodParameterKind.VALUE) {
assert index == parameters.size() || parameters.get(index).getKind() == JvmMethodParameterKind.VALUE:
"Delegating constructor has not enough implicit parameters";
"Delegating constructor has not enough implicit parameters: " + delegatingConstructor;
break;
}
assert index < parameters.size() && parameters.get(index).getKind() == delegatingKind :
"Constructors of the same class should have the same set of implicit arguments";
if (index >= parameters.size() || parameters.get(index).getKind() != delegatingKind) {
throw new AssertionError(
"Constructors of the same class should have the same set of implicit arguments: " + delegatingConstructor);
}
JvmMethodParameterSignature parameter = parameters.get(index);
iv.load(offset, parameter.getAsmType());
@@ -383,7 +385,7 @@ public class ConstructorCodegen {
}
assert index == parameters.size() || parameters.get(index).getKind() == JvmMethodParameterKind.VALUE :
"Delegating constructor has not enough parameters";
"Delegating constructor has not enough parameters: " + delegatingConstructor;
return new CallBasedArgumentGenerator(codegen, codegen.defaultCallGenerator, delegatingConstructor.getValueParameters(),
delegatingCallable.getValueParameterTypes());

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.codegen.JvmCodegenUtil.getDispatchReceiverParameterForConstructorCall
import org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvmInterface
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.config.LanguageFeature
@@ -26,12 +27,14 @@ import org.jetbrains.kotlin.psi.KtParameter
import org.jetbrains.kotlin.psi.KtPureClassOrObject
import org.jetbrains.kotlin.psi.KtPureElement
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.calls.components.hasDefaultValue
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.annotations.findJvmOverloadsAnnotation
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind
import org.jetbrains.kotlin.resolve.jvm.shouldHideConstructorDueToInlineClassTypeValueParameters
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
@@ -134,8 +137,9 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
remainingParameters.map { DescriptorToSourceUtils.descriptorToDeclaration(it) as? KtParameter }
val generateAsFinal =
functionDescriptor.modality == Modality.FINAL ||
state.languageVersionSettings.supportsFeature(LanguageFeature.GenerateJvmOverloadsAsFinal)
(functionDescriptor.modality == Modality.FINAL ||
state.languageVersionSettings.supportsFeature(LanguageFeature.GenerateJvmOverloadsAsFinal)) &&
!isJvmInterface(functionDescriptor.containingDeclaration)
val flags =
baseMethodFlags or
(if (isStatic) Opcodes.ACC_STATIC else 0) or
@@ -264,7 +268,9 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
if (classDescriptor.kind != ClassKind.CLASS) return false
if (classOrObject.isLocal) return false
if (classDescriptor.isInline) return false
if (classDescriptor.isInlineClass()) return false
if (shouldHideConstructorDueToInlineClassTypeValueParameters(constructorDescriptor)) return false
if (DescriptorUtils.isSealedClass(classDescriptor)) return false
if (CodegenBinding.canHaveOuter(state.bindingContext, classDescriptor)) return false

View File

@@ -19,14 +19,10 @@ package org.jetbrains.kotlin.codegen;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.FileMapping;
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
import org.jetbrains.org.objectweb.asm.ClassVisitor;
import org.jetbrains.org.objectweb.asm.FieldVisitor;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
import org.jetbrains.org.objectweb.asm.*;
public abstract class DelegatingClassBuilder implements ClassBuilder {
@NotNull
@@ -58,6 +54,14 @@ public abstract class DelegatingClassBuilder implements ClassBuilder {
return getDelegate().newMethod(origin, access, name, desc, signature, exceptions);
}
@NotNull
@Override
public RecordComponentVisitor newRecordComponent(
@NotNull String name, @NotNull String desc, @Nullable String signature
) {
return getDelegate().newRecordComponent(name, desc, signature);
}
@NotNull
@Override
public JvmSerializationBindings getSerializationBindings() {

View File

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

View File

@@ -61,7 +61,8 @@ import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvmInterface;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
import static org.jetbrains.kotlin.resolve.inline.InlineOnlyKt.isInlineOnlyPrivateInBytecode;
import static org.jetbrains.kotlin.resolve.inline.InlineOnlyKt.isInlineWithReified;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.JAVA_STRING_TYPE;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
import static org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt.hasJvmSyntheticAnnotation;
import static org.jetbrains.kotlin.types.TypeUtils.isNullableType;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
@@ -188,8 +189,7 @@ public class DescriptorAsmUtil {
if (functionDescriptor.getModality() == Modality.FINAL && !(functionDescriptor instanceof ConstructorDescriptor)) {
DeclarationDescriptor containingDeclaration = functionDescriptor.getContainingDeclaration();
if (!(containingDeclaration instanceof ClassDescriptor) ||
((ClassDescriptor) containingDeclaration).getKind() != ClassKind.INTERFACE) {
if (!isJvmInterface(containingDeclaration)) {
flags |= ACC_FINAL;
}
}
@@ -217,7 +217,7 @@ public class DescriptorAsmUtil {
private static boolean isInlineClassWrapperConstructor(@NotNull FunctionDescriptor functionDescriptor, @Nullable OwnerKind kind) {
if (!(functionDescriptor instanceof ConstructorDescriptor)) return false;
ClassDescriptor classDescriptor = ((ConstructorDescriptor) functionDescriptor).getConstructedClass();
return classDescriptor.isInline() && kind == OwnerKind.IMPLEMENTATION;
return InlineClassesUtilsKt.isInlineClass(classDescriptor) && kind == OwnerKind.IMPLEMENTATION;
}
public static int getCommonCallableFlags(FunctionDescriptor functionDescriptor, @NotNull GenerationState state) {
@@ -369,6 +369,18 @@ public class DescriptorAsmUtil {
return ACC_PRIVATE;
}
// Sealed class constructors should be ACC_PRIVATE.
// In 1.4 and before, sealed class constructors had PRIVATE visibility, and were represented as private methods in bytecode.
// In 1.5 (+AllowSealedInheritorsInDifferentFilesOfSamePackage), sealed class constructors became INTERNAL,
// but still should be represented as private methods in bytecode in order to prevent inheriting from sealed classes on JVM.
if (memberDescriptor instanceof ConstructorDescriptor &&
!(memberDescriptor instanceof AccessorForConstructorDescriptor) &&
isSealedClass(((ConstructorDescriptor) memberDescriptor).getConstructedClass()) &&
memberDescriptor.getVisibility() != DescriptorVisibilities.PUBLIC
) {
return ACC_PRIVATE;
}
if (isInlineOnlyPrivateInBytecode(memberDescriptor)) {
return ACC_PRIVATE;
}
@@ -560,7 +572,7 @@ public class DescriptorAsmUtil {
if (receiverKotlinType.isMarkedNullable()) return null;
DeclarationDescriptor receiverTypeDescriptor = receiverKotlinType.getConstructor().getDeclarationDescriptor();
assert receiverTypeDescriptor instanceof ClassDescriptor && ((ClassDescriptor) receiverTypeDescriptor).isInline() :
assert receiverTypeDescriptor != null && InlineClassesUtilsKt.isInlineClass(receiverTypeDescriptor) :
"Inline class type expected: " + receiverKotlinType;
ClassDescriptor receiverClassDescriptor = (ClassDescriptor) receiverTypeDescriptor;
FunctionDescriptor toStringDescriptor = receiverClassDescriptor.getUnsubstitutedMemberScope()
@@ -894,4 +906,19 @@ public class DescriptorAsmUtil {
//Trait always should have this descriptor
return kind != OwnerKind.DEFAULT_IMPLS && isStaticMethod(kind, descriptor) ? 0 : 1;
}
public static boolean isHiddenConstructor(FunctionDescriptor descriptor) {
if (!(descriptor instanceof ClassConstructorDescriptor)) return false;
ClassConstructorDescriptor classConstructorDescriptor = (ClassConstructorDescriptor) descriptor;
if (InlineClassManglingRulesKt.shouldHideConstructorDueToInlineClassTypeValueParameters(descriptor)) {
return true;
}
if (isSealedClass(classConstructorDescriptor.getConstructedClass()) &&
classConstructorDescriptor.getVisibility() != DescriptorVisibilities.PUBLIC
) {
return true;
}
return false;
}
}

View File

@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver
import org.jetbrains.kotlin.resolve.JVM_INLINE_ANNOTATION_FQ_NAME
import org.jetbrains.kotlin.resolve.descriptorUtil.secondaryConstructors
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.diagnostics.Synthetic
@@ -55,6 +56,13 @@ class ErasedInlineClassBodyCodegen(
generateUnboxMethod()
generateFunctionsFromAny()
generateSpecializedEqualsStub()
generateJvmInlineAnnotation()
}
private fun generateJvmInlineAnnotation() {
if (descriptor.isInline) {
v.newAnnotation(JVM_INLINE_ANNOTATION_FQ_NAME.topLevelClassAsmType().descriptor, true).visitEnd()
}
}
private fun generateFunctionsFromAny() {

View File

@@ -44,14 +44,17 @@ import org.jetbrains.kotlin.codegen.when.SwitchCodegen;
import org.jetbrains.kotlin.codegen.when.SwitchCodegenProvider;
import org.jetbrains.kotlin.config.ApiVersion;
import org.jetbrains.kotlin.config.JVMAssertionsMode;
import org.jetbrains.kotlin.config.JVMConfigurationKeys;
import org.jetbrains.kotlin.config.LanguageFeature;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor;
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor;
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor;
import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.load.java.DescriptorsJvmAbiUtil;
import org.jetbrains.kotlin.load.java.descriptors.JavaPropertyDescriptor;
import org.jetbrains.kotlin.load.kotlin.DescriptorBasedTypeSignatureMappingKt;
import org.jetbrains.kotlin.load.kotlin.MethodSignatureMappingKt;
import org.jetbrains.kotlin.name.Name;
@@ -71,7 +74,10 @@ import org.jetbrains.kotlin.resolve.constants.*;
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluatorKt;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.resolve.jvm.*;
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices;
import org.jetbrains.kotlin.resolve.jvm.JvmConstantsKt;
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
@@ -373,22 +379,17 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
FunctionDescriptor functionDescriptor = (FunctionDescriptor) descriptor;
if (!functionDescriptor.isSuspend()) return stackValue;
// When we call suspend operator fun invoke using parens, we cannot box receiver as return type inline class
if (resolvedCall instanceof VariableAsFunctionResolvedCall &&
functionDescriptor.isOperator() && functionDescriptor.getName().getIdentifier().equals("invoke")
) return stackValue;
KotlinType unboxedInlineClass = CoroutineCodegenUtilKt
.originalReturnTypeOfSuspendFunctionReturningUnboxedInlineClass(functionDescriptor, typeMapper);
StackValue stackValueToWrap = stackValue;
KotlinType originalKotlinType;
if (unboxedInlineClass != null) {
originalKotlinType = unboxedInlineClass;
} else {
originalKotlinType = stackValueToWrap.kotlinType;
}
Type originalType;
if (unboxedInlineClass != null) {
originalType = typeMapper.mapType(unboxedInlineClass);
} else {
originalType = stackValueToWrap.type;
}
KotlinType originalKotlinType = unboxedInlineClass != null ? unboxedInlineClass : stackValueToWrap.kotlinType;
Type originalType = unboxedInlineClass != null ? typeMapper.mapType(unboxedInlineClass) : stackValueToWrap.type;
stackValue = new StackValue(originalType, originalKotlinType) {
@Override
@@ -744,7 +745,11 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
// Some forms of for-loop can be optimized as post-condition loops.
PseudoInsnsKt.fakeAlwaysFalseIfeq(v, continueLabel);
// Renew line number cause it could be reset by inline (resetLastLineNumber) in generator.checkPreCondition(loopExit).
markStartLineNumber(generator.getForExpression());
v.nop();
generator.beforeBody();
blockStackElements.push(new LoopBlockStackElement(loopExit, continueLabel, targetLabel(generator.getForExpression())));
generator.body();
blockStackElements.pop();
@@ -1193,7 +1198,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
ClassDescriptor captureThis = closure.getCapturedOuterClassDescriptor();
if (captureThis != null) {
StackValue thisOrOuter = generateThisOrOuter(captureThis, false);
assert !isPrimitive(thisOrOuter.type) || captureThis.isInline() :
assert !isPrimitive(thisOrOuter.type) || InlineClassesUtilsKt.isInlineClass(captureThis) :
"This or outer for " + captureThis + " should be non-primitive: " + thisOrOuter.type;
callGenerator.putCapturedValueOnStack(thisOrOuter, thisOrOuter.type, paramIndex++);
}
@@ -1705,26 +1710,38 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
Type returnType;
KotlinType returnKotlinType;
if (isNonLocalReturn) {
// This is inline lambda. Find inline-site and check, whether it is suspend functions returning unboxed inline class
CodegenContext<?> inlineSiteContext = this.context.getFirstCrossInlineOrNonInlineContext();
KotlinType originalInlineClass = null;
boolean invokeSuspendOfLambda = false;
FunctionDescriptor inlineSiteDescriptor = null;
if (inlineSiteContext instanceof MethodContext) {
inlineSiteDescriptor = ((MethodContext) inlineSiteContext).getFunctionDescriptor();
originalInlineClass = CoroutineCodegenUtilKt
.originalReturnTypeOfSuspendFunctionReturningUnboxedInlineClass(inlineSiteDescriptor, typeMapper);
invokeSuspendOfLambda = CoroutineCodegenUtilKt.isInvokeSuspendOfLambda(inlineSiteDescriptor);
}
if (originalInlineClass != null) {
returnType = typeMapper.mapType(originalInlineClass);
returnKotlinType = originalInlineClass;
} else if (!invokeSuspendOfLambda) {
returnType = nonLocalReturn.returnType.getType();
returnKotlinType = nonLocalReturn.returnType.getKotlinType();
} else {
FunctionDescriptor returnTarget =
nonLocalReturn.descriptor instanceof FunctionDescriptor
? (FunctionDescriptor) nonLocalReturn.descriptor
: null;
if (returnTarget == null || !returnTarget.isSuspend()) {
JvmKotlinType jvmKotlinType = nonLocalReturn.getJvmKotlinType(typeMapper);
returnType = jvmKotlinType.getType();
returnKotlinType = jvmKotlinType.getKotlinType();
} else if (returnTarget instanceof AnonymousFunctionDescriptor) {
// Suspend lambdas always return Any?
returnType = OBJECT_TYPE;
returnKotlinType = inlineSiteDescriptor.getReturnType();
returnKotlinType = state.getModule().getBuiltIns().getNullableAnyType();
} else {
// This is inline lambda, but return target is ordinary, yet suspend, function.
// Find inline-site and check, whether it is suspend functions returning unboxed inline class
CodegenContext<?> inlineSiteContext = this.context.getFirstCrossInlineOrNonInlineContext();
KotlinType originalInlineClass = null;
if (inlineSiteContext instanceof MethodContext) {
FunctionDescriptor view = CoroutineCodegenUtilKt.getOrCreateJvmSuspendFunctionView(returnTarget, state);
originalInlineClass =
CoroutineCodegenUtilKt.originalReturnTypeOfSuspendFunctionReturningUnboxedInlineClass(view, typeMapper);
}
if (originalInlineClass != null) {
// As an optimization, suspend functions, returning inline classes with reference underlying
// type return unboxed inline class. Save the type so the coercer will not box it.
returnType = typeMapper.mapType(originalInlineClass);
returnKotlinType = originalInlineClass;
} else {
JvmKotlinType jvmKotlinType = nonLocalReturn.getJvmKotlinType(typeMapper);
returnType = jvmKotlinType.getType();
returnKotlinType = jvmKotlinType.getKotlinType();
}
}
}
else {
@@ -1788,13 +1805,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
FunctionDescriptor containingFunction =
BindingContextUtils.getContainingFunctionSkipFunctionLiterals(descriptor, true).getFirst();
//FIRST_FUN_LABEL to prevent clashing with existing labels
return new NonLocalReturnInfo(
new JvmKotlinType(
typeMapper.mapReturnType(containingFunction),
containingFunction.getReturnType()
),
FIRST_FUN_LABEL
);
return new NonLocalReturnInfo(containingFunction, FIRST_FUN_LABEL);
} else {
//local
return null;
@@ -1807,10 +1818,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
assert element != null : "Expression should be not null " + expression.getText();
assert elementDescriptor != null : "Descriptor should be not null: " + element.getText();
CallableDescriptor function = (CallableDescriptor) elementDescriptor;
return new NonLocalReturnInfo(
new JvmKotlinType(typeMapper.mapReturnType(function), function.getReturnType()),
expression.getLabelName()
);
return new NonLocalReturnInfo(function, expression.getLabelName());
}
}
return null;
@@ -2404,9 +2412,14 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
fieldName = KotlinTypeMapper.mapDefaultFieldName(propertyDescriptor, isDelegatedProperty);
}
KotlinType propertyType = propertyDescriptor.getOriginal().getType();
if (propertyDescriptor instanceof JavaPropertyDescriptor && InlineClassesUtilsKt.isInlineClassType(propertyType)) {
propertyType = TypeUtils.makeNullable(propertyType);
}
return StackValue.property(
propertyDescriptor, backingFieldOwner,
typeMapper.mapType(isDelegatedProperty && forceField ? delegateType : propertyDescriptor.getOriginal().getType()),
typeMapper.mapType(isDelegatedProperty && forceField ? delegateType : propertyType),
isStaticBackingField, fieldName, callableGetter, callableSetter, receiver, this, resolvedCall, skipLateinitAssertion,
isDelegatedProperty && forceField ? delegateType : null
);
@@ -2513,21 +2526,39 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
// $default method is not private, so you need no accessor to call it
return descriptor;
}
else if (InlineClassManglingRulesKt.shouldHideConstructorDueToInlineClassTypeValueParameters(descriptor.getOriginal())) {
// Constructors with inline class type value parameters should always be called using an accessor.
// NB this will require accessors even if the constructor itself is in a different module.
return new AccessorForConstructorDescriptor(
(ClassConstructorDescriptor) descriptor.getOriginal(),
descriptor.getContainingDeclaration(),
getSuperCallTarget(resolvedCall.getCall()),
AccessorKind.NORMAL
);
else if (shouldForceAccessorForConstructor(descriptor.getOriginal())) {
return createAccessorForHiddenConstructor(resolvedCall, descriptor);
}
else {
return context.accessibleDescriptor(descriptor, getSuperCallTarget(resolvedCall.getCall()));
}
}
private boolean shouldForceAccessorForConstructor(FunctionDescriptor descriptor) {
// Force using accessors on hidden constructors only
if (!isHiddenConstructor(descriptor)) {
return false;
}
// Don't use accessor when calling hidden constructor from the same class.
if (descriptor.getContainingDeclaration() == context.getContextDescriptor().getContainingDeclaration()) {
return false;
}
return true;
}
@NotNull
private AccessorForConstructorDescriptor createAccessorForHiddenConstructor(
@NotNull ResolvedCall<?> resolvedCall,
FunctionDescriptor descriptor
) {
return new AccessorForConstructorDescriptor(
(ClassConstructorDescriptor) descriptor.getOriginal(),
descriptor.getContainingDeclaration(),
getSuperCallTarget(resolvedCall.getCall()),
AccessorKind.NORMAL
);
}
@NotNull
public StackValue invokeFunction(@NotNull ResolvedCall<?> resolvedCall, @NotNull StackValue receiver) {
return invokeFunction(resolvedCall.getCall(), resolvedCall, receiver);
@@ -2662,7 +2693,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
}
@NotNull
Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall resolvedCall) {
Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall<?> resolvedCall) {
IntrinsicMethod intrinsic = state.getIntrinsics().getIntrinsic(fd);
if (intrinsic != null) {
return intrinsic.toCallable(fd, superCall, resolvedCall, this);
@@ -2670,7 +2701,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
fd = SamCodegenUtil.resolveSamAdapter(fd);
if (ArgumentGeneratorKt.shouldInvokeDefaultArgumentsStub(resolvedCall)) {
List<ResolvedValueArgument> valueArguments = resolvedCall.getValueArgumentsByIndex();
if (valueArguments != null && valueArguments.stream().anyMatch(it -> it instanceof DefaultValueArgument)) {
// When we invoke a function with some arguments mapped as defaults,
// we later reroute this call to an overridden function in a base class that processes the default arguments.
// If the base class is generic, this overridden function can have a different Kotlin signature
@@ -2680,7 +2712,21 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
fd = ArgumentGeneratorKt.getFunctionWithDefaultArguments(fd);
}
return typeMapper.mapToCallableMethod(fd, superCall, null, resolvedCall);
CallableMethod method = typeMapper.mapToCallableMethod(fd, superCall, null, resolvedCall);
if (method.getAsmMethod().getName().contains("-") &&
!state.getConfiguration().getBoolean(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME)
) {
Boolean classFileContainsMethod =
InlineClassesCodegenUtilKt.classFileContainsMethod(fd, state, method.getAsmMethod());
if (classFileContainsMethod != null && !classFileContainsMethod) {
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(true);
method = typeMapper.mapToCallableMethod(fd, superCall, null, resolvedCall);
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(false);
}
}
return method;
}
public void invokeMethodWithArguments(
@@ -2896,6 +2942,17 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
sourceCompiler.initializeInlineFunctionContext(functionDescriptor);
JvmMethodSignature signature = typeMapper.mapSignatureWithGeneric(functionDescriptor, sourceCompiler.getContextKind());
if (signature.getAsmMethod().getName().contains("-") &&
!state.getConfiguration().getBoolean(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME)
) {
Boolean classFileContainsMethod =
InlineClassesCodegenUtilKt.classFileContainsMethod(functionDescriptor, state, signature.getAsmMethod());
if (classFileContainsMethod != null && !classFileContainsMethod) {
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(true);
signature = typeMapper.mapSignatureWithGeneric(functionDescriptor, sourceCompiler.getContextKind());
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(false);
}
}
Type methodOwner = typeMapper.mapImplementationOwner(functionDescriptor);
if (isDefaultCompilation) {
return new InlineCodegenForDefaultBody(functionDescriptor, this, state, methodOwner, signature, sourceCompiler);
@@ -4350,6 +4407,10 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
Type exprType = expressionType(expr);
KotlinType exprKotlinType = kotlinType(expr);
if (exprKotlinType != null && InlineClassesUtilsKt.isInlineClassType(exprKotlinType) &&
FlexibleTypesKt.isNullabilityFlexible(exprKotlinType)) {
exprKotlinType = TypeUtils.makeNullable(exprKotlinType);
}
StackValue value;
if (compileTimeConstant != null) {
value = StackValue.constant(compileTimeConstant.getValue(), exprType, exprKotlinType);
@@ -4805,7 +4866,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
ReceiverParameterDescriptor dispatchReceiver = constructor.getDispatchReceiverParameter();
ClassDescriptor containingDeclaration = constructor.getContainingDeclaration();
if (!containingDeclaration.isInline()) {
if (!InlineClassesUtilsKt.isInlineClass(containingDeclaration)) {
v.anew(objectType);
v.dup();
}
@@ -5427,14 +5488,18 @@ The "returned" value of try expression with no finally is either the last expres
private static class NonLocalReturnInfo {
private final JvmKotlinType returnType;
private final CallableDescriptor descriptor;
private final String labelName;
private NonLocalReturnInfo(@NotNull JvmKotlinType type, @NotNull String name) {
returnType = type;
private NonLocalReturnInfo(@NotNull CallableDescriptor descriptor, @NotNull String name) {
this.descriptor = descriptor;
labelName = name;
}
private JvmKotlinType getJvmKotlinType(@NotNull KotlinTypeMapper typeMapper) {
return new JvmKotlinType(typeMapper.mapReturnType(descriptor), descriptor.getReturnType());
}
}
@NotNull

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