Compare commits

...

149 Commits

Author SHA1 Message Date
Svyatoslav Scherbina
7de3a4cb29 Add LanguageFeature prohibiting exposing function type parameter bound
#KT-27112
2018-09-26 13:56:01 +03:00
Nikolay Krasko
412611acd6 Don't choose navigation target only by index (KT-26004)
There might be situation when platform code has a declaration with
another signature and the same fqname, but navigating to common
declaration is expected.

 #KT-26004 Fixed
2018-09-26 11:01:00 +03:00
Nikolay Krasko
9b01b5ad59 Remove old buildIterator import (KT-26679) 2018-09-26 11:01:00 +03:00
Nikolay Krasko
a422759e54 Report jre deprecated warning when version is set implicitly (KT-26933)
#KT-26933 Fixed
2018-09-26 11:01:00 +03:00
Dmitry Petrov
64f3540c89 Postpone companion object field visibility
Have to reconsider this issue because of interface companion objects.
2018-09-26 09:20:35 +03:00
Alexey Sedunov
1f4a0fe5ae MPP: Do not populate content roots in the absence of ExternalProject
#KT-26900 Fixed
2018-09-25 18:01:09 +03:00
Alexey Sedunov
f969403405 MPP: Reset JDK for JVM modules
#KT-26937 Fixed
2018-09-25 18:01:09 +03:00
Ilya Gorbunov
e258fde2af Remove workaround for complex default value in Array.copyInto
#KT-22818

(cherry picked from commit 974837654e)
2018-09-25 17:49:01 +03:00
Ilya Gorbunov
5829437933 Advance bootstrap to 1.3.0-rc-74 2018-09-25 17:49:01 +03:00
Mikhail Zarechenskiy
d576348990 Add inference annotations to the dumped declarations 2018-09-25 17:48:39 +03:00
Ilya Chernikov
9fa62d7b3c Add kotlin-main-kts.jar to the dist 2018-09-25 14:07:17 +02:00
Ilya Chernikov
31a389d317 Fix proguarding of the main-kts 2018-09-25 13:42:24 +02:00
Alexey Sedunov
99b0352d86 Configuration: Fix JVM target detection in the absence of Kotlin facet
#KT-27021 Fixed
2018-09-25 13:38:22 +03:00
Yan Zhulanow
09cc8d0e2b Fix compatibility with JPS-standalone (KT-26777) 2018-09-25 13:35:18 +03:00
Mikhail Glukhikh
1983570688 MPP wizard: add skeleton for shared JVM/JS/iOS project
Part of KT-26786

(cherry picked from commit 83faba6424)
2018-09-25 13:11:43 +03:00
Mikhail Glukhikh
65c164892f MPP wizard: add skeleton for JVM/JS project
Part of KT-26786

(cherry picked from commit 47baaf10c6)
2018-09-25 13:11:28 +03:00
Mikhail Glukhikh
bd1eefc432 Enable feature: add test for JPS case
(cherry picked from commit 6850d7be0c)
2018-09-25 13:09:41 +03:00
Mikhail Glukhikh
06f73005ad Extract shouldConfigureInProject to AbstractChangeFeatureSupportLevelFix
(cherry picked from commit c5a81c4e8b)
2018-09-25 13:09:41 +03:00
Mikhail Glukhikh
b2dc504504 Enable / disable feature: update Gradle build script bunch for 173
(cherry picked from commit 7030a485be)
2018-09-25 13:09:41 +03:00
Mikhail Glukhikh
0fdae44562 Add enable / disable feature in JPS
#KT-26775 Fixed
#KT-26774 Fixed

(cherry picked from commit f6b805a973)
2018-09-25 13:09:41 +03:00
Mikhail Glukhikh
7ba48146fc Add enable / disable feature in Maven project
Part of KT-26775

(cherry picked from commit 8a7ff4cd24)
2018-09-25 13:09:40 +03:00
Mikhail Glukhikh
cb4068ba6c Add enable / disable feature in Gradle (Kotlin DSL) project
Part of KT-26775

(cherry picked from commit 106db57975)
2018-09-25 13:09:40 +03:00
Mikhail Glukhikh
0a2e0ef406 Add enable / disable feature in Gradle (Groovy) project, forTests option
Part of KT-26775

(cherry picked from commit 43e4616fdf)
2018-09-25 13:09:40 +03:00
Mikhail Glukhikh
789b2db7b5 Introduce skeleton for ChangeGeneralLanguageFeatureSupportFix
Part of KT-26775 and KT-26774

(cherry picked from commit b194be7665)
2018-09-25 13:09:40 +03:00
Mikhail Glukhikh
edbc1ac405 Extract AbstractChangeFeature...Fix from ChangeCoroutineSupportFix
Part of KT-26775 implementation

(cherry picked from commit fd3dfe0710)
2018-09-25 13:09:39 +03:00
Mikhail Glukhikh
2355ea791a Delete unnecessary bunches for KotlinMavenConfigurator
One private fun (instead of public) is the only difference here

(cherry picked from commit 125a136663)
2018-09-25 13:09:39 +03:00
Ilmir Usmanov
ca3bec732e Minor. Split tests with buildSequence into LV 1.2 and LV 1.3 versions
(cherry picked from commit c4038729ea)
2018-09-25 02:03:10 +03:00
Anton Bannykh
fd64b50c54 JS: fix line number data
(cherry picked from commit 66b5dd92d9)
2018-09-25 02:03:10 +03:00
Mikhail Zarechenskiy
0e4e1b6941 Fix test about version requirement
We began to write version requirement on declarations with `Result` and
 now (after bootstrap) we are getting error in this test because of that
 version requirement.

 see 908be10bf4

(cherry picked from commit 09cd038e4b)
2018-09-25 02:03:10 +03:00
Ilya Gorbunov
8b5c5fb16a Use modern API of Kotlin 1.3 in JS canvas examples
(cherry picked from commit 0ca59b3a40)
2018-09-25 02:03:10 +03:00
Alexander Udalov
51b848c67f Do not report experimental usage errors in import statements
#KT-25545 Fixed

(cherry picked from commit 3e90d367f2)
2018-09-24 17:59:50 +02:00
Alexander Udalov
969828bf81 Use non-allowed actual defaults in backends to workaround compiler exception
It's difficult to fix KT-22818 until the IR comes along, so we're
providing a workaround where one can disable the
ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS error and provide default values
in the actual function, to avoid exception from the backend.

 #KT-22818

(cherry picked from commit 3ca81b95c2)
2018-09-24 17:59:43 +02:00
Ilya Matveev
1bd837007e Update Kotlin/Native: 0.9.2 2018-09-24 18:50:06 +03:00
Ilya Matveev
3dfba8272f Pass absolute library paths to native compiler 2018-09-24 18:49:57 +03:00
Ilya Chernikov
076ccca14f Fix script util tests after moving context utils to scripting-jvm 2018-09-21 19:21:08 +02:00
Denis Zharkov
e8e73bce15 Fix bunch files for test RunConfigurationTest 2018-09-21 18:32:12 +03:00
Anton Bannykh
b6b01dd4c5 JS: fix unsigned literal inlining
(cherry picked from commit 6736987239)
2018-09-21 16:08:40 +03:00
Ilya Matveev
2a24d9cb5a Update Kotlin/Native: 0.9.2-dev-4008 2018-09-20 14:19:26 +03:00
Mikhail Zarechenskiy
4e51cef541 Support coroutine inference under version <= 1.2
Follow-up #KT-26958
2018-09-20 13:56:03 +03:00
Yan Zhulanow
67bb952df9 Do not discover script extensions for Kapt stub generation tasks (KT-26974) 2018-09-19 22:51:30 +03:00
Alexander Udalov
0969f95dfa Add ChangeLog for 1.3-RC 2018-09-19 20:39:57 +03:00
Nikolay Krasko
f0eb72ad6b Migrate for moved and renamed buildSequence/buildIterator (KT-26679)
#KT-26679 Fixed

(cherry picked from commit 64d2cdf0c2)
2018-09-19 12:48:58 +03:00
Nikolay Krasko
85e0a1b7bc Refactoring: move each problem to a separate class
(cherry picked from commit 082801efb4)
2018-09-19 12:48:58 +03:00
Ilya Gorbunov
02e276ce30 Mix kotlin-annotations-jvm with kotlin-reflect into proguard
So it can strip these annotations from the resulting jar.

#KT-26929 Fixed

(cherry picked from commit 86ba5ebf29)
2018-09-19 12:41:24 +03:00
Alexander Udalov
c029a34e0d Report warning instead of error on usages of Experimental/UseExperimental
#KT-26936 Fixed

(cherry picked from commit 8c01cd4)
2018-09-18 22:52:24 +03:00
Ilya Gorbunov
c008822d9f Simplify comparisons for small unsigned types that can fit in Int
UByte and UShort can be extended to Int exactly and then compared as ints

(cherry picked from commit 1d7ee22bdc)
2018-09-18 22:42:55 +03:00
Ilya Gorbunov
1af800a07f Make overridden compareTo in unsigned types inline only
(cherry picked from commit af29dced98)
2018-09-18 22:42:52 +03:00
Ilya Gorbunov
0484a51a50 Make most of unsigned operations inline only
(cherry picked from commit 9e0708e85a)
2018-09-18 22:42:50 +03:00
Ilya Gorbunov
76e5e84a56 Extract unsigned type related extensions to separate classes
- Rename class with unsigned number to string conversions to UStringsKt
- Extract Random unsigned extensions to URandomKt

(cherry picked from commit d793221a7b)
2018-09-18 22:42:47 +03:00
Ilya Matveev
29be9d447a Serialize native compiler args
(cherry picked from commit 7d6adbd)
2018-09-18 21:52:47 +03:00
Ilya Chernikov
2cd5354c22 Make ivy resolver quiet 2018-09-18 18:37:02 +02:00
Mikhail Zarechenskiy
5c266ba184 Add BuildInference annotation onto stdlib coroutine builders 2018-09-18 19:24:45 +03:00
Mikhail Zarechenskiy
7cdc9612f7 Migration change: temporarily specify type explicitly
Because of introduction of `BuilderInference` annotation.
 Change it back after bootstrap
2018-09-18 19:24:44 +03:00
Mikhail Zarechenskiy
c169610b57 Introduce builder-like inference with an explicit opt-in for it
- Add marker for the experimental type inference features
 - Add annotation that will control builder-like inference
 - Require that annotation on corresponding parameters and extensions
 - Allow to use builder inference without suspendability

 Changes in tests and refactorings (rename mainly) are going to be
 introduced in further commits
2018-09-18 19:24:42 +03:00
Mikhail Zarechenskiy
181fb81473 Minor: invert logic of function 2018-09-18 19:24:41 +03:00
Nikolay Krasko
e980c75cab Fix compilation error in MavenMigrateTest.kt 2018-09-18 18:21:46 +03:00
Simon Ogorodnik
ab1f8af88b [K/N] Hack to enable exporting interop libraries 2018-09-18 17:59:15 +03:00
Dmitriy Dolovov
1655c3a7ca [K/N] Fix: Obsolete text stubs after updating K/N library
Issue #KT-26736 Fixed
2018-09-18 17:59:14 +03:00
Dmitriy Dolovov
76ebec5d37 [K/N] Proper invalidation of metadata cache in IDEA by VFS events 2018-09-18 17:59:13 +03:00
Simon Ogorodnik
5e54f84ecd Support forward declarations for Native via hack-ing into built-ins 2018-09-18 17:59:12 +03:00
Simon Ogorodnik
a847efdef7 Create Native specific LibraryInfo
This LibraryInfo contains KonanLibrary and provides correct
capabilities to ModuleDescriptor
2018-09-18 17:59:12 +03:00
Simon Ogorodnik
40607b14a9 Add function to get typed capability from ModuleInfo 2018-09-18 17:59:11 +03:00
Simon Ogorodnik
a5074a91ab Add factory function to create platform specific LibraryInfo's 2018-09-18 17:59:10 +03:00
Simon Ogorodnik
943259dfcb Do not throw exception on not-found serialized class from knm 2018-09-18 17:59:10 +03:00
Simon Ogorodnik
0fa3c9b338 Support free-form .knm package part names 2018-09-18 17:59:09 +03:00
Simon Ogorodnik
f832890360 Support for split-packages in Kotlin Native
See JetBrains/kotlin-native#2034
2018-09-18 17:59:08 +03:00
Nikolay Krasko
986f999206 Don't show migration dialog if no actual migrations are available (KT-26889)
#KT-26889 Fixed
2018-09-18 17:46:12 +03:00
Nikolay Krasko
44c07154a2 Postpone migration till indexes are ready (KT-26428)
#KT-26428 Fixed
2018-09-18 17:46:12 +03:00
Ilya Gorbunov
7aa291076d Fix sourcemap of stdlib/js to include new source sets
(cherry picked from commit cb47b0cde1)
2018-09-18 16:19:38 +03:00
Ilya Matveev
b9b94c4fe3 Support OptionalExpectation in native 2018-09-18 15:58:25 +03:00
Ilmir Usmanov
4add819658 Forbid suspension points in critical sections
#KT-26480: Fixed
2018-09-18 13:53:16 +03:00
Vyacheslav Gerasimov
30df42743d Add compatibility artifact with Mutable and ReadOnly annotations into dist
#KT-26916 Fixed
2018-09-18 13:35:07 +03:00
Ilya Matveev
09467ddc9d Use Kotlin/Native 0.9.1 (#1872) 2018-09-17 19:38:54 +03:00
Ilya Matveev
f9ef065c7b Don't add cinterop libraries in compilation output (#1871) 2018-09-17 19:38:46 +03:00
Ilya Matveev
ecc384fbfc Provide a DSL for publication settings (#1869)
* Provide a DSL for publication settings
* Rename DSL method publication -> mavenPublication
* Fix gradle task input/output validation

 #KT-26771 fixed.
2018-09-17 19:38:25 +03:00
Denis Zharkov
fd31e28903 Do not build dummy light classes for serialization-related classes
Otherwise, whether LazyLightClassMemberMatchingError happens
or other type of errors because serialization plugin expects
full resolution in the correct module

Currently, only @Serializable annotation leads to exceptions,
but just in case we consider both of them as potentially problematic

 #KT-26895 Fixed
2018-09-17 19:10:26 +03:00
Alexander Podkhalyuzin
3d89a08022 JPS, native: skip and report native modules as not supported
#KT-26648 Fixed

(cherry picked from commit 9e6d6ad9da)
2018-09-17 18:55:14 +03:00
Sergey Rostov
8f07ea2348 JPS: fix daemon RPC serialization
#KT-26809 Fixed

(cherry picked from commit 39c76c7b11)
2018-09-17 18:55:12 +03:00
Dmitriy Dolovov
d52c49cf59 Move NativeIdePlatformKind to idea-jps-common
Issue #KT-26714 Fixed

(cherry picked from commit 0c94aefb87)
2018-09-17 18:55:11 +03:00
Mikhail Zarechenskiy
3dc3ce4c6e Don't throw exception on error types in light classes mode
#KT-26829 Fixed
 #KT-26827 Fixed
2018-09-17 18:50:05 +03:00
Mikhail Zarechenskiy
0702d33970 Make generation of assertions for platform types aware of kotlin types
#KT-26859 Fixed
2018-09-17 18:50:03 +03:00
Mikhail Zarechenskiy
6e0ba8bd8a Do not try building light classes for inline classes in dumb mode
Generation of inline classes is quite complicated: we mangle methods,
 add stubs and synthesized methods. So, for simplicity, to avoid
 logic duplication in dummy resolve and in the backend, currently we
 will use only the latter for light classes generation

 #KT-26843 Fixed
2018-09-17 18:50:01 +03:00
Mikhail Zarechenskiy
6c7d062cd7 Properly load top-level constant initializers from multifile classes
Before Kotlin 1.3-M2 we didn't write `has_field` flag for constants
 inside multifile classes. Now we write and rely on this when
 trying to load constant initializers, which is totally fine for
 binaries that were compiled with the 1.3-M2 or newer version.
 Unfortunately, constant initializers will not be loaded for old binaries.

 One way is to avoid relying on this flag, but then we'll get other
 problems (e.g. 3345dc81fd).

 Therefore, for binaries that were compiled with at least 1.3-M2 version,
 we'll rely on the flag, otherwise, we won't.
2018-09-17 18:49:59 +03:00
Mikhail Zarechenskiy
d6e4309b39 Add regression test for KT-26806
#KT-26806
2018-09-17 18:49:58 +03:00
Ilya Chernikov
184742e779 Implement context classpath extraction using particular class,...
Use it in the main-kts.
Also improve diagnoistics related to the definition loading.

#KT-26828 fixed (after this commit - finally, see also another related commit)
2018-09-17 14:28:39 +02:00
Ilya Chernikov
aed19965c0 Move context classpath utils from script-util to scripting-jvm
since it is the right place to have it in the new structure.
Solves the problem that script-util classes not found then script
definition with context classpath is loaded by the scripting compiler
plugin, since script-util is not packed into embeddable plugin.
The old context utils are deprecated and in fact wrap the new utils.
#KT-26828 fixed (in fact - partially, see another related commit)
2018-09-17 14:28:22 +02:00
Nikolay Krasko
f7d5f989aa Clean accidentally committed temporary code
(cherry picked from commit 073f4f51fd)
2018-09-17 15:23:25 +03:00
Nikolay Krasko
38e661295e Bad indentation after annotation in incomplete declaration (KT-22322)
Same behavior is for any modifier in incomplete declaration.

 #KT-22322 Fixed

(cherry picked from commit 782aa94513)
2018-09-17 15:23:24 +03:00
Nikolay Krasko
88abe52633 Do not show incompatible error for *-rc13 coroutines (KT-26810)
#KT-26810 Fixed

(cherry picked from commit 94531f992d)
2018-09-17 15:23:24 +03:00
Nikolay Krasko
16b272a7cf Title and description unification for coroutines migration inspection (KT-26472)
(cherry picked from commit 8be1929634)
2018-09-17 15:23:24 +03:00
Nikolay Krasko
b270e19786 Enable Maven fix for coroutines in migration (KT-26472)
#KT-26472 Fixed

(cherry picked from commit 9bfbe8a90a)
2018-09-17 15:23:24 +03:00
Pavel V. Talanov
2763dd068d Remove as33 bunches specific to mpp run configs
It is now compatible with 182 branch
2018-09-17 13:54:43 +02:00
Pavel V. Talanov
7fd19555fc as33 branch 'since-build' is 182.4129.33 2018-09-17 13:54:22 +02:00
Pavel V. Talanov
ba3cdb7fb6 Update as33 branch to AS3.3 canary 10 release 2018-09-17 13:54:06 +02:00
Pavel V. Talanov
2ece6f579e Jest/Mocha run config producers: fix searching for test runner package
#KT-26793 Fixed
2018-09-17 13:53:45 +02:00
Pavel V. Talanov
c9010f2756 Gradle method/class configurations: support only jvm modules
Fixes a problem where invalid run configuration could be created
    for common module when 'Gradle Test Runner' option is selected
2018-09-17 13:53:23 +02:00
Ilya Gorbunov
fab69d2f22 Use new sequence builders in tests
Coroutine tests will fail when LV=1.2 because there're no such builders
in kotlin.coroutines.experimental.

#KT-26678

(cherry picked from commit 1b889c976a)
2018-09-17 14:38:48 +03:00
Ilya Gorbunov
b8d9f8dadd [JS IR BE] New sequence builder mocks for building stdlib
#KT-26678

(cherry picked from commit 7a7fa56d74)
2018-09-17 14:38:47 +03:00
Ilya Gorbunov
ea0cf43cec Rename sequence and iterator builder functions and their scope class
This introduces new functions instead of the existing sequence builders:
- `sequence` instead of `buildSequence`
- `iterator` instead of `buildIterator`
- `SequenceScope` instead of `SequenceBuilder`

The old functions were deprecated with error and made inline-only, and `SequenceBuilder` has been
made a deprecated typealias to `SequenceScope`.

Move sequence builders to `SequencesKt` facade class.

Replace sequence builder usages in stdlib and samples.

#KT-26678

(cherry picked from commit aac96c476a)
2018-09-17 14:38:47 +03:00
Ilya Gorbunov
13394a4669 Use new coroutines in samples
(cherry picked from commit 9c812c6e2b)
2018-09-17 14:38:47 +03:00
Denis Zharkov
94368f1afb Support deserialized contracts in common code
#KT-26687 Fixed
2018-09-17 12:58:50 +03:00
Alexey Sedunov
1ff86abdce MPP: Enable Android-specific content root logic for Android Studio
#KT-26813 Fixed

(cherry picked from commit 7b3973db52)
2018-09-17 11:47:32 +03:00
Alexey Sedunov
f87d2b2feb MPP: Allow 'implements' relation only within the same Gradle project
Also allow COMMON modules on the "implementer" side

(cherry picked from commit 619e2bc0db)
2018-09-17 11:47:32 +03:00
Alexey Sedunov
b20749e259 MPP: Exclude non-COMMON modules from 'implemented' list
(cherry picked from commit d5b3dc8a2a)
2018-09-17 11:47:32 +03:00
Alexey Sedunov
9e91cf2bf1 MPP: Update gradle plugin version in new MPP tests
(cherry picked from commit 5a64067601)
2018-09-17 11:47:32 +03:00
Alexey Sedunov
f17fe0bf0e MPP: Fix import of dependencies on Android modules
(cherry picked from commit 14d8425e27)
2018-09-17 11:47:32 +03:00
Alexey Sedunov
310a46ee73 MPP: Configure Kotlin facets for Android modules
#KT-26770 Fixed

(cherry picked from commit 1de0dbd67d)
2018-09-17 11:47:31 +03:00
Alexey Sedunov
56300b4ef7 MPP: Exclude COMMON modules from implementation list
(cherry picked from commit 9253f88220)
2018-09-17 11:47:31 +03:00
Alexey Sedunov
a0286c533f MPP: Add commonMain as a part of inter-project dependency
#KT-26383 Fixed

(cherry picked from commit 4970e90412)
2018-09-17 11:47:31 +03:00
Alexey Sedunov
7674acb45c MPP: Drop duplicating library produced by file collection dependency
#KT-26675 Fixed

(cherry picked from commit 469b11e0aa)
2018-09-17 11:47:31 +03:00
Alexey Sedunov
67114fcfdc MPP: Match project dependencies by target elements task
(cherry picked from commit 5ac64bcc1d)
2018-09-17 11:47:31 +03:00
Alexey Sedunov
64081b71f0 MPP: Force COMMON platform for commonMain/commonTest source sets
Follow-up for 172/AS3.1 bunches

(cherry picked from commit a417630c24)
2018-09-17 11:47:30 +03:00
Roman Elizarov
10032ee259 InlineOnly Result.getOrNull method 2018-09-16 23:16:24 +03:00
Roman Elizarov
a6ab49bf9d Removed SuccessOrFailure.
Left deprecated/error typealias to Result for 1.3-Mx users.
2018-09-16 23:16:24 +03:00
Roman Elizarov
4ec1ca807f Fixed unused exceptionOrNull result in map/mapCatching
(replaced with isSuccess check)
2018-09-16 23:16:23 +03:00
Nikolay Krasko
3b24b74340 Better parsing for external library name (KT-26794)
- Migration notification fixed
- Make fix for replacing old coroutines libraries applicable

 #KT-26794
2018-09-16 15:42:29 +03:00
Ilya Gorbunov
92c481cadf Stdlib: fix name shadowing and names of overridden method parameters
(cherry picked from commit b1c2daf1fe)
2018-09-15 00:22:44 +03:00
Ilya Gorbunov
dc4eb1e6c0 Stdlib: review and suppress warnings
(cherry picked from commit bf4be12239)
2018-09-15 00:22:42 +03:00
Ilya Gorbunov
b506b4d91a Stdlib tests: cleanup warnings
(cherry picked from commit 6786b9ece2)
2018-09-15 00:22:41 +03:00
Ilya Gorbunov
afb6552618 Change nextInt/Long with range parameters from members to extensions
We'd like to fix the implementation of these methods, so we could intrinsify them later
or perform other optimizations that are not possible when these methods are open.

(cherry picked from commit 7e0a658de7)
2018-09-15 00:22:39 +03:00
Ilya Gorbunov
42ea253765 Rename Random.next* parameters: remaining renames
- Correct docs after parameter renaming
- Rename parameters in Random inheritors
- Rename local variables

#KT-26596

(cherry picked from commit 928fe19801)
2018-09-15 00:22:38 +03:00
kenji tomita
e2561cb091 Rename Random.next* parameters from "origin, bound" to "from, until"
Rename Random test methods

#KT-26596

(cherry picked from commit ffb83bbdf0)
2018-09-15 00:22:36 +03:00
Leonid Startsev
4b6fa98c09 Add initialization of constantValueGenerator for correct work
Exception was thrown from serialization plugin after compiler
refactoring
2018-09-14 20:24:47 +03:00
Mikhail Glukhikh
f36e35070e MPP wizard: remove kotlin-stdlib-native & kotlin-test-native deps
Related to KT-25952

(cherry picked from commit 382379d785)
2018-09-14 19:49:03 +03:00
Raluca Sauciuc
4cbdaebb36 Expand the fix from commit 6c274cecff to cover AndroidX
Android Studio users who migrated to AndroidX are running into the
databinding deadlock again: https://issuetracker.google.com/111788726

(cherry picked from commit de989c4050)
2018-09-14 18:19:58 +03:00
Alexander Udalov
dac967d804 Do not report deprecation on readBytes with API version < 1.3
#KT-26667 Fixed

(cherry picked from commit 863c0051ce)
2018-09-14 16:21:37 +03:00
Dmitry Petrov
b930e6e8e8 Fix annotations loading for inline class constructors 2018-09-14 16:11:09 +03:00
Ilya Matveev
7c99348051 Add a project property for Kotlin/Native version overriding 2018-09-14 15:32:12 +03:00
Ilya Matveev
47f1ff8a36 Download native compiler in configuration stage 2018-09-14 15:31:11 +03:00
Alexander Udalov
c5fc729297 Support inline classes in function signatures in call/callBy
#KT-25664 Fixed
 #KT-26748 Open
 #KT-26765 Open

(cherry picked from commit 3a5de13dd4)
2018-09-14 14:42:49 +03:00
Alexander Udalov
da0fb1cbb0 Make CallerImpl with subclasses a sealed hierarchy
(cherry picked from commit 3e79bd2b0e)
2018-09-14 14:42:44 +03:00
Alexander Udalov
24a22fe127 Remove unneeded CallerImpl implementations
Also fix a bug where nullability of the assigned value was not checked
in ClassCompanionFieldSetter because it wasn't a subclass of FieldSetter
where this check occurred

(cherry picked from commit 8c8f0639f8)
2018-09-14 14:42:39 +03:00
Alexander Udalov
32c03876f2 Extract Caller interface out of FunctionCaller, move to subpackage
Also rename FunctionCaller to CallerImpl and extract irrelevant
declarations out of it

(cherry picked from commit 356b02cb91)
2018-09-14 14:42:35 +03:00
Alexander Udalov
6daa43895a Minor, use arrayOf to simplify code in FunctionCaller
(cherry picked from commit 43dcbbcce1)
2018-09-14 14:42:30 +03:00
Ilya Chernikov
82cc6ba1e3 Implement support for non-kts scripts in gradle
#KT-26784 fixed
2018-09-13 20:52:50 +02:00
Denis Zharkov
9fff156d6c Fix memory leak in KotlinBuiltins related to unsigned types
Having a map from ModuleDescriptor leads to modules leakage
Especially, it's critical for DefaultBuiltins which is used in JS

ModuleDescriptor's instances were leaked there forever until the daemon dies
(up to 350M while compiling Kotlin project itself)
2018-09-13 18:50:37 +03:00
Ilya Gorbunov
6129012d4f contentDeepToString: use list instead of set for infinite recursion tracking
#KT-26388

(cherry picked from commit 9353cfb526)
2018-09-13 17:22:25 +03:00
Ilya Gorbunov
dd4b0d7296 Specialize contentDeepEquals/HashCode/ToString for arrays of unsigned types
#KT-26388

(cherry picked from commit 2d356b89b5)
2018-09-13 17:22:23 +03:00
Ilya Gorbunov
f2bc5da814 Add annotations-13.0 in classpath of those tests where the annotations from stdlib were used
(cherry picked from commit 3cc606577c)
2018-09-13 17:20:13 +03:00
Ilya Gorbunov
5470b9a7a8 Do not use deprecated org.junit.Test in gradle js integration tests
(cherry picked from commit f340bc9f91)
2018-09-13 17:20:11 +03:00
Mikhail Glukhikh
36b84247b1 Allow to move suspend lambda out of parentheses
#KT-26674 Fixed
#KT-26676 Fixed

(cherry picked from commit 76d1d6ff12)
2018-09-13 17:08:42 +03:00
Mikhail Glukhikh
66352155df Introduce MPP wizard for shared (JVM / JS / iOS) libraries
This implements second part of KT-25952

(cherry picked from commit 941e5ae1b2)
2018-09-13 12:52:40 +03:00
Mikhail Glukhikh
7405c31d18 Kotlin JVM/JS multiplatform builder: change description
(cherry picked from commit 84587eb0f9)
2018-09-13 12:52:14 +03:00
Mikhail Glukhikh
f44b85b326 Change KonanPlatform platform name: Konan -> Native #KT-26691 Fixed
(cherry picked from commit 03820245eb)
2018-09-13 09:59:58 +03:00
Ilmir Usmanov
02d1d832f1 Use our own primitive boxing methods in coroutines codegen
#KT-26490 Fixed
2018-09-12 17:01:19 +03:00
Ilmir Usmanov
8e696bcbf1 Add our own primitive boxing methods to stdlib
These methods are very thin wrappers around primitive wrapper classes
constructors.
They are used by coroutines code which returns primitives and this way
HotSpot is able to throw the allocations away completely.
 #KT-26591 Fixed
2018-09-12 17:01:19 +03:00
Ilmir Usmanov
929957e963 Exclude kotlin.coroutines.intrinsics and kotlin.coroutines.jvm.internal
from default imports.
2018-09-12 17:01:18 +03:00
Alexander Podkhalyuzin
9f428daad9 Light classes should reuse language versions settings during generation
#KT-26732 Fixed

(cherry picked from commit 85ba637796)
2018-09-12 16:16:39 +03:00
Dmitry Petrov
1b519b340e Generate metadata and annotations for hidden constructor
Reflection expects to see a callable method for a hidden constructor,
thus, it should be a synthetic accessor.
JVM method signature in metadata should point to the synthetic accessor.
Annotations for hidden constructor should be written on the synthetic
accessor.
2018-09-12 15:37:20 +03:00
422 changed files with 8414 additions and 10373 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. 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
val DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS = listOf("kt", "kts")

View File

@@ -21,11 +21,8 @@ import java.io.File
fun File.isJavaFile() =
extension.equals("java", ignoreCase = true)
fun File.isKotlinFile(): Boolean =
extension.let {
"kt".equals(it, ignoreCase = true) ||
"kts".equals(it, ignoreCase = true)
}
fun File.isKotlinFile(sourceFilesExtensions: List<String>): Boolean =
!isJavaFile() && sourceFilesExtensions.any { it.equals(extension, ignoreCase = true) }
fun File.isClassFile(): Boolean =
extension.equals("class", ignoreCase = true)

View File

@@ -13,7 +13,7 @@ import proguard.gradle.ProGuardTask
buildscript {
extra["defaultSnapshotVersion"] = "1.3-SNAPSHOT"
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.3.0-dev-496", onlySuccessBootstrap = false))
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.3.0-rc-74", projectExtId = "Kotlin_130_Compiler", onlySuccessBootstrap = false))
repositories {
bootstrapKotlinRepo?.let(::maven)
@@ -511,7 +511,8 @@ tasks {
":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test",
":plugins:uast-kotlin:test",
":kotlin-annotation-processing-gradle:test")
":kotlin-annotation-processing-gradle:test",
":kotlinx-serialization-ide-plugin:test")
}

View File

@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.utils.DFS
object CodegenUtil {
@JvmStatic
@@ -200,16 +201,25 @@ object CodegenUtil {
trace: DiagnosticSink?
): List<ValueParameterDescriptor> {
if (descriptor.isActual) {
val actualParameters = descriptor.valueParameters
if (actualParameters.any { it.declaresOrInheritsDefaultValue() }) {
// This is incorrect code: actual function cannot have default values, they should be declared in the expected function.
// But until KT-22818 is fixed, we need to provide a workaround for the exception that happens on complex default values
// in the expected function. One may suppress the error then, and declare default values _both_ in expect and actual.
// With this code, we'll generate actual default values if they're present, and expected default values otherwise.
return actualParameters
}
val expected = CodegenUtil.findExpectedFunctionForActual(descriptor)
if (expected != null && expected.valueParameters.any(ValueParameterDescriptor::declaresDefaultValue)) {
val element = DescriptorToSourceUtils.descriptorToDeclaration(expected)
if (element == null) {
if (trace != null) {
val actualDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(descriptor)
?: error("Not a source declaration: $descriptor")
?: error("Not a source declaration: $descriptor")
trace.report(Errors.EXPECTED_FUNCTION_SOURCE_WITH_DEFAULT_ARGUMENTS_NOT_FOUND.on(actualDeclaration))
}
return descriptor.valueParameters
return actualParameters
}
return expected.valueParameters
@@ -218,6 +228,16 @@ object CodegenUtil {
return descriptor.valueParameters
}
// This function is private here because no one is supposed to use it except for the hack above.
// Please use ValueParameterDescriptor.hasDefaultValue instead.
private fun ValueParameterDescriptor.declaresOrInheritsDefaultValue(): Boolean {
return DFS.ifAny(
listOf(this),
{ current -> current.overriddenDescriptors.map(ValueParameterDescriptor::getOriginal) },
{ it.declaresDefaultValue() }
)
}
}
fun DeclarationDescriptor.isTopLevelInPackage(name: String, packageName: String): Boolean {
@@ -226,4 +246,4 @@ fun DeclarationDescriptor.isTopLevelInPackage(name: String, packageName: String)
val containingDeclaration = containingDeclaration as? PackageFragmentDescriptor ?: return false
val packageFqName = containingDeclaration.fqName.asString()
return packageName == packageFqName
}
}

View File

@@ -907,19 +907,20 @@ public class AsmUtil {
if (state.isCallAssertionsDisabled()) return stackValue;
if (runtimeAssertionInfo == null || !runtimeAssertionInfo.getNeedNotNullAssertion()) return stackValue;
return new StackValue(stackValue.type) {
return new StackValue(stackValue.type, stackValue.kotlinType) {
@Override
public void putSelector(@NotNull Type type, @Nullable KotlinType kotlinType, @NotNull InstructionAdapter v) {
Type innerType = stackValue.type;
stackValue.put(innerType, v);
KotlinType innerKotlinType = stackValue.kotlinType;
stackValue.put(innerType, innerKotlinType, v);
if (innerType.getSort() == Type.OBJECT || innerType.getSort() == Type.ARRAY) {
v.dup();
v.visitLdcInsn(runtimeAssertionInfo.getMessage());
v.invokestatic(IntrinsicMethods.INTRINSICS_CLASS_NAME, "checkExpressionValueIsNotNull",
"(Ljava/lang/Object;Ljava/lang/String;)V", false);
}
StackValue.coerce(innerType, type, v);
StackValue.coerce(innerType, innerKotlinType, type, kotlinType, v);
}
};
}

View File

@@ -2432,6 +2432,11 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
return;
}
if (resolvedCall.getResultingDescriptor() instanceof FunctionDescriptor &&
((FunctionDescriptor) resolvedCall.getResultingDescriptor()).isSuspend()) {
state.getGlobalCoroutinesContext().checkSuspendCall(resolvedCall);
}
boolean isSuspendNoInlineCall =
CoroutineCodegenUtilKt.isSuspendNoInlineCall(resolvedCall, this, state.getLanguageVersionSettings());
boolean isConstructor = resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor;

View File

@@ -76,6 +76,7 @@ import static org.jetbrains.kotlin.descriptors.annotations.AnnotationUtilKt.isEf
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.getSourceFromDescriptor;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
import static org.jetbrains.kotlin.resolve.jvm.InlineClassManglingRulesKt.shouldHideConstructorDueToInlineClassTypeValueParameters;
import static org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt.hasJvmDefaultAnnotation;
import static org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.*;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
@@ -226,13 +227,10 @@ public class FunctionCodegen {
asmMethod.getDescriptor()
);
if (CodegenContextUtil.isImplementationOwner(owner, functionDescriptor)) {
v.getSerializationBindings().put(METHOD_FOR_FUNCTION, CodegenUtilKt.unwrapFrontendVersion(functionDescriptor), asmMethod);
}
recordMethodForFunctionIfAppropriate(functionDescriptor, asmMethod);
AnnotationCodegen.forMethod(mv, memberCodegen, typeMapper).genAnnotations(functionDescriptor, asmMethod.getReturnType());
generateMethodAnnotationsIfRequired(functionDescriptor, asmMethod, jvmSignature, mv);
generateParameterAnnotations(functionDescriptor, mv, jvmSignature, memberCodegen, state);
GenerateJava8ParameterNamesKt.generateParameterNames(functionDescriptor, mv, jvmSignature, state, (flags & ACC_SYNTHETIC) != 0);
if (contextKind != OwnerKind.ERASED_INLINE_CLASS) {
@@ -269,6 +267,49 @@ public class FunctionCodegen {
}
}
private void recordMethodForFunctionIfAppropriate(
@NotNull FunctionDescriptor functionDescriptor,
Method asmMethod
) {
if (functionDescriptor instanceof AccessorForConstructorDescriptor) {
ConstructorDescriptor originalConstructor = ((AccessorForConstructorDescriptor) functionDescriptor).getCalleeDescriptor();
if (shouldHideConstructorDueToInlineClassTypeValueParameters(originalConstructor)) {
functionDescriptor = originalConstructor;
}
}
else if (shouldHideConstructorDueToInlineClassTypeValueParameters(functionDescriptor)) {
return;
}
functionDescriptor = CodegenUtilKt.unwrapFrontendVersion(functionDescriptor);
if (!CodegenContextUtil.isImplementationOwner(owner, functionDescriptor)) return;
v.getSerializationBindings().put(METHOD_FOR_FUNCTION, functionDescriptor, asmMethod);
}
private void generateMethodAnnotationsIfRequired(
@NotNull FunctionDescriptor functionDescriptor,
@NotNull Method asmMethod,
@NotNull JvmMethodGenericSignature jvmSignature,
@NotNull MethodVisitor mv
) {
FunctionDescriptor annotationsOwner;
if (shouldHideConstructorDueToInlineClassTypeValueParameters(functionDescriptor)) {
if (functionDescriptor instanceof AccessorForConstructorDescriptor) {
annotationsOwner = ((AccessorForConstructorDescriptor) functionDescriptor).getCalleeDescriptor();
}
else {
return;
}
}
else {
annotationsOwner = functionDescriptor;
}
AnnotationCodegen.forMethod(mv, memberCodegen, typeMapper).genAnnotations(annotationsOwner, asmMethod.getReturnType());
generateParameterAnnotations(annotationsOwner, mv, jvmSignature, memberCodegen, state);
}
@NotNull
public MethodVisitor newMethod(
@NotNull JvmDeclarationOrigin origin,

View File

@@ -0,0 +1,49 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. 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.coroutines
import org.jetbrains.kotlin.codegen.optimization.boxing.isPrimitiveBoxing
import org.jetbrains.kotlin.codegen.optimization.common.asSequence
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
import org.jetbrains.kotlin.codegen.topLevelClassInternalName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
import org.jetbrains.kotlin.utils.sure
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.tree.MethodInsnNode
import org.jetbrains.org.objectweb.asm.tree.MethodNode
private val BOXING_CLASS_INTERNAL_NAME =
RELEASE_COROUTINES_VERSION_SETTINGS.coroutinesJvmInternalPackageFqName().child(Name.identifier("Boxing")).topLevelClassInternalName()
object ChangeBoxingMethodTransformer : MethodTransformer() {
private val wrapperToInternalBoxing: Map<String, String>
init {
val map = hashMapOf<String, String>()
for (primitiveType in JvmPrimitiveType.values()) {
val name = primitiveType.wrapperFqName.topLevelClassInternalName()
map[name] = "box${primitiveType.javaKeywordName.capitalize()}"
}
wrapperToInternalBoxing = map
}
override fun transform(internalClassName: String, methodNode: MethodNode) {
for (boxing in methodNode.instructions.asSequence().filter { it.isPrimitiveBoxing() }) {
assert(boxing.opcode == Opcodes.INVOKESTATIC) {
"boxing shall be INVOKESTATIC wrapper.valueOf"
}
boxing as MethodInsnNode
val methodName = wrapperToInternalBoxing[boxing.owner].sure {
"expected primitive wrapper, but got ${boxing.owner}"
}
methodNode.instructions.set(
boxing,
MethodInsnNode(boxing.opcode, BOXING_CLASS_INTERNAL_NAME, methodName, boxing.desc, false)
)
}
}
}

View File

@@ -83,6 +83,9 @@ class CoroutineTransformerMethodVisitor(
FixStackMethodTransformer().transform(containingClassInternalName, methodNode)
RedundantLocalsEliminationMethodTransformer(languageVersionSettings).transform(containingClassInternalName, methodNode)
if (languageVersionSettings.isReleaseCoroutines()) {
ChangeBoxingMethodTransformer.transform(containingClassInternalName, methodNode)
}
updateMaxStack(methodNode)
val suspensionPoints = collectSuspensionPoints(methodNode)

View File

@@ -0,0 +1,55 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. 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.coroutines
import org.jetbrains.kotlin.backend.common.peek
import org.jetbrains.kotlin.backend.common.pop
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors.SUSPENSION_POINT_INSIDE_MONITOR
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
class GlobalCoroutinesContext(private val diagnostics: DiagnosticSink) {
private var monitorsDepth = 0
private val inlineLambdaInsideMonitorSourceArgumentIndexes = arrayListOf<Set<Int>>()
fun pushArgumentIndexes(indexes: Set<Int>) {
inlineLambdaInsideMonitorSourceArgumentIndexes.add(indexes)
}
fun popArgumentIndexes() {
inlineLambdaInsideMonitorSourceArgumentIndexes.pop()
}
private fun enterMonitor() {
monitorsDepth++
}
fun enterMonitorIfNeeded(index: Int?) {
if (index == null) return
if (inlineLambdaInsideMonitorSourceArgumentIndexes.peek()?.contains(index) != true) return
enterMonitor()
}
private fun exitMonitor() {
assert(monitorsDepth > 0) {
"exitMonitor without corresponding enterMonitor"
}
monitorsDepth--
}
fun exitMonitorIfNeeded(index: Int?) {
if (index == null) return
if (inlineLambdaInsideMonitorSourceArgumentIndexes.peek()?.contains(index) != true) return
exitMonitor()
}
fun checkSuspendCall(call: ResolvedCall<*>) {
if (monitorsDepth != 0) {
diagnostics.report(SUSPENSION_POINT_INSIDE_MONITOR.on(call.call.callElement, call.resultingDescriptor))
}
}
}

View File

@@ -56,7 +56,7 @@ const val DO_RESUME_METHOD_NAME = "doResume"
const val INVOKE_SUSPEND_METHOD_NAME = "invokeSuspend"
const val EXCEPTION_FIELD_NAME = "exception"
private val RELEASE_COROUTINES_VERSION_SETTINGS = LanguageVersionSettingsImpl(LanguageVersion.KOTLIN_1_3, ApiVersion.KOTLIN_1_3)
val RELEASE_COROUTINES_VERSION_SETTINGS = LanguageVersionSettingsImpl(LanguageVersion.KOTLIN_1_3, ApiVersion.KOTLIN_1_3)
fun LanguageVersionSettings.isResumeImplMethodName(name: String) =
if (isReleaseCoroutines())

View File

@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.codegen.inline
import com.intellij.psi.PsiElement
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.backend.common.isBuiltInIntercepted
import org.jetbrains.kotlin.backend.common.isTopLevelInPackage
import org.jetbrains.kotlin.builtins.BuiltInsPackageFragment
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.AsmUtil.getMethodAsmFlags
@@ -19,6 +20,8 @@ import org.jetbrains.kotlin.codegen.coroutines.createMethodNodeForSuspendCorouti
import org.jetbrains.kotlin.codegen.coroutines.isBuiltInSuspendCoroutineUninterceptedOrReturnInJvm
import org.jetbrains.kotlin.codegen.intrinsics.bytecode
import org.jetbrains.kotlin.codegen.intrinsics.classId
import org.jetbrains.kotlin.codegen.optimization.common.ControlFlowGraph
import org.jetbrains.kotlin.codegen.optimization.common.asSequence
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
import org.jetbrains.kotlin.config.isReleaseCoroutines
@@ -244,7 +247,18 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
}
}
val reificationResult = reifiedTypeInliner.reifyInstructions(node)
generateClosuresBodies()
val hasMonitor = node.instructions.asSequence().any { it.opcode == Opcodes.MONITORENTER }
if (hasMonitor) {
state.globalCoroutinesContext.pushArgumentIndexes(findInlineLambdasInsideMonitor(node))
}
try {
generateClosuresBodies()
} finally {
if (hasMonitor) {
state.globalCoroutinesContext.popArgumentIndexes()
}
}
//through generation captured parameters will be added to invocationParamBuilder
putClosureParametersOnStack()
@@ -301,6 +315,45 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
return result
}
private fun findInlineLambdasInsideMonitor(node: MethodNode): Set<Int> {
val sources = MethodInliner.analyzeMethodNodeBeforeInline(node)
val cfg = ControlFlowGraph.build(node)
val monitorDepthMap = hashMapOf<AbstractInsnNode, Int>()
val result = hashSetOf<Int>()
fun addMonitorDepthToSuccs(index: Int, depth: Int) {
val insn = node.instructions[index]
monitorDepthMap[insn] = depth
val newDepth = when (insn.opcode) {
Opcodes.MONITORENTER -> depth + 1
Opcodes.MONITOREXIT -> depth - 1
else -> depth
}
for (succIndex in cfg.getSuccessorsIndices(index)) {
if (monitorDepthMap[node.instructions[succIndex]] == null) {
addMonitorDepthToSuccs(succIndex, newDepth)
}
}
}
addMonitorDepthToSuccs(0, 0)
for (insn in node.instructions.asSequence()) {
if (insn !is MethodInsnNode) continue
if (!isInvokeOnLambda(insn.owner, insn.name)) continue
if (monitorDepthMap[insn]?.let { it > 0 } != true) continue
val frame = sources[node.instructions.indexOf(insn)] ?: continue
for (source in frame.getStack(frame.stackSize - Type.getArgumentTypes(insn.desc).size - 1).insns) {
if (source.opcode == Opcodes.ALOAD) {
result.add((source as VarInsnNode).`var`)
}
}
}
return result
}
private fun isInlinedToInlineFunInKotlinRuntime(): Boolean {
val codegen = this.codegen as? ExpressionCodegen ?: return false
val caller = codegen.context.functionDescriptor
@@ -310,8 +363,16 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
}
private fun generateClosuresBodies() {
val parameters = invocationParamBuilder.buildParameters()
for (info in expressionMap.values) {
info.generateLambdaBody(sourceCompiler, reifiedTypeInliner)
val index = parameters.find { it.lambda == info }?.index
state.globalCoroutinesContext.enterMonitorIfNeeded(index)
try {
info.generateLambdaBody(sourceCompiler, reifiedTypeInliner)
} finally {
state.globalCoroutinesContext.exitMonitorIfNeeded(index)
}
}
}

View File

@@ -945,7 +945,7 @@ class MethodInliner(
)
}
private fun analyzeMethodNodeBeforeInline(node: MethodNode): Array<Frame<SourceValue>?> {
fun analyzeMethodNodeBeforeInline(node: MethodNode): Array<Frame<SourceValue>?> {
val analyzer = object : Analyzer<SourceValue>(SourceInterpreter()) {
override fun newFrame(nLocals: Int, nStack: Int): Frame<SourceValue> {

View File

@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.codegen.`when`.MappingsClassesForWhenByEnum
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
import org.jetbrains.kotlin.codegen.context.CodegenContext
import org.jetbrains.kotlin.codegen.context.RootContext
import org.jetbrains.kotlin.codegen.coroutines.GlobalCoroutinesContext
import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension
import org.jetbrains.kotlin.codegen.inline.GlobalInlineContext
import org.jetbrains.kotlin.codegen.inline.InlineCache
@@ -199,6 +200,7 @@ class GenerationState private constructor(
}
val samWrapperClasses: SamWrapperClasses = SamWrapperClasses(this)
val globalInlineContext: GlobalInlineContext = GlobalInlineContext(diagnostics)
val globalCoroutinesContext: GlobalCoroutinesContext = GlobalCoroutinesContext(diagnostics)
val mappingsClassesForWhenByEnum: MappingsClassesForWhenByEnum = MappingsClassesForWhenByEnum(this)
val jvmRuntimeTypes: JvmRuntimeTypes = JvmRuntimeTypes(module, configuration.languageVersionSettings)
val factory: ClassFileFactory

View File

@@ -509,31 +509,35 @@ public class KotlinTypeMapper {
);
}
// Make sure this method is called only from back-end
// It uses staticTypeMappingConfiguration that throws exception on error types
@NotNull
public static Type mapInlineClassTypeAsDeclaration(@NotNull KotlinType kotlinType) {
return mapInlineClassType(kotlinType, TypeMappingMode.CLASS_DECLARATION);
return mapInlineClassType(kotlinType, TypeMappingMode.CLASS_DECLARATION, staticTypeMappingConfiguration);
}
// Make sure this method is called only from back-end
// It uses staticTypeMappingConfiguration that throws exception on error types
@NotNull
public static Type mapUnderlyingTypeOfInlineClassType(@NotNull KotlinType kotlinType) {
KotlinType underlyingType = InlineClassesUtilsKt.unsubstitutedUnderlyingType(kotlinType);
if (underlyingType == null) {
throw new IllegalStateException("There should be underlying type for inline class type: " + kotlinType);
}
return mapInlineClassType(underlyingType, TypeMappingMode.DEFAULT);
return mapInlineClassType(underlyingType, TypeMappingMode.DEFAULT, staticTypeMappingConfiguration);
}
@NotNull
public static Type mapInlineClassType(@NotNull KotlinType kotlinType) {
return mapInlineClassType(kotlinType, TypeMappingMode.DEFAULT);
private Type mapInlineClassType(@NotNull KotlinType kotlinType) {
return mapInlineClassType(kotlinType, TypeMappingMode.DEFAULT, typeMappingConfiguration);
}
private static Type mapInlineClassType(
@NotNull KotlinType kotlinType,
@NotNull TypeMappingMode mode
@NotNull TypeMappingMode mode,
@NotNull TypeMappingConfiguration<Type> configuration
) {
return TypeSignatureMappingKt.mapType(
kotlinType, AsmTypeFactory.INSTANCE, mode, staticTypeMappingConfiguration, null,
kotlinType, AsmTypeFactory.INSTANCE, mode, configuration, null,
(ktType, asmType, typeMappingMode) -> Unit.INSTANCE,
false
);
@@ -1400,7 +1404,7 @@ public class KotlinTypeMapper {
* In that case the generated method's return type should be boxed: otherwise it's not possible to use
* this class from Java since javac issues errors when loading the class (incompatible return types)
*/
private static boolean forceBoxedReturnType(@NotNull FunctionDescriptor descriptor) {
private boolean forceBoxedReturnType(@NotNull FunctionDescriptor descriptor) {
if (isBoxMethodForInlineClass(descriptor)) return true;
//noinspection ConstantConditions
@@ -1414,7 +1418,7 @@ public class KotlinTypeMapper {
return false;
}
private static boolean isJvmPrimitive(@NotNull KotlinType kotlinType) {
private boolean isJvmPrimitive(@NotNull KotlinType kotlinType) {
if (KotlinBuiltIns.isPrimitiveType(kotlinType)) return true;
if (InlineClassesUtilsKt.isInlineClassType(kotlinType) && !KotlinTypeKt.isError(kotlinType)) {

View File

@@ -0,0 +1,50 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. 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.cli.common.arguments
import org.jetbrains.kotlin.config.LanguageFeature
object CliArgumentStringBuilder {
private const val languagePrefix = "-XXLanguage:"
private val LanguageFeature.State.sign: String
get() = when (this) {
LanguageFeature.State.ENABLED -> "+"
LanguageFeature.State.DISABLED -> "-"
LanguageFeature.State.ENABLED_WITH_WARNING -> "+" // not supported normally
LanguageFeature.State.ENABLED_WITH_ERROR -> "-" // not supported normally
}
fun LanguageFeature.buildArgumentString(state: LanguageFeature.State): String {
return "$languagePrefix${state.sign}$name"
}
fun String.replaceLanguageFeature(
feature: LanguageFeature,
state: LanguageFeature.State,
prefix: String = "",
postfix: String = "",
separator: String = ", ",
quoted: Boolean = true
): String {
val existingFeatureIndex = indexOf(feature.name)
val languagePrefixIndex = lastIndexOf(languagePrefix, existingFeatureIndex)
val featureArgumentString = feature.buildArgumentString(state)
val quote = if (quoted) "\"" else ""
return if (languagePrefixIndex != -1) {
replaceRange(languagePrefixIndex, existingFeatureIndex + feature.name.length, featureArgumentString)
} else {
val splitText = if (postfix.isNotEmpty()) split(postfix) else listOf(this, "")
if (splitText.size != 2) {
"$prefix$quote$featureArgumentString$quote$postfix"
} else {
val (mainPart, commentPart) = splitText
// In Groovy / Kotlin DSL, we can have comment after [...] or listOf(...)
mainPart + "$separator$quote$featureArgumentString$quote$postfix" + commentPart
}
}
}
}

View File

@@ -148,7 +148,7 @@ public class SingleAbstractMethodUtils {
// Otherwise android data binding can cause resolve re-entrance
// For details see KT-18687, KT-16149
// TODO: prevent resolve re-entrance on architecture level, or (alternatively) ask data binding owners not to do it
if (DescriptorUtilsKt.getFqNameSafe(klass).asString().equals("android.databinding.DataBindingComponent")) {
if (DescriptorUtilsKt.getFqNameSafe(klass).asString().endsWith(".databinding.DataBindingComponent")) {
return null;
}

View File

@@ -346,7 +346,7 @@ class LazyModuleDependencies<M : ModuleInfo>(
) : ModuleDependencies {
private val dependencies = storageManager.createLazyValue {
val moduleDescriptor = resolverForProject.descriptorForModule(module)
buildSequence {
buildSequence<ModuleDescriptorImpl> {
if (firstDependency != null) {
yield(resolverForProject.descriptorForModule(firstDependency))
}
@@ -502,4 +502,7 @@ private object DiagnoseUnknownModuleInfoReporter {
private fun errorInSpecialModuleInfoResolver(message: String): Nothing = throw AssertionError(message)
private fun otherError(message: String): Nothing = throw AssertionError(message)
}
}
@Suppress("UNCHECKED_CAST")
fun <T> ModuleInfo.getCapability(capability: ModuleDescriptor.Capability<T>) = capabilities[capability] as? T

View File

@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.container.useImpl
import org.jetbrains.kotlin.container.useInstance
import org.jetbrains.kotlin.context.ModuleContext
import org.jetbrains.kotlin.context.ProjectContext
import org.jetbrains.kotlin.contracts.ContractDeserializerImpl
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
@@ -165,6 +166,7 @@ object CommonAnalyzerFacade : ResolverForModuleFactory() {
useInstance(metadataPartProvider)
useInstance(declarationProviderFactory)
useImpl<MetadataPackageFragmentProvider>()
useImpl<ContractDeserializerImpl>()
val metadataFinderFactory = ServiceManager.getService(moduleContext.project, MetadataFinderFactory::class.java)
?: error("No MetadataFinderFactory in project")

View File

@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.coroutines
import org.jetbrains.kotlin.builtins.isFunctionOrSuspendFunctionType
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
@@ -24,3 +25,5 @@ import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
val CallableDescriptor.isSuspendLambda get() = this is AnonymousFunctionDescriptor && this.isSuspend
val ValueParameterDescriptor.hasSuspendFunctionType get() = returnType?.isSuspendFunctionType == true
val ValueParameterDescriptor.hasFunctionOrSuspendFunctionType get() = returnType?.isFunctionOrSuspendFunctionType == true

View File

@@ -244,7 +244,7 @@ public interface Errors {
DiagnosticFactory2<PsiElement, FqName, DeclarationDescriptor> EXPERIMENTAL_OVERRIDE = DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<PsiElement, FqName, DeclarationDescriptor> EXPERIMENTAL_OVERRIDE_ERROR = DiagnosticFactory2.create(ERROR);
DiagnosticFactory0<PsiElement> EXPERIMENTAL_IS_NOT_ENABLED = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> EXPERIMENTAL_IS_NOT_ENABLED = DiagnosticFactory0.create(WARNING);
DiagnosticFactory0<PsiElement> EXPERIMENTAL_CAN_ONLY_BE_USED_AS_ANNOTATION = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement>
EXPERIMENTAL_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_USE_EXPERIMENTAL = DiagnosticFactory0.create(ERROR);
@@ -1037,6 +1037,7 @@ public interface Errors {
DiagnosticFactory0<KtDeclaration> OVERRIDE_BY_INLINE = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE);
DiagnosticFactory0<PsiElement> REIFIED_TYPE_PARAMETER_IN_OVERRIDE = DiagnosticFactory0.create(ERROR);
DiagnosticFactory1<PsiElement, CallableDescriptor> INLINE_CALL_CYCLE = DiagnosticFactory1.create(ERROR, DEFAULT);
DiagnosticFactory1<PsiElement, CallableDescriptor> SUSPENSION_POINT_INSIDE_MONITOR = DiagnosticFactory1.create(ERROR, DEFAULT);
DiagnosticFactory0<PsiElement> NON_LOCAL_RETURN_IN_DISABLED_INLINE = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtDeclaration> INLINE_PROPERTY_WITH_BACKING_FIELD = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory0<KtAnnotationEntry> NON_INTERNAL_PUBLISHED_API = DiagnosticFactory0.create(ERROR);

View File

@@ -934,6 +934,7 @@ public class DefaultErrorMessages {
//Inline non locals
MAP.put(NON_LOCAL_RETURN_NOT_ALLOWED, "Can''t inline ''{0}'' here: it may contain non-local returns. Add ''crossinline'' modifier to parameter declaration ''{0}''", ELEMENT_TEXT);
MAP.put(INLINE_CALL_CYCLE, "The ''{0}'' invocation is a part of inline cycle", NAME);
MAP.put(SUSPENSION_POINT_INSIDE_MONITOR, "The ''{0}'' suspension point is inside a critical section", NAME);
MAP.put(NON_LOCAL_RETURN_IN_DISABLED_INLINE, "Non-local returns are not allowed with inlining disabled");
MAP.put(NON_LOCAL_SUSPENSION_POINT, "Suspension functions can be called only within coroutine body");
MAP.put(ILLEGAL_SUSPEND_FUNCTION_CALL, "Suspend function ''{0}'' should be called only from a coroutine or another suspend function", NAME);

View File

@@ -42,3 +42,6 @@ fun AnnotationDescriptor.argumentValue(parameterName: String): ConstantValue<*>?
DeprecationLevel.ERROR
)
val JVM_FIELD_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmField")
val KOTLINX_SERIALIZABLE_FQ_NAME = FqName("kotlinx.serialization.Serializable")
val KOTLINX_SERIALIZER_FQ_NAME = FqName("kotlinx.serialization.Serializer")

View File

@@ -77,7 +77,7 @@ class DeclarationsChecker(
private val modifiersChecker = modifiersChecker.withTrace(trace)
private val exposedChecker = ExposedVisibilityChecker(trace)
private val exposedChecker = ExposedVisibilityChecker(trace, languageVersionSettings)
private val shadowedExtensionChecker = ShadowedExtensionChecker(typeSpecificityComparator, trace)

View File

@@ -16,6 +16,9 @@
package org.jetbrains.kotlin.resolve
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.DiagnosticSink.DO_NOTHING
@@ -26,7 +29,10 @@ import org.jetbrains.kotlin.types.isError
// Checker for all seven EXPOSED_* errors
// All functions return true if everything is OK, or false in case of any errors
class ExposedVisibilityChecker(private val trace: DiagnosticSink = DO_NOTHING) {
class ExposedVisibilityChecker(
private val trace: DiagnosticSink = DO_NOTHING,
private val languageVersionSettings: LanguageVersionSettings = LanguageVersionSettingsImpl.DEFAULT
) {
// NB: does not check any members
fun checkClassHeader(klass: KtClassOrObject, classDescriptor: ClassDescriptor): Boolean {
@@ -89,6 +95,14 @@ class ExposedVisibilityChecker(private val trace: DiagnosticSink = DO_NOTHING) {
)
result = false
}
if (languageVersionSettings.supportsFeature(LanguageFeature.ProhibitExposingFunctionTypeParameterBound)) {
functionDescriptor.typeParameters.forEachIndexed { i, typeParameterDescriptor ->
if (!checkParameterBounds(function.typeParameters[i], typeParameterDescriptor, functionVisibility)) {
result = false
}
}
}
}
functionDescriptor.valueParameters.forEachIndexed { i, parameterDescriptor ->
val restricting = parameterDescriptor.type.leastPermissiveDescriptor(functionVisibility)
@@ -184,21 +198,30 @@ class ExposedVisibilityChecker(private val trace: DiagnosticSink = DO_NOTHING) {
var result = true
classDescriptor.declaredTypeParameters.forEachIndexed { i, typeParameterDescriptor ->
if (i >= typeParameterList.size) return result
for (upperBound in typeParameterDescriptor.upperBounds) {
val restricting = upperBound.leastPermissiveDescriptor(classVisibility)
if (restricting != null) {
trace.report(
Errors.EXPOSED_TYPE_PARAMETER_BOUND.on(
typeParameterList[i], classVisibility,
restricting, restricting.effectiveVisibility()
)
)
result = false
break
}
}
val ktTypeParameter = typeParameterList[i]
if (!checkParameterBounds(ktTypeParameter, typeParameterDescriptor, classVisibility)) result = false
}
return result
}
private fun checkParameterBounds(
ktTypeParameter: KtTypeParameter,
typeParameterDescriptor: TypeParameterDescriptor,
ownerVisibility: EffectiveVisibility
): Boolean {
for (upperBound in typeParameterDescriptor.upperBounds) {
val restricting = upperBound.leastPermissiveDescriptor(ownerVisibility)
if (restricting != null) {
trace.report(
Errors.EXPOSED_TYPE_PARAMETER_BOUND.on(
ktTypeParameter, ownerVisibility,
restricting, restricting.effectiveVisibility()
)
)
return false
}
}
return true
}
}

View File

@@ -414,7 +414,7 @@ class GenericCandidateResolver(
val effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument, context)
if (isCoroutineCallWithAdditionalInference(valueParameterDescriptor, valueArgument)) {
if (isCoroutineCallWithAdditionalInference(valueParameterDescriptor, valueArgument, languageVersionSettings)) {
coroutineInferenceSupport.analyzeCoroutine(functionLiteral, valueArgument, constraintSystem, context, effectiveExpectedType)
}

View File

@@ -6,6 +6,9 @@
package org.jetbrains.kotlin.resolve.calls.inference
import org.jetbrains.kotlin.builtins.*
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.coroutines.hasFunctionOrSuspendFunctionType
import org.jetbrains.kotlin.coroutines.hasSuspendFunctionType
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
@@ -31,6 +34,8 @@ import org.jetbrains.kotlin.resolve.calls.model.isReallySuccess
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResultsImpl
import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.descriptorUtil.hasBuilderInferenceAnnotation
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE
@@ -110,6 +115,8 @@ class CoroutineInferenceSupport(
@set:Inject
lateinit var callCompleter: CallCompleter
private val languageVersionSettings get() = expressionTypingServices.languageVersionSettings
fun analyzeCoroutine(
functionLiteral: KtFunction,
valueArgument: ValueArgument,
@@ -118,7 +125,8 @@ class CoroutineInferenceSupport(
lambdaExpectedType: KotlinType
) {
val argumentExpression = valueArgument.getArgumentExpression() ?: return
if (!lambdaExpectedType.isSuspendFunctionType) return
if (!checkExpectedTypeForArgument(lambdaExpectedType)) return
val lambdaReceiverType = lambdaExpectedType.getReceiverTypeFromFunctionType() ?: return
val inferenceData = CoroutineInferenceData()
@@ -172,6 +180,13 @@ class CoroutineInferenceSupport(
inferenceData.reportInferenceResult(csBuilder)
}
private fun checkExpectedTypeForArgument(expectedType: KotlinType): Boolean {
return if (languageVersionSettings.supportsFeature(LanguageFeature.ExperimentalBuilderInference))
expectedType.isFunctionOrSuspendFunctionType
else
expectedType.isSuspendFunctionType
}
fun checkCoroutineCalls(
context: BasicCallResolutionContext,
tracingStrategy: TracingStrategy,
@@ -186,7 +201,7 @@ class CoroutineInferenceSupport(
callCompleter.completeCall(context, overloadResults, tracingStrategy)
if (!resultingCall.isReallySuccess()) return
if (isBadCall(resultingCall.resultingDescriptor)) {
if (!isGoodCall(resultingCall.resultingDescriptor)) {
inferenceData.badCallHappened()
}
@@ -208,18 +223,30 @@ class CoroutineInferenceSupport(
}
}
private fun isBadCall(resultingDescriptor: CallableDescriptor): Boolean {
fun KotlinType.containsTypeTemplate() = contains { it is TypeTemplate }
private fun KotlinType.containsTypeTemplate() = contains { it is TypeTemplate }
val returnType = resultingDescriptor.returnType ?: return true
if (returnType.containsTypeTemplate()) return true
if (resultingDescriptor !is FunctionDescriptor || resultingDescriptor.isSuspend) return false
for (valueParameter in resultingDescriptor.valueParameters) {
if (valueParameter.type.containsTypeTemplate()) return true
private fun isGoodCall(resultingDescriptor: CallableDescriptor): Boolean {
if (!languageVersionSettings.supportsFeature(LanguageFeature.ExperimentalBuilderInference)) {
return isGoodCallForOldCoroutines(resultingDescriptor)
}
return false
if (resultingDescriptor.isExtension && !resultingDescriptor.hasBuilderInferenceAnnotation()) {
return false
}
val returnType = resultingDescriptor.returnType ?: return false
return !returnType.containsTypeTemplate()
}
private fun isGoodCallForOldCoroutines(resultingDescriptor: CallableDescriptor): Boolean {
val returnType = resultingDescriptor.returnType ?: return false
if (returnType.containsTypeTemplate()) return false
if (resultingDescriptor !is FunctionDescriptor || resultingDescriptor.isSuspend) return true
if (resultingDescriptor.valueParameters.any { it.type.containsTypeTemplate() }) return false
return true
}
private class CoroutineTypeCheckerContext : TypeCheckerContext(errorTypeEqualsToAnything = true) {
@@ -260,11 +287,20 @@ class CoroutineInferenceSupport(
}
}
fun isCoroutineCallWithAdditionalInference(parameterDescriptor: ValueParameterDescriptor, argument: ValueArgument) =
parameterDescriptor.hasSuspendFunctionType &&
fun isCoroutineCallWithAdditionalInference(
parameterDescriptor: ValueParameterDescriptor,
argument: ValueArgument,
languageVersionSettings: LanguageVersionSettings
): Boolean {
val parameterHasOptIn = if (languageVersionSettings.supportsFeature(LanguageFeature.ExperimentalBuilderInference))
parameterDescriptor.hasBuilderInferenceAnnotation() && parameterDescriptor.hasFunctionOrSuspendFunctionType
else
parameterDescriptor.hasSuspendFunctionType
return parameterHasOptIn &&
argument.getArgumentExpression() is KtLambdaExpression &&
parameterDescriptor.type.let { it.isBuiltinFunctionalType && it.getReceiverTypeFromFunctionType() != null }
}
fun OverloadResolutionResultsImpl<*>.isResultWithCoroutineInference() = getCoroutineInferenceData() != null

View File

@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.resolve.calls.tower
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.builtins.getReceiverTypeFromFunctionType
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
@@ -37,7 +38,8 @@ import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
class KotlinResolutionStatelessCallbacksImpl(
private val deprecationResolver: DeprecationResolver
private val deprecationResolver: DeprecationResolver,
private val languageVersionSettings: LanguageVersionSettings
) : KotlinResolutionStatelessCallbacks {
override fun isDescriptorFromSource(descriptor: CallableDescriptor) =
DescriptorToSourceUtils.descriptorToDeclaration(descriptor) != null
@@ -72,5 +74,5 @@ class KotlinResolutionStatelessCallbacksImpl(
functionCall.safeAs<PSIKotlinCallForInvoke>()?.variableCall
override fun isCoroutineCall(argument: KotlinCallArgument, parameter: ValueParameterDescriptor): Boolean =
isCoroutineCallWithAdditionalInference(parameter, argument.psiCallArgument.valueArgument)
isCoroutineCallWithAdditionalInference(parameter, argument.psiCallArgument.valueArgument, languageVersionSettings)
}

View File

@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import org.jetbrains.kotlin.psi.psiUtil.getTopmostParentQualifiedExpressionForSelector
import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker
@@ -259,9 +260,6 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
}
}
val experimentalities = targetDescriptor.loadExperimentalities(moduleAnnotationsResolver, context.languageVersionSettings)
reportNotAcceptedExperimentalities(experimentalities, element, context)
val targetClass = when (targetDescriptor) {
is ClassDescriptor -> targetDescriptor
is TypeAliasDescriptor -> targetDescriptor.classDescriptor
@@ -276,6 +274,11 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
)
}
}
if (element.getParentOfType<KtImportDirective>(false) == null) {
val experimentalities = targetDescriptor.loadExperimentalities(moduleAnnotationsResolver, context.languageVersionSettings)
reportNotAcceptedExperimentalities(experimentalities, element, context)
}
}
private fun checkUsageOfKotlinExperimentalOrUseExperimental(element: PsiElement, context: CheckerContext) {

View File

@@ -322,6 +322,11 @@ class DeprecationResolver(
return emptyList()
}
// This is a temporary workaround before @DeprecatedSinceKotlin is introduced, see KT-23575
if (shouldSkipDeprecationOnKotlinIoReadBytes(this, languageVersionSettings)) {
return emptyList()
}
val result = SmartList<Deprecation>()
fun addDeprecationIfPresent(target: DeclarationDescriptor) {
@@ -365,6 +370,15 @@ class DeprecationResolver(
return result.distinct()
}
private fun shouldSkipDeprecationOnKotlinIoReadBytes(
descriptor: DeclarationDescriptor, languageVersionSettings: LanguageVersionSettings
): Boolean =
descriptor.name.asString() == "readBytes" &&
(descriptor.containingDeclaration as? PackageFragmentDescriptor)?.fqName?.asString() == "kotlin.io" &&
descriptor is FunctionDescriptor &&
descriptor.valueParameters.singleOrNull()?.type?.let(KotlinBuiltIns::isInt) == true &&
languageVersionSettings.apiVersion < ApiVersion.KOTLIN_1_3
private fun getDeprecationByCoroutinesVersion(target: DeclarationDescriptor): DeprecatedExperimentalCoroutine? {
if (target !is DeserializedMemberDescriptor) return null

View File

@@ -715,7 +715,7 @@ class DoubleColonExpressionResolver(
?.apply { commitTrace() }?.results
}
val resultSequence = buildSequence {
val resultSequence = buildSequence<ResolutionResultsAndTraceCommitCallback> {
when (lhs) {
is DoubleColonLHS.Type -> {
val classifier = lhsType.constructor.declarationDescriptor

View File

@@ -10,7 +10,8 @@ import java.io.File
class DirtyFilesContainer(
private val caches: IncrementalCachesManager<*>,
private val reporter: ICReporter
private val reporter: ICReporter,
private val sourceFilesExtensions: List<String>
) {
private val myDirtyFiles = HashSet<File>()
@@ -18,7 +19,7 @@ class DirtyFilesContainer(
ArrayList(myDirtyFiles)
fun add(files: Iterable<File>) {
val existingKotlinFiles = files.filter { it.isKotlinFile() }
val existingKotlinFiles = files.filter { it.isKotlinFile(sourceFilesExtensions) }
if (existingKotlinFiles.isNotEmpty()) {
myDirtyFiles.addAll(existingKotlinFiles)
}

View File

@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.build.DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
@@ -50,6 +51,7 @@ abstract class IncrementalCompilerRunner<
protected val cacheDirectory = File(workingDir, cacheDirName)
protected val dirtySourcesSinceLastTimeFile = File(workingDir, DIRTY_SOURCES_FILE_NAME)
protected val lastBuildInfoFile = File(workingDir, LAST_BUILD_INFO_FILE_NAME)
protected open val kotlinSourceFilesExtensions: List<String> = DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
protected abstract fun isICEnabled(): Boolean
protected abstract fun createCacheManager(args: Args): CacheManager
@@ -85,7 +87,7 @@ abstract class IncrementalCompilerRunner<
if (providedChangedFiles == null) {
caches.inputsCache.sourceSnapshotMap.compareAndUpdate(allSourceFiles)
}
val allKotlinFiles = allSourceFiles.filter { it.isKotlinFile() }
val allKotlinFiles = allSourceFiles.filter { it.isKotlinFile(kotlinSourceFilesExtensions) }
return compileIncrementally(args, caches, allKotlinFiles, CompilationMode.Rebuild(), messageCollector)
}
@@ -281,8 +283,8 @@ abstract class IncrementalCompilerRunner<
changedFiles: ChangedFiles.Known
): DirtyData {
val removedClasses = HashSet<String>()
val dirtyFiles = changedFiles.modified.filterTo(HashSet()) { it.isKotlinFile() }
val removedFiles = changedFiles.removed.filterTo(HashSet()) { it.isKotlinFile() }
val dirtyFiles = changedFiles.modified.filterTo(HashSet()) { it.isKotlinFile(kotlinSourceFilesExtensions) }
val removedFiles = changedFiles.removed.filterTo(HashSet()) { it.isKotlinFile(kotlinSourceFilesExtensions) }
val existingClasses = classesFqNames(dirtyFiles)
val previousClasses = caches.platformCache

View File

@@ -90,7 +90,7 @@ class IncrementalJsCompilerRunner(
val lastBuildInfo = BuildInfo.read(lastBuildInfoFile)
?: return CompilationMode.Rebuild { "No information on previous build" }
val dirtyFiles = DirtyFilesContainer(caches, reporter)
val dirtyFiles = DirtyFilesContainer(caches, reporter, kotlinSourceFilesExtensions)
initDirtyFiles(dirtyFiles, changedFiles)
val libs = (args.libraries ?: "").split(File.pathSeparator).map { File(it) }

View File

@@ -22,6 +22,7 @@ import com.intellij.psi.PsiClass
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.PsiJavaFile
import org.jetbrains.kotlin.build.DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.build.JvmSourceRoot
@@ -40,7 +41,6 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.multiproject.EmptyModulesApiHistory
import org.jetbrains.kotlin.incremental.multiproject.ModulesApiHistory
import org.jetbrains.kotlin.incremental.storage.version.CacheVersionManager
import org.jetbrains.kotlin.incremental.util.Either
import org.jetbrains.kotlin.load.java.JavaClassesTracker
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
@@ -57,8 +57,8 @@ fun makeIncrementally(
messageCollector: MessageCollector = MessageCollector.NONE,
reporter: ICReporter = EmptyICReporter
) {
val kotlinExtensions = listOf("kt", "kts")
val allExtensions = kotlinExtensions + listOf("java")
val kotlinExtensions = DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
val allExtensions = kotlinExtensions + "java"
val rootsWalk = sourceRoots.asSequence().flatMap { it.walk() }
val files = rootsWalk.filter(File::isFile)
val sourceFiles = files.filter { it.extension.toLowerCase() in allExtensions }.toList()
@@ -75,7 +75,8 @@ fun makeIncrementally(
usePreciseJavaTracking = true,
localStateDirs = emptyList(),
buildHistoryFile = buildHistoryFile,
modulesApiHistory = EmptyModulesApiHistory
modulesApiHistory = EmptyModulesApiHistory,
kotlinSourceFilesExtensions = kotlinExtensions
)
compiler.compile(sourceFiles, args, messageCollector, providedChangedFiles = null)
}
@@ -104,9 +105,10 @@ class IncrementalJvmCompilerRunner(
cachesVersionManagers: List<CacheVersionManager>,
reporter: ICReporter,
private val usePreciseJavaTracking: Boolean,
buildHistoryFile: File,
buildHistoryFile: File,
localStateDirs: Collection<File>,
private val modulesApiHistory: ModulesApiHistory
private val modulesApiHistory: ModulesApiHistory,
override val kotlinSourceFilesExtensions: List<String> = DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
) : IncrementalCompilerRunner<K2JVMCompilerArguments, IncrementalJvmCachesManager>(
workingDir,
"caches-jvm",
@@ -145,7 +147,7 @@ class IncrementalJvmCompilerRunner(
changedFiles: ChangedFiles.Known,
args: K2JVMCompilerArguments
): CompilationMode {
val dirtyFiles = DirtyFilesContainer(caches, reporter)
val dirtyFiles = DirtyFilesContainer(caches, reporter, kotlinSourceFilesExtensions)
initDirtyFiles(dirtyFiles, changedFiles)
val lastBuildInfo = BuildInfo.read(lastBuildInfoFile) ?: return CompilationMode.Rebuild { "No information on previous build" }

View File

@@ -28,7 +28,7 @@ import com.intellij.psi.impl.java.stubs.PsiJavaFileStub
import com.intellij.psi.impl.java.stubs.impl.PsiJavaFileStubImpl
import com.intellij.psi.impl.source.tree.TreeElement
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.BindingContext
@@ -54,7 +54,13 @@ fun buildLightClass(
context.module,
context.bindingContext,
files.toList(),
CompilerConfiguration.EMPTY
context.languageVersionSettings?.let {
CompilerConfiguration().apply {
languageVersionSettings = it
isReadOnly = true
}
} ?: CompilerConfiguration.EMPTY
).generateDeclaredClassFilter(generateClassFilter).wantsDiagnostics(false).build()
state.beforeCompile()

View File

@@ -30,7 +30,7 @@ import com.intellij.psi.impl.java.stubs.PsiJavaFileStub
import com.intellij.psi.impl.java.stubs.impl.PsiJavaFileStubImpl
import com.intellij.psi.impl.source.tree.TreeElement
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.BindingContext
@@ -56,7 +56,12 @@ fun buildLightClass(
context.module,
context.bindingContext,
files.toList(),
CompilerConfiguration.EMPTY
context.languageVersionSettings?.let {
CompilerConfiguration().apply {
languageVersionSettings = it
isReadOnly = true
}
} ?: CompilerConfiguration.EMPTY
).generateDeclaredClassFilter(generateClassFilter).wantsDiagnostics(false).build()
state.beforeCompile()

View File

@@ -16,10 +16,12 @@
package org.jetbrains.kotlin.asJava.builder
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.resolve.BindingContext
open class LightClassConstructionContext(
val bindingContext: BindingContext,
val module: ModuleDescriptor
val module: ModuleDescriptor,
val languageVersionSettings: LanguageVersionSettings? = null
)

View File

@@ -28,7 +28,7 @@ object KotlinStubVersions {
// Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed
// or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder).
// Increasing this version will lead to reindexing of all binary files that are potentially kotlin binaries (including all class files).
private const val BINARY_STUB_VERSION = 69
private const val BINARY_STUB_VERSION = 70
// Classfile stub version should be increased if changes are made to classfile stub building subsystem (org.jetbrains.kotlin.idea.decompiler.classFile)
// Increasing this version will lead to reindexing of all classfiles.

View File

@@ -2,10 +2,9 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
// LANGUAGE_VERSION: 1.2
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
import kotlin.coroutines.experimental.*
enum class Foo(vararg expected: String) {
A("start", "A", "end"),

View File

@@ -0,0 +1,48 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.3
import helpers.*
import kotlin.coroutines.*
enum class Foo(vararg expected: String) {
A("start", "A", "end"),
B("start", "BCD", "end"),
C("start", "BCD", "end"),
D("start", "BCD", "end"),
E("start", "E", "end"),
F("start", "end");
val expected = expected.toList()
}
fun box(): String {
for (c in Foo.values()) {
val actual = getSequence(c).toList()
if (actual != c.expected) {
return "FAIL: -- ${c.expected} != $actual"
}
}
return "OK"
}
fun getSequence(a: Foo) =
sequence {
yield("start")
when (a) {
Foo.A -> {
yield("A")
}
Foo.B,
Foo.C,
Foo.D-> {
yield("BCD")
}
Foo.E-> {
yield("E")
}
}
yield("end")
}

View File

@@ -2,10 +2,9 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
// LANGUAGE_VERSION: 1.2
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
import kotlin.coroutines.experimental.*
val f = run {
buildSequence {

View File

@@ -0,0 +1,19 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.3
import helpers.*
import kotlin.coroutines.*
val f = run {
sequence {
if (true) {
yield("OK")
}
}.toList()
}
fun box(): String {
return f[0]
}

View File

@@ -0,0 +1,18 @@
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR, JS_IR, NATIVE
inline class SnekDirection(val direction: Int) {
companion object {
val Up = SnekDirection(0)
}
}
fun testUnbox() : SnekDirection {
val list = arrayListOf(SnekDirection.Up)
return list[0]
}
fun box(): String {
val a = testUnbox()
return if (a.direction == 0) "OK" else "Fail"
}

View File

@@ -0,0 +1,28 @@
// !LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND: JVM_IR, JS_IR
// FILE: common.kt
public expect fun <T> Array<out T>.copyInto(
destination: Array<T>, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size
): Array<T>
// FILE: platform.kt
// This test should be updated once KT-22818 is fixed; default values are not allowed in the actual function
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun <T> Array<out T>.copyInto(
destination: Array<T>, destinationOffset: Int = 42, startIndex: Int = 43, endIndex: Int = size + 44
): Array<T> {
destination as Array<Int>
destination[0] = destinationOffset
destination[1] = startIndex
destination[2] = endIndex
return destination
}
fun box(): String {
val a = Array<Int>(3) { it }
val result = a.copyInto(a)
return if (result[0] == 42 && result[1] == 43 && result[2] == 47) "OK"
else "Fail: ${result[0]} ${result[1]} ${result[2]}"
}

View File

@@ -0,0 +1,30 @@
// !LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND: JVM_IR, JS_IR
// FILE: common.kt
expect interface I {
fun test(source: String = "expect")
}
expect interface J : I
// FILE: platform.kt
actual interface I {
// This test should be updated once KT-22818 is fixed; default values are not allowed in the actual function
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
actual fun test(source: String = "actual")
}
actual interface J : I {
override fun test(source: String) {
if (source != "actual") throw AssertionError(source)
}
}
class K : J
fun box(): String {
K().test()
return "OK"
}

View File

@@ -0,0 +1,17 @@
// LANGUAGE_VERSION: 1.2
// IGNORE_BACKEND: JS_IR
inline fun on(body: () -> Any) = body().toString()
class A {
fun test() = foo()
private companion object {
private fun foo() = on { this }
override fun toString() = "OK"
}
}
fun box() = A().test()

View File

@@ -0,0 +1,17 @@
// LANGUAGE_VERSION: 1.3
// IGNORE_BACKEND: JS_IR
inline fun on(body: () -> Any) = body().toString()
class A {
fun test() = foo()
private companion object {
private fun foo() = on { this }
override fun toString() = "OK"
}
}
fun box() = A().test()

View File

@@ -0,0 +1,14 @@
// LANGUAGE_VERSION: 1.2
// IGNORE_BACKEND: JS_IR
interface A {
fun test() = ok()
private companion object {
fun ok() = "OK"
}
}
class C : A
fun box() = C().test()

View File

@@ -0,0 +1,14 @@
// LANGUAGE_VERSION: 1.3
// IGNORE_BACKEND: JS_IR
interface A {
fun test() = ok()
private companion object {
fun ok() = "OK"
}
}
class C : A
fun box() = C().test()

View File

@@ -23,6 +23,14 @@ class CounterTest<T>(t: T) {
private var generic: T = t
}
class C {
companion object {
private var z: String = ""
fun getBoundZ() = this::z
}
}
fun box(): String {
val p = A::class.memberProperties.single() as KMutableProperty1<A, String?>
p.isAccessible = true
@@ -47,5 +55,19 @@ fun box(): String {
d.isAccessible = true
d.setter.call(CounterTest(""), null) // Also should not fail, because we can't be sure about nullability of 'generic'
val z = C.Companion::class.memberProperties.single { it.name == "z" } as KMutableProperty1<C.Companion, String?>
z.isAccessible = true
try {
z.setter.call(C, null)
return "Fail: exception should have been thrown"
} catch (e: IllegalArgumentException) {}
val zz = C.getBoundZ() as KMutableProperty0<String?>
zz.isAccessible = true
try {
zz.setter.call(null)
return "Fail: exception should have been thrown"
} catch (e: IllegalArgumentException) {}
return "OK"
}

View File

@@ -0,0 +1,37 @@
// IGNORE_BACKEND: JS_IR, JS, NATIVE, JVM_IR
// WITH_REFLECT
import kotlin.reflect.KCallable
import kotlin.reflect.jvm.isAccessible
import kotlin.test.assertEquals
inline class S(val value: String) {
operator fun plus(other: S): S = S(this.value + other.value)
}
class C {
private var member: S = S("")
fun unboundRef() = C::member.apply { isAccessible = true }
fun boundRef() = this::member.apply { isAccessible = true }
}
private var topLevel: S = S("")
fun box(): String {
val c = C()
assertEquals(Unit, c.unboundRef().setter.call(c, S("ab")))
assertEquals(S("ab"), c.unboundRef().call(c))
assertEquals(S("ab"), c.unboundRef().getter.call(c))
assertEquals(Unit, c.boundRef().setter.call(S("cd")))
assertEquals(S("cd"), c.boundRef().call())
assertEquals(S("cd"), c.boundRef().getter.call())
val topLevel = ::topLevel.apply { isAccessible = true }
assertEquals(Unit, topLevel.setter.call(S("ef")))
assertEquals(S("ef"), topLevel.call())
assertEquals(S("ef"), topLevel.getter.call())
return "OK"
}

View File

@@ -0,0 +1,41 @@
// IGNORE_BACKEND: JS_IR, JS, NATIVE, JVM_IR
// WITH_REFLECT
import kotlin.test.assertEquals
inline class S(val value: String) {
operator fun plus(other: S): S = S(this.value + other.value)
}
class C {
fun member(x: S, y: String): S = x + S(y)
}
fun topLevel(x: String, y: S): S = S(x) + y
/* TODO: support constructors with inline class types in the signature (KT-26765)
class D {
inner class Inner(x: S, y: S) {
val result = x + y
}
}
*/
fun S.extension(y: S): S = this + y
fun S.extension2(): String = value
fun box(): String {
assertEquals(S("ab"), C::member.call(C(), S("a"), "b"))
assertEquals(S("cd"), ::topLevel.call("c", S("d")))
// assertEquals(S("ef"), D::Inner.call(D(), S("e"), S("f")).result)
assertEquals(S("gh"), S::extension.call(S("g"), S("h")))
assertEquals("_", S::extension2.call(S("_")))
assertEquals(S("ij"), C()::member.call(S("i"), "j"))
// assertEquals(S("kl"), D()::Inner.call(S("k"), S("l")).result)
assertEquals(S("mn"), S("m")::extension.call(S("n")))
assertEquals("_", S("_")::extension2.call())
return "OK"
}

View File

@@ -0,0 +1,33 @@
// IGNORE_BACKEND: JS_IR, JS, NATIVE, JVM_IR
// JVM_TARGET: 1.8
// WITH_REFLECT
import kotlin.reflect.KMutableProperty1
import kotlin.reflect.jvm.isAccessible
import kotlin.test.assertEquals
inline class S(val value: String) {
operator fun plus(other: S): S = S(this.value + other.value)
}
object C {
@JvmStatic
private var p: S = S("")
fun boundRef() = this::p.apply { isAccessible = true }
}
fun box(): String {
val unboundRef = C::class.members.single { it.name == "p" } as KMutableProperty1<C, S>
unboundRef.isAccessible = true
assertEquals(Unit, unboundRef.setter.call(C, S("ab")))
assertEquals(S("ab"), unboundRef.call(C))
assertEquals(S("ab"), unboundRef.getter.call(C))
val boundRef = C.boundRef()
assertEquals(Unit, boundRef.setter.call(S("cd")))
assertEquals(S("cd"), boundRef.call())
assertEquals(S("cd"), boundRef.getter.call())
return "OK"
}

View File

@@ -0,0 +1,35 @@
// IGNORE_BACKEND: JS_IR, JS, NATIVE, JVM_IR
// JVM_TARGET: 1.8
// WITH_REFLECT
import kotlin.reflect.KFunction
import kotlin.test.assertEquals
inline class S(val value: String) {
operator fun plus(other: S): S = S(this.value + other.value)
}
object C {
@JvmStatic
fun foo(x: S, y: String): S = x + S(y)
}
interface I {
companion object {
@JvmStatic
fun bar(x: String, y: S): S = S(x) + y
}
}
fun box(): String {
assertEquals(S("ab"), C::foo.call(S("a"), "b"))
assertEquals(S("cd"), (I)::bar.call("c", S("d")))
val unboundFoo = C::class.members.single { it.name == "foo" } as KFunction<*>
assertEquals(S("ef"), unboundFoo.call(C, S("e"), "f"))
val unboundBar = I.Companion::class.members.single { it.name == "bar" } as KFunction<*>
assertEquals(S("gh"), unboundBar.call(I, "g", S("h")))
return "OK"
}

View File

@@ -0,0 +1,51 @@
// IGNORE_BACKEND: JS_IR, JS, NATIVE, JVM_IR
// WITH_REFLECT
import kotlin.reflect.KMutableProperty2
import kotlin.test.assertEquals
inline class S(val value: String) {
operator fun plus(other: S): S = S(this.value + other.value)
}
class C {
var member: S = S("")
private var suffix = S("")
var S.memExt: S
get() = this + suffix
set(value) { suffix = this + value }
}
var topLevel: S = S("")
private var suffix = S("")
var S.ext: S
get() = this + suffix
set(value) { suffix = this + value }
fun box(): String {
val c = C()
assertEquals(Unit, C::member.setter.call(c, S("ab")))
assertEquals(S("ab"), C::member.call(c))
assertEquals(S("ab"), C::member.getter.call(c))
assertEquals(Unit, c::member.setter.call(S("cd")))
assertEquals(S("cd"), c::member.call())
assertEquals(S("cd"), c::member.getter.call())
val memExt = C::class.members.single { it.name == "memExt" } as KMutableProperty2<C, S, S>
assertEquals(Unit, memExt.setter.call(c, S(""), S("f")))
assertEquals(S("ef"), memExt.call(c, S("e")))
assertEquals(S("ef"), memExt.getter.call(c, S("e")))
assertEquals(Unit, ::topLevel.setter.call(S("gh")))
assertEquals(S("gh"), ::topLevel.call())
assertEquals(S("gh"), ::topLevel.getter.call())
assertEquals(Unit, S::ext.setter.call(S(""), S("j")))
assertEquals(S("ij"), S::ext.call(S("i")))
assertEquals(S("ij"), S::ext.getter.call(S("i")))
return "OK"
}

View File

@@ -0,0 +1,43 @@
// IGNORE_BACKEND: JS_IR, JS, NATIVE, JVM_IR
// WITH_REFLECT
import kotlin.test.assertEquals
inline class S(val value: String) {
operator fun plus(other: S): S = S(this.value + other.value)
}
class C {
fun member(a: S, b: S = S("b")): S = a + b
}
fun topLevel(c: S, d: S = S("d")): S = c + d
/* TODO: support constructors with inline class types in the signature (KT-26765)
class D(e: S, f: S = S("f")) {
val result = e + f
}
*/
fun S.extension(h: S = S("h")): S = this + h
fun box(): String {
assertEquals(S("ab"), C::member.callBy(C::member.parameters.filter { it.name != "b" }.associate {
it to (if (it.name == "a") S("a") else C())
}))
assertEquals(S("cd"), ::topLevel.callBy(::topLevel.parameters.filter { it.name != "d" }.associate { it to S("c") }))
// assertEquals(S("ef"), ::D.callBy(::D.parameters.filter { it.name != "f" }.associate { it to S("e") }).result)
assertEquals(S("gh"), S::extension.callBy(S::extension.parameters.filter { it.name != "h" }.associate { it to S("g") }))
val boundMember = C()::member
assertEquals(S("ab"), boundMember.callBy(boundMember.parameters.associate { it to S(it.name!!) }))
val boundExtension = S("g")::extension
assertEquals(S("gh"), boundExtension.callBy(boundExtension.parameters.associate { it to S(it.name!!) }))
return "OK"
}

View File

@@ -0,0 +1,27 @@
// IGNORE_BACKEND: JVM_IR, JS_IR, JS, NATIVE
// WITH_REFLECT
import kotlin.reflect.jvm.*
import kotlin.test.assertEquals
inline class S(val value: String)
fun S.foo(x: Int, s: S): S = this
/* TODO: Support calling members of inline classes in reflection (KT-26748)
inline class T(val s: S) {
fun bar(u: S): T = this
}
*/
fun box(): String {
assertEquals(listOf(String::class.java, Int::class.java, String::class.java), S::foo.parameters.map { it.type.javaType })
assertEquals(S::class.java, S::foo.returnType.javaType)
/*
assertEquals(listOf(), T::bar.parameters.map { it.type.javaType })
assertEquals(String::class.java, T::bar.returnType.javaType)
*/
return "OK"
}

View File

@@ -0,0 +1,17 @@
// LANGUAGE_VERSION: 1.3
open class TestProtectedCompanionInClass {
protected companion object
}
class TestInternalCompanionInClass {
internal companion object
}
class TestPrivateCompanionInClass {
private companion object
}
interface TestPrivateCompanionInInterface {
private companion object
}

View File

@@ -0,0 +1,59 @@
@kotlin.Metadata
public final class TestInternalCompanionInClass$Companion {
inner class TestInternalCompanionInClass$Companion
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
}
@kotlin.Metadata
public final class TestInternalCompanionInClass {
public final static field Companion: TestInternalCompanionInClass$Companion
inner class TestInternalCompanionInClass$Companion
static method <clinit>(): void
public method <init>(): void
}
@kotlin.Metadata
final class TestPrivateCompanionInClass$Companion {
inner class TestPrivateCompanionInClass$Companion
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
}
@kotlin.Metadata
public final class TestPrivateCompanionInClass {
public deprecated final static @java.lang.Deprecated field Companion: TestPrivateCompanionInClass$Companion
inner class TestPrivateCompanionInClass$Companion
static method <clinit>(): void
public method <init>(): void
}
@kotlin.Metadata
final class TestPrivateCompanionInInterface$Companion {
synthetic final static field $$INSTANCE: TestPrivateCompanionInInterface$Companion
inner class TestPrivateCompanionInInterface$Companion
static method <clinit>(): void
private method <init>(): void
}
@kotlin.Metadata
public interface TestPrivateCompanionInInterface {
public deprecated final static @java.lang.Deprecated field Companion: TestPrivateCompanionInInterface$Companion
inner class TestPrivateCompanionInInterface$Companion
static method <clinit>(): void
}
@kotlin.Metadata
public final class TestProtectedCompanionInClass$Companion {
inner class TestProtectedCompanionInClass$Companion
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
}
@kotlin.Metadata
public class TestProtectedCompanionInClass {
public deprecated final static @java.lang.Deprecated field Companion: TestProtectedCompanionInClass$Companion
inner class TestProtectedCompanionInClass$Companion
static method <clinit>(): void
public method <init>(): void
}

View File

@@ -0,0 +1,18 @@
// !LANGUAGE: +InlineClasses
annotation class Ann
inline class Z(val x: Int)
class Test @Ann constructor(@Ann val z: Z) {
@Ann constructor(z: Z, @Ann a: Int) : this(z)
@Ann private constructor(z: Z, @Ann s: String) : this(z)
inner class Inner @Ann constructor(x: Int, @Ann val z2: Z, @Ann y: String)
}
sealed class Sealed @Ann constructor(@Ann val z: Z) {
class Derived @Ann constructor(z: Z) : Sealed(z)
inner class Inner @Ann constructor(x: Int, @Ann val z2: Z, @Ann y: String)
}

View File

@@ -0,0 +1,69 @@
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class Ann
@kotlin.Metadata
public final class Sealed$Derived {
inner class Sealed$Derived
private method <init>(p0: int): void
public synthetic @Ann method <init>(p0: int, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
}
@kotlin.Metadata
public final class Sealed$Inner {
synthetic final field this$0: Sealed
private final field z2: int
inner class Sealed$Inner
public synthetic @Ann method <init>(@java.lang.Synthetic p0: Sealed, p1: int, @Ann p2: int, @Ann p3: java.lang.String, p4: kotlin.jvm.internal.DefaultConstructorMarker): void
private method <init>(p0: Sealed, p1: int, p2: int, p3: java.lang.String): void
public final method getZ2(): int
}
@kotlin.Metadata
public abstract class Sealed {
private final field z: int
inner class Sealed$Derived
inner class Sealed$Inner
private @Ann method <init>(@Ann p0: int): void
public synthetic method <init>(@Ann p0: int, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
public final method getZ(): int
}
@kotlin.Metadata
public final class Test$Inner {
synthetic final field this$0: Test
private final field z2: int
inner class Test$Inner
public synthetic @Ann method <init>(@java.lang.Synthetic p0: Test, p1: int, @Ann p2: int, @Ann p3: java.lang.String, p4: kotlin.jvm.internal.DefaultConstructorMarker): void
private method <init>(p0: Test, p1: int, p2: int, p3: java.lang.String): void
public final method getZ2(): int
}
@kotlin.Metadata
public final class Test {
private final field z: int
inner class Test$Inner
public synthetic @Ann method <init>(@Ann p0: int, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
private method <init>(p0: int): void
public synthetic @Ann method <init>(p0: int, @Ann p1: int, p2: kotlin.jvm.internal.DefaultConstructorMarker): void
private @Ann method <init>(p0: int, @Ann p1: java.lang.String): void
private method <init>(p0: int, p1: int): void
public final method getZ(): int
}
@kotlin.Metadata
public final class Z {
private final field x: int
private synthetic method <init>(p0: int): void
public synthetic final static @org.jetbrains.annotations.NotNull method box-impl(p0: int): Z
public static method constructor-impl(p0: int): int
public method equals(p0: java.lang.Object): boolean
public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean
public final method getX(): int
public method hashCode(): int
public static method hashCode-impl(p0: int): int
public method toString(): java.lang.String
public static @org.jetbrains.annotations.NotNull method toString-impl(p0: int): java.lang.String
public synthetic final method unbox-impl(): int
}

View File

@@ -11,11 +11,11 @@ public interface PublicMarker
public class TestBasic {
private final field z: int
private method <init>(p0: int): void
public synthetic method <init>(p0: int, @org.jetbrains.annotations.NotNull p1: ProtectedMarker, p2: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic method <init>(p0: int, @org.jetbrains.annotations.NotNull p1: PublicMarker, p2: kotlin.jvm.internal.DefaultConstructorMarker): void
private method <init>(p0: int, p1: PrivateMarker): void
private method <init>(p0: int, p1: ProtectedMarker): void
public synthetic method <init>(p0: int, p1: ProtectedMarker, p2: kotlin.jvm.internal.DefaultConstructorMarker): void
private method <init>(p0: int, p1: PublicMarker): void
public synthetic method <init>(p0: int, p1: PublicMarker, p2: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic method <init>(p0: int, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
public final method getZ(): int
}

View File

@@ -0,0 +1,4 @@
// !LANGUAGE: +InlineClasses
@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
inline class Z @PublishedApi internal constructor(val value: Int)

View File

@@ -0,0 +1,16 @@
@kotlin.Metadata
public final class Z {
private final field value: int
private synthetic @kotlin.PublishedApi method <init>(p0: int): void
public synthetic final static @org.jetbrains.annotations.NotNull method box-impl(p0: int): Z
public static @kotlin.PublishedApi method constructor-impl(p0: int): int
public method equals(p0: java.lang.Object): boolean
public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean
public final method getValue(): int
public method hashCode(): int
public static method hashCode-impl(p0: int): int
public method toString(): java.lang.String
public static @org.jetbrains.annotations.NotNull method toString-impl(p0: int): java.lang.String
public synthetic final method unbox-impl(): int
}

View File

@@ -0,0 +1,9 @@
// !LANGUAGE: +ReleaseCoroutines
inline fun inlineMe(crossinline c: suspend () -> Int): suspend () -> Int {
val i: suspend () -> Int = { c() + c() }
return i
}
// 1 valueOf
// 0 boxInt

View File

@@ -0,0 +1,9 @@
// !LANGUAGE: +ReleaseCoroutines
inline suspend fun inlineMe() = 1000
// inlineMe$$forInline : valueOf
// inlineMe : boxInt
// 1 valueOf
// 1 boxInt

View File

@@ -0,0 +1,6 @@
// !LANGUAGE: +ReleaseCoroutines
suspend fun produce(): Int = 1000
// 0 valueOf
// 1 boxInt

View File

@@ -1,10 +1,9 @@
// LANGUAGE_VERSION: 1.3
import kotlin.coroutines.*
import kotlin.sequences.*
fun main(args: Array<String>) {
val s = buildSequence {
val s = sequence {
yield(1)
val a = awaitSeq()
println(a) // (1)
@@ -12,7 +11,7 @@ fun main(args: Array<String>) {
println(s.toList())
}
suspend fun SequenceBuilder<Int>.awaitSeq(): Int = 42
suspend fun SequenceScope<Int>.awaitSeq(): Int = 42
// 1 LOCALVARIABLE a I L18 L22 3
// 1 LINENUMBER 10 L18
// 1 LINENUMBER 9 L18

View File

@@ -0,0 +1,17 @@
val lock = Any()
inline fun inlineMe(c: () -> Unit) {
synchronized(lock) {
c()
}
}
inline fun monitorInFinally(a: () -> Unit, b: () -> Unit) {
try {
a()
} finally {
synchronized(lock) {
b()
}
}
}

View File

@@ -0,0 +1,10 @@
compiler/testData/compileKotlinAgainstCustomBinaries/suspensionPointInMonitor/source.kt:10:13: error: the 'suspensionPoint' suspension point is inside a critical section
suspensionPoint()
^
compiler/testData/compileKotlinAgainstCustomBinaries/suspensionPointInMonitor/source.kt:14:13: error: the 'suspensionPoint' suspension point is inside a critical section
suspensionPoint()
^
compiler/testData/compileKotlinAgainstCustomBinaries/suspensionPointInMonitor/source.kt:19:15: error: the 'suspensionPoint' suspension point is inside a critical section
{ suspensionPoint() }
^
COMPILATION_ERROR

View File

@@ -0,0 +1,22 @@
fun builder(c: suspend () -> Unit) {}
private val lock = Any()
suspend fun suspensionPoint() {}
fun test() {
builder {
synchronized(lock) {
suspensionPoint()
}
inlineMe {
suspensionPoint()
}
monitorInFinally(
{ suspensionPoint() },
{ suspensionPoint() }
)
}
}

View File

@@ -0,0 +1,29 @@
// !LANGUAGE: -ExperimentalBuilderInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Builder<T> {
suspend fun add(t: T) {}
}
fun <S> build(g: suspend Builder<S>.() -> Unit): List<S> = TODO()
fun <S> wrongBuild(g: Builder<S>.() -> Unit): List<S> = TODO()
fun <S> Builder<S>.extensionAdd(s: S) {}
suspend fun <S> Builder<S>.safeExtensionAdd(s: S) {}
val member = build {
add(42)
}
val memberWithoutAnn = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>wrongBuild<!> {
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>add<!>(42)
}
val extension = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
extensionAdd("foo")
}
val safeExtension = build {
safeExtensionAdd("foo")
}

View File

@@ -0,0 +1,22 @@
package
public val extension: [ERROR : Type for build {
extensionAdd("foo")
}]
public val member: kotlin.collections.List<kotlin.Int>
public val memberWithoutAnn: [ERROR : Type for wrongBuild {
add(42)
}]
public val safeExtension: kotlin.collections.List<kotlin.String>
public fun </*0*/ S> build(/*0*/ g: suspend Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public fun </*0*/ S> wrongBuild(/*0*/ g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public fun </*0*/ S> Builder<S>.extensionAdd(/*0*/ s: S): kotlin.Unit
public suspend fun </*0*/ S> Builder<S>.safeExtensionAdd(/*0*/ s: S): kotlin.Unit
public final class Builder</*0*/ T> {
public constructor Builder</*0*/ T>()
public final suspend fun add(/*0*/ t: T): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}

View File

@@ -0,0 +1,37 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: annotation.kt
package kotlin
annotation class BuilderInference
// FILE: test.kt
class Builder<T> {
fun add(t: T) {}
}
fun <S> build(@BuilderInference g: Builder<S>.() -> Unit): List<S> = TODO()
fun <S> wrongBuild(g: Builder<S>.() -> Unit): List<S> = TODO()
fun <S> Builder<S>.extensionAdd(s: S) {}
@BuilderInference
fun <S> Builder<S>.safeExtensionAdd(s: S) {}
val member = build {
add(42)
}
val memberWithoutAnn = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>wrongBuild<!> {
add(42)
}
val extension = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
extensionAdd("foo")
}
val safeExtension = build {
safeExtensionAdd("foo")
}

View File

@@ -0,0 +1,32 @@
package
public val extension: [ERROR : Type for build {
extensionAdd("foo")
}]
public val member: kotlin.collections.List<kotlin.Int>
public val memberWithoutAnn: [ERROR : Type for wrongBuild {
add(42)
}]
public val safeExtension: kotlin.collections.List<kotlin.String>
public fun </*0*/ S> build(/*0*/ @kotlin.BuilderInference g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public fun </*0*/ S> wrongBuild(/*0*/ g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public fun </*0*/ S> Builder<S>.extensionAdd(/*0*/ s: S): kotlin.Unit
@kotlin.BuilderInference public fun </*0*/ S> Builder<S>.safeExtensionAdd(/*0*/ s: S): kotlin.Unit
public final class Builder</*0*/ T> {
public constructor Builder</*0*/ T>()
public final fun add(/*0*/ t: T): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
package kotlin {
public final annotation class BuilderInference : kotlin.Annotation {
public constructor BuilderInference()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}

View File

@@ -0,0 +1,32 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: annotation.kt
package kotlin
annotation class BuilderInference
// FILE: test.kt
class GenericController<T> {
suspend fun yield(t: T) {}
}
suspend fun <S> GenericController<S>.extensionYield(s: S) {}
@BuilderInference
suspend fun <S> GenericController<S>.safeExtensionYield(s: S) {}
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
val normal = generate {
yield(42)
}
val extension = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
extensionYield("foo")
}
val safeExtension = generate {
safeExtensionYield("foo")
}

View File

@@ -0,0 +1,28 @@
package
public val extension: [ERROR : Type for generate {
extensionYield("foo")
}]
public val normal: kotlin.collections.List<kotlin.Int>
public val safeExtension: kotlin.collections.List<kotlin.String>
public fun </*0*/ S> generate(/*0*/ @kotlin.BuilderInference g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
public suspend fun </*0*/ S> GenericController<S>.extensionYield(/*0*/ s: S): kotlin.Unit
@kotlin.BuilderInference public suspend fun </*0*/ S> GenericController<S>.safeExtensionYield(/*0*/ s: S): kotlin.Unit
public final class GenericController</*0*/ T> {
public constructor GenericController</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
}
package kotlin {
public final annotation class BuilderInference : kotlin.Annotation {
public constructor BuilderInference()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}

View File

@@ -0,0 +1,7 @@
import java.io.InputStream
fun InputStream.test() {
readBytes()
<!DEPRECATION!>readBytes<!>(1)
}

View File

@@ -0,0 +1,3 @@
package
public fun java.io.InputStream.test(): kotlin.Unit

View File

@@ -0,0 +1,9 @@
// !API_VERSION: 1.2
import java.io.InputStream
fun InputStream.test() {
readBytes()
readBytes(1)
}

View File

@@ -0,0 +1,3 @@
package
public fun java.io.InputStream.test(): kotlin.Unit

View File

@@ -0,0 +1,27 @@
// !USE_EXPERIMENTAL: kotlin.Experimental
// FILE: api.kt
package feature.experimental.self
@Experimental
annotation class ImportedMarker
@ImportedMarker
object ImportedClass {
@ImportedMarker
fun importedObjectMember() {}
}
@ImportedMarker
fun importedFunction() {}
@ImportedMarker
val importedProperty = Unit
// FILE: usage.kt
import feature.experimental.self.ImportedMarker
import feature.experimental.self.ImportedClass
import feature.experimental.self.importedFunction
import feature.experimental.self.importedProperty
import feature.experimental.self.ImportedClass.importedObjectMember

View File

@@ -0,0 +1,27 @@
package
package feature {
package feature.experimental {
package feature.experimental.self {
@feature.experimental.self.ImportedMarker public val importedProperty: kotlin.Unit
@feature.experimental.self.ImportedMarker public fun importedFunction(): kotlin.Unit
@feature.experimental.self.ImportedMarker public object ImportedClass {
private constructor ImportedClass()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@feature.experimental.self.ImportedMarker public final fun importedObjectMember(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.Experimental public final annotation class ImportedMarker : kotlin.Annotation {
public constructor ImportedMarker()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
}
}

View File

@@ -0,0 +1,9 @@
const val myPi = kotlin.math.PI
annotation class Anno(val d: Double)
@Anno(kotlin.math.PI)
fun f() {}
@Anno(myPi)
fun g() {}

View File

@@ -0,0 +1,13 @@
package
public const val myPi: kotlin.Double = 3.141592653589793.toDouble()
@Anno(d = 3.141592653589793.toDouble()) public fun f(): kotlin.Unit
@Anno(d = 3.141592653589793.toDouble()) public fun g(): kotlin.Unit
public final annotation class Anno : kotlin.Annotation {
public constructor Anno(/*0*/ d: kotlin.Double)
public final val d: kotlin.Double
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}

View File

@@ -0,0 +1,15 @@
// !LANGUAGE: +InlineClasses
package test
annotation class Ann
inline class Z(val x: Int)
class Test @Ann constructor(@Ann val z: Z) {
@Ann constructor(z: Z, @Ann a: Int) : this(z)
@Ann private constructor(z: Z, @Ann s: String) : this(z)
}
sealed class Sealed @Ann constructor(@Ann val z: Z) {
class Derived @Ann constructor(z: Z) : Sealed(z)
}

View File

@@ -0,0 +1,31 @@
package test
public final annotation class Ann : kotlin.Annotation {
/*primary*/ public constructor Ann()
}
public sealed class Sealed {
/*primary*/ @test.Ann private constructor Sealed(/*0*/ @test.Ann z: test.Z)
public final val z: test.Z
public final fun <get-z>(): test.Z
public final class Derived : test.Sealed {
/*primary*/ @test.Ann public constructor Derived(/*0*/ z: test.Z)
public final override /*1*/ /*fake_override*/ val z: test.Z
public final override /*1*/ /*fake_override*/ fun <get-z>(): test.Z
}
}
public final class Test {
/*primary*/ @test.Ann public constructor Test(/*0*/ @test.Ann z: test.Z)
@test.Ann public constructor Test(/*0*/ z: test.Z, /*1*/ @test.Ann a: kotlin.Int)
@test.Ann private constructor Test(/*0*/ z: test.Z, /*1*/ @test.Ann s: kotlin.String)
public final val z: test.Z
public final fun <get-z>(): test.Z
}
public final inline class Z {
/*primary*/ public constructor Z(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public final fun <get-x>(): kotlin.Int
}

View File

@@ -0,0 +1,6 @@
// !LANGUAGE: +InlineClasses
@file:Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
package test
inline class Z @PublishedApi internal constructor(val value: Int)

View File

@@ -0,0 +1,7 @@
package test
public final inline class Z {
/*primary*/ @kotlin.PublishedApi internal constructor Z(/*0*/ value: kotlin.Int)
public final val value: kotlin.Int
public final fun <get-value>(): kotlin.Int
}

View File

@@ -0,0 +1,15 @@
// WITH_RUNTIME
package common
fun test(x: List<Int>?) {
// If the function returns false, the value is definitely not null:
if (!x.isNullOrEmpty()) {
println(x.size) // Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type List<Int>?
}
}
fun test(x: Any?) {
// If the function returns (does not throw), then the argument is true:
require(x is String)
println(x.length) // Unresolved reference: length
}

View File

@@ -0,0 +1,15 @@
// WITH_RUNTIME
package js
fun test(x: List<Int>?) {
// If the function returns false, the value is definitely not null:
if (!x.isNullOrEmpty()) {
println(x.size) // Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type List<Int>?
}
}
fun test(x: Any?) {
// If the function returns (does not throw), then the argument is true:
require(x is String)
println(x.length) // Unresolved reference: length
}

View File

@@ -0,0 +1,15 @@
// WITH_RUNTIME
package jvm
fun test(x: List<Int>?) {
// If the function returns false, the value is definitely not null:
if (!x.isNullOrEmpty()) {
println(x.size) // Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type List<Int>?
}
}
fun test(x: Any?) {
// If the function returns (does not throw), then the argument is true:
require(x is String)
println(x.length) // Unresolved reference: length
}

View File

@@ -0,0 +1,11 @@
-- Common --
Exit code: OK
Output:
-- JVM --
Exit code: OK
Output:
-- JS --
Exit code: OK
Output:

View File

@@ -1,6 +1,5 @@
package test
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val x: String)
typealias ICAlias = IC

View File

@@ -1752,6 +1752,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt");
}
@TestMetadata("inferCoroutineTypeInOldVersion.kt")
public void testInferCoroutineTypeInOldVersion() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferCoroutineTypeInOldVersion.kt");
}
@TestMetadata("kt15516.kt")
public void testKt15516() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt");
@@ -1772,6 +1777,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt");
}
@TestMetadata("resolveUsualCallWithBuilderInference.kt")
public void testResolveUsualCallWithBuilderInference() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/resolveUsualCallWithBuilderInference.kt");
}
@TestMetadata("returnTypeInference.kt")
public void testReturnTypeInference() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/returnTypeInference.kt");
@@ -1802,6 +1812,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt");
}
@TestMetadata("useInferenceInformationFromExtension.kt")
public void testUseInferenceInformationFromExtension() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/useInferenceInformationFromExtension.kt");
}
@TestMetadata("withParameter.kt")
public void testWithParameter() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withParameter.kt");
@@ -2226,6 +2241,29 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Deprecated extends AbstractDiagnosticsTestWithStdLib {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInDeprecated() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/deprecated"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("deprecationOnReadBytes.kt")
public void testDeprecationOnReadBytes() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/deprecated/deprecationOnReadBytes.kt");
}
@TestMetadata("noDeprecationOnReadBytes.kt")
public void testNoDeprecationOnReadBytes() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/deprecated/noDeprecationOnReadBytes.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -2369,6 +2407,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.kt");
}
@TestMetadata("importStatement.kt")
public void testImportStatement() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.kt");
}
@TestMetadata("incorrectTargetsForExperimentalAnnotation.kt")
public void testIncorrectTargetsForExperimentalAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.kt");
@@ -2855,6 +2898,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt2082.kt");
}
@TestMetadata("kt26806.kt")
public void testKt26806() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt26806.kt");
}
@TestMetadata("kt9345.kt")
public void testKt9345() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt9345.kt");

View File

@@ -1752,6 +1752,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt");
}
@TestMetadata("inferCoroutineTypeInOldVersion.kt")
public void testInferCoroutineTypeInOldVersion() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferCoroutineTypeInOldVersion.kt");
}
@TestMetadata("kt15516.kt")
public void testKt15516() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt");
@@ -1772,6 +1777,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt");
}
@TestMetadata("resolveUsualCallWithBuilderInference.kt")
public void testResolveUsualCallWithBuilderInference() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/resolveUsualCallWithBuilderInference.kt");
}
@TestMetadata("returnTypeInference.kt")
public void testReturnTypeInference() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/returnTypeInference.kt");
@@ -1802,6 +1812,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt");
}
@TestMetadata("useInferenceInformationFromExtension.kt")
public void testUseInferenceInformationFromExtension() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/useInferenceInformationFromExtension.kt");
}
@TestMetadata("withParameter.kt")
public void testWithParameter() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withParameter.kt");
@@ -2226,6 +2241,29 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Deprecated extends AbstractDiagnosticsTestWithStdLibUsingJavac {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInDeprecated() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/deprecated"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("deprecationOnReadBytes.kt")
public void testDeprecationOnReadBytes() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/deprecated/deprecationOnReadBytes.kt");
}
@TestMetadata("noDeprecationOnReadBytes.kt")
public void testNoDeprecationOnReadBytes() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/deprecated/noDeprecationOnReadBytes.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -2369,6 +2407,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.kt");
}
@TestMetadata("importStatement.kt")
public void testImportStatement() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.kt");
}
@TestMetadata("incorrectTargetsForExperimentalAnnotation.kt")
public void testIncorrectTargetsForExperimentalAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.kt");
@@ -2855,6 +2898,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt2082.kt");
}
@TestMetadata("kt26806.kt")
public void testKt26806() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt26806.kt");
}
@TestMetadata("kt9345.kt")
public void testKt9345() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/regression/kt9345.kt");

View File

@@ -6343,14 +6343,14 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines");
}
@TestMetadata("kt22694.kt")
@TestMetadata("kt22694_1_2.kt")
public void testKt22694_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines.experimental");
runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_2.kt");
}
@TestMetadata("kt22694.kt")
@TestMetadata("kt22694_1_3.kt")
public void testKt22694_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines");
runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_3.kt");
}
@TestMetadata("labeledWhile.kt")
@@ -7554,14 +7554,14 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines");
}
@TestMetadata("ifExpressionInsideCoroutine.kt")
@TestMetadata("ifExpressionInsideCoroutine_1_2.kt")
public void testIfExpressionInsideCoroutine_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines.experimental");
runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_2.kt");
}
@TestMetadata("ifExpressionInsideCoroutine.kt")
@TestMetadata("ifExpressionInsideCoroutine_1_3.kt")
public void testIfExpressionInsideCoroutine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines");
runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt");
}
@TestMetadata("inlineTwoReceivers.kt")
@@ -11839,6 +11839,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
}
@TestMetadata("unboxValueFromPlatformType.kt")
public void testUnboxValueFromPlatformType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxValueFromPlatformType.kt");
}
@TestMetadata("useInlineClassesInsideElvisOperator.kt")
public void testUseInlineClassesInsideElvisOperator() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/useInlineClassesInsideElvisOperator.kt");
@@ -14367,6 +14372,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/annotations.kt");
}
@TestMetadata("bothInExpectAndActual.kt")
public void testBothInExpectAndActual() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual.kt");
}
@TestMetadata("bothInExpectAndActual2.kt")
public void testBothInExpectAndActual2() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt");
}
@TestMetadata("constructor.kt")
public void testConstructor() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/constructor.kt");
@@ -14887,6 +14902,26 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/objects/companionObjectAccess"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("kt27117_lv12.kt")
public void testKt27117_lv12() throws Exception {
runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv12.kt");
}
@TestMetadata("kt27117_lv13.kt")
public void testKt27117_lv13() throws Exception {
runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv13.kt");
}
@TestMetadata("kt27121_lv12.kt")
public void testKt27121_lv12() throws Exception {
runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv12.kt");
}
@TestMetadata("kt27121_lv13.kt")
public void testKt27121_lv13() throws Exception {
runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv13.kt");
}
@TestMetadata("privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt")
public void testPrivateCompanionObjectAccessedFromAnonymousObjectInNestedClass() throws Exception {
runTest("compiler/testData/codegen/box/objects/companionObjectAccess/privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt");
@@ -17927,6 +17962,44 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/reflection/call/bound/objectPropertyAccessors.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/reflection/call/inlineClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class InlineClasses extends AbstractBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInInlineClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/call/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("fieldAccessors.kt")
public void testFieldAccessors() throws Exception {
runTest("compiler/testData/codegen/box/reflection/call/inlineClasses/fieldAccessors.kt");
}
@TestMetadata("functionsAndConstructors.kt")
public void testFunctionsAndConstructors() throws Exception {
runTest("compiler/testData/codegen/box/reflection/call/inlineClasses/functionsAndConstructors.kt");
}
@TestMetadata("jvmStaticFieldInObject.kt")
public void testJvmStaticFieldInObject() throws Exception {
runTest("compiler/testData/codegen/box/reflection/call/inlineClasses/jvmStaticFieldInObject.kt");
}
@TestMetadata("jvmStaticFunction.kt")
public void testJvmStaticFunction() throws Exception {
runTest("compiler/testData/codegen/box/reflection/call/inlineClasses/jvmStaticFunction.kt");
}
@TestMetadata("properties.kt")
public void testProperties() throws Exception {
runTest("compiler/testData/codegen/box/reflection/call/inlineClasses/properties.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/reflection/callBy")
@@ -17971,6 +18044,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/reflection/callBy/extensionFunction.kt");
}
@TestMetadata("inlineClassFunctionsAndConstructors.kt")
public void testInlineClassFunctionsAndConstructors() throws Exception {
runTest("compiler/testData/codegen/box/reflection/callBy/inlineClassFunctionsAndConstructors.kt");
}
@TestMetadata("jvmStaticInCompanionObject.kt")
public void testJvmStaticInCompanionObject() throws Exception {
runTest("compiler/testData/codegen/box/reflection/callBy/jvmStaticInCompanionObject.kt");
@@ -18852,6 +18930,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/reflection/mapping/types/genericArrayElementType.kt");
}
@TestMetadata("inlineClassInSignature.kt")
public void testInlineClassInSignature() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/inlineClassInSignature.kt");
}
@TestMetadata("innerGenericTypeArgument.kt")
public void testInnerGenericTypeArgument() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/innerGenericTypeArgument.kt");

View File

@@ -38,6 +38,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
runTest("compiler/testData/codegen/bytecodeListing/callableNameIntrinsic.kt");
}
@TestMetadata("companionObjectVisibility_lv13.kt")
public void testCompanionObjectVisibility_lv13() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/companionObjectVisibility_lv13.kt");
}
@TestMetadata("coroutineContextIntrinsic.kt")
public void testCoroutineContextIntrinsic_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutineContextIntrinsic.kt", "kotlin.coroutines.experimental");
@@ -274,6 +279,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("annotationsOnHiddenConstructor.kt")
public void testAnnotationsOnHiddenConstructor() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/annotationsOnHiddenConstructor.kt");
}
@TestMetadata("companionObjectInsideInlineClass.kt")
public void testCompanionObjectInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/companionObjectInsideInlineClass.kt");
@@ -314,6 +324,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/primaryValsWithDifferentVisibilities.kt");
}
@TestMetadata("publishedApiAnnotationOnInlineClassConstructor.kt")
public void testPublishedApiAnnotationOnInlineClassConstructor() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.kt");
}
@TestMetadata("shapeOfInlineClassWithPrimitive.kt")
public void testShapeOfInlineClassWithPrimitive() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/shapeOfInlineClassWithPrimitive.kt");

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