Compare commits

...

279 Commits

Author SHA1 Message Date
Dmitry Petrov
aeedc143d1 JVM_IR KT-45103 update tests for light classes 2021-05-11 12:41:27 +03:00
Dmitry Petrov
7313ce0669 JVM_IR KT-45103 update tests 2021-05-11 12:41:26 +03:00
Dmitry Petrov
ecc4ee7dcd JVM_IR KT-45103 optimize direct invoke for lambdas and callable refs 2021-05-11 12:21:37 +03:00
Vasily Levchenko
c2a46baa77 [build][kotlin-native][test] fix dist dependencies for test targets 2021-05-11 05:47:17 +00:00
Ilmir Usmanov
640d263ae1 Do not unbox nullable Result, since before usage it is coerced
#KT-46505
2021-05-11 05:49:24 +02:00
pyos
656c2496a6 JVM_IR: omit bound receiver in IrExpressionLambdaImpl parameters
and remove a hack intended to replace the missing type conversions this
caused.

 #KT-46505 Fixed
2021-05-11 05:49:20 +02:00
pyos
614d529168 JVM: remove LambdaInfo.invokeMethodDescriptor 2021-05-11 05:49:17 +02:00
Ilya Kirillov
47dc524763 FIR IDE: remove KtUnsubstitutedScope/KtSubstitutedScope as it designed wrong 2021-05-11 01:36:13 +03:00
Ilya Kirillov
90798d8857 FIR IDE: add KDoc for KtScope, choose better names for KtScope members 2021-05-11 01:36:11 +03:00
Ilya Kirillov
f9087a8ab1 FIR IDE: update testdata after changes in symbols 2021-05-11 01:36:10 +03:00
Ilya Kirillov
accc0e3761 FIR IDE: make KtCallableSymbol to be always KtPossiblyExtensionSymbol 2021-05-11 01:36:09 +03:00
Ilya Kirillov
0ba6412f96 FIR IDE: remove KtTypedSymbol interface as all its inheritors are KtCallableSymbol 2021-05-11 01:36:07 +03:00
Jinseong Jeon
bbe5cf0a70 FIR/UAST: clarify what module we should not depend on 2021-05-10 20:23:19 +02:00
Ilya Kirillov
e14848740a FIR IDE: forbid executing write action inside analyse call 2021-05-10 20:44:23 +03:00
Ilya Muradyan
626c1d3b48 [Scripting] Fix repository ID generation for Maven resolver 2021-05-10 19:40:32 +03:00
Ilya Muradyan
7cea639209 chore: fix typo in comment 2021-05-10 19:40:31 +03:00
Dmitry Petrov
ac0aaff611 JVM_IR KT-46562 don't use LambdaMetafactory for Serializable SAMs
TODO support serializable lambdas creation with LambdaMetafactory
2021-05-10 14:54:14 +03:00
Jinseong Jeon
bdfc879f00 FIR checker: report UNINITIALIZED_PARAMETER 2021-05-10 14:26:14 +03:00
Stanislav Erokhin
d2f831b635 Handle exception during intention background computation in tests
Our test infrastructure (in particular, muting mechanics) rely on
thrown exception during doTestFor function call. But if the
exception happened on background thread, then here we'll get only
TimeOutException but the actual exception won't be reported during
doTestFor call. It would be reported later by the common IDEA test
framework and bypass our mute mechanics
2021-05-10 14:04:04 +03:00
Stanislav Erokhin
7ac599520e Add first prototype of BindingContext implementation by FIR
Add ImportMemberIntention intention as a test.
In this commit all failed test were disabled, necessary fixes will be
added in the following commits
2021-05-10 14:04:03 +03:00
Stanislav Erokhin
6919f3dbb5 Move KotlinCacheServiceImpl to plugin-common.xml
This was done to prevent fir plugin from loading FE 1.0 services
2021-05-10 14:04:02 +03:00
Jinseong Jeon
bf85b110da FIR DFA: remove updatedAliasDiff from PersistentFlow
It is no longer used after element-wise join (a5389b06)
2021-05-10 12:16:04 +03:00
Mikhael Bogdanov
cd7841ceed Generate type annotations on class type parameters bounds
#KT-13228
 #KT-46539 Fixed
2021-05-10 12:12:21 +03:00
Mikhael Bogdanov
f574f89f78 Generate class annotation in AbstractAsmLikeInstructionListingTest 2021-05-10 12:12:20 +03:00
Mikhael Bogdanov
40eeee48b6 Extract generation of type parameters annotations and annotation on their bounds into utils 2021-05-10 12:12:19 +03:00
Mikhael Bogdanov
cbe3c66156 Generate function type parameter annotations and type annotations on their bounds into bytecode
Generate type parameter annotation by default for `-Xjvm-target 1.8` and above

 #KT-46539
 #KT-13228
 #KT-46545 Fixed
2021-05-10 12:12:18 +03:00
Mikhael Bogdanov
209ec68591 Make copy for disabled ir tests 2021-05-10 12:12:16 +03:00
Mikhael Bogdanov
5ff4d648f4 Render generic signature in type parameters tests 2021-05-10 12:12:15 +03:00
Mikhael Bogdanov
6182228de8 Render all annotations in type parameters tests 2021-05-10 12:12:14 +03:00
Vladimir Dolzhenko
c98dba6aea Do not set diagnostics callback if it is already set
Relates to #KT-37702
2021-05-10 09:59:16 +02:00
Vladimir Dolzhenko
cf5e6b242b Wrap exception with file details
Relates to #KT-39776
2021-05-07 23:48:12 +02:00
Ilya Muradyan
e9af2849ef Add Kotlin DeprecationLevel into the REPL completion 2021-05-07 19:56:21 +03:00
Mads Ager
6bc4e124fb [JVM_IR] Guard against infinite recursion in JvmIrCodegenFactory.
Fixed KTIJ-11580.
2021-05-07 17:58:49 +02:00
n-p-s
d70b889004 Update declarations to be searchable by their JvmName annotation
Relates to #KT-23653
2021-05-07 17:43:26 +03:00
pyos
36a25353e9 JVM_IR: permit @NoArg if super constructor is already zero-argument
#KT-46537 Fixed
2021-05-07 16:22:30 +02:00
Mikhail Glukhikh
ac9e8f667d Simplify code in Fir2IrConversionScope.returnTarget 2021-05-07 17:06:34 +03:00
Mikhail Glukhikh
05872fc6a8 Support captured types in ConeTypeCompatibilityChecker 2021-05-07 17:06:34 +03:00
Mikhail Glukhikh
df815a64cf FirEqualityCompatibilityChecker: rename file 2021-05-07 17:06:34 +03:00
Mikhail Glukhikh
6a51ddf755 FirEqualityCompatibilityChecker: add exception wrapper 2021-05-07 17:06:34 +03:00
Andrei Klunnyi
b7eded6e48 KT-46146 no 'protected' for final classes
Intention to change final class constructor visibility to 'protected'
was erroneous. This commit removes it.
2021-05-07 12:47:40 +00:00
Andrei Klunnyi
e56a3b3c30 KT-46146 'protected' and 'private' only for sealed constructors
Prior to this commit we suggested two invalid intentions for sealed
class constructors: change visibility to 'public' and 'internal'.

^KT-46146 Fixed
2021-05-07 12:47:39 +00:00
Andrei Klunnyi
686368749a KT-46146 'protected' is unavailable for primary constructors
Prior to this commit intention to change primary constructor visibility
to 'protected' was filtered out.
2021-05-07 12:47:38 +00:00
Alina Dolgikh
7388e60869 Add link to Kotlin 1.5 Event registration
As an experiment, we would like to try promotion in the Github repository.
2021-05-07 14:40:14 +02:00
Ilya Muradyan
042ac5555c Merge pull request #4342 from JetBrains/rr/ileasile/completion-for-function-params
[REPL] Add completion for the call named parameters
2021-05-07 15:11:12 +03:00
Mikhail Glukhikh
27903b4cd6 Configuration fix: make fir2ir tests depend on 'dist' 2021-05-07 10:32:47 +03:00
Alexander Udalov
d306d8a90e JVM IR: cast indy-SAM receiver type from KFunctionN to FunctionN
#KT-46512 Fixed
2021-05-07 00:53:31 +03:00
Ilya Kirillov
124bd559de FIR IDE: fix failing AbstractOverrideImplementTest tests on Windows
Before the System.lineSeparator() was used for splitting KtFile.text into lines.
In IJ all lines has UNIX file endings, so it failed on Windows TC agent
2021-05-07 00:40:52 +03:00
Mikhail Glukhikh
f83841a34f Cleanup FirHelpers (inline / remove / reduce visibility) 2021-05-07 00:40:51 +03:00
Tianyu Geng
9273c6326e FIR IDE: workaround deadlock when resolving class members
When listing members in a class, we need to resolve super types. But if
a super type is defined in another file, this file may not have been
resolved. In this case, listing the members would require resolving the
unresolved file, which can only be done in a write lock.

Before this change, KtFirScopeProvider only acquire the read lock, which
then causes read/write deadlock when the logic tries to further resolve
super types defined in other files. This change makes KtFirScopeProvider
acquire a write lock in the beginning so resolving can happen correctly
later.
2021-05-07 00:40:50 +03:00
Tianyu Geng
7a745cfe5c FIR IDE: Remove unnecessary renderAnnotations option 2021-05-07 00:40:48 +03:00
Tianyu Geng
417c841f77 FIR IDE: Move write actions out of analyze block 2021-05-07 00:40:47 +03:00
Tianyu Geng
e56b39bbd8 FIR IDE: fix typo in package name 2021-05-07 00:40:46 +03:00
Tianyu Geng
d09be811f0 FIR: make class delegation field a fake source
Previously, the FirFieldImpl generated from class delegation has a real
source. This causes troubles in the IDE. This change adds a new fake
source kind for class delegation fields.
2021-05-07 00:40:44 +03:00
Tianyu Geng
0b8b20eda0 FIR IDE: fix KtFirScopeProvider
Currently FIR IDE throws exceptions when enumerating members in this
scope if the class has delegate super types.

java.lang.IllegalStateException: Expected FirResolvedTypeRef with ConeKotlinType but was FirUserTypeRefImpl Tjava.lang.IllegalStateException: java.lang.IllegalStateException: Expected FirResolvedTypeRef with ConeKotlinType but was FirUserTypeRefImpl T
	at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$runTestWithThrowable$3(KotlinTestUtils.java:498)
	at org.jetbrains.kotlin.test.MuteWithDatabaseKt.runTest(muteWithDatabase.kt:96)
	at org.jetbrains.kotlin.test.KotlinTestUtils.runTestWithThrowable(KotlinTestUtils.java:493)
	at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase.runTest(KotlinLightCodeInsightFixtureTestCaseBase.java:93)
	at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:394)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:18)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:13)
	at com.intellij.testFramework.EdtTestUtilKt$runInEdtAndWait$1.run(EdtTestUtil.kt:50)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeAndWait$8(ApplicationImpl.java:475)
	at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:126)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:84)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:132)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:47)
	at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:188)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:971)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:841)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:452)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:744)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:451)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:499)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.IllegalStateException: Expected FirResolvedTypeRef with ConeKotlinType but was FirUserTypeRefImpl T
	at org.jetbrains.kotlin.fir.types.FirTypeUtilsKt.getConeType(FirTypeUtils.kt:33)
	at org.jetbrains.kotlin.fir.scopes.KotlinScopeProviderKt.scopeForSupertype(KotlinScopeProvider.kt:111)
	at org.jetbrains.kotlin.fir.scopes.KotlinScopeProvider.getUseSiteMemberScope(KotlinScopeProvider.kt:42)
	at org.jetbrains.kotlin.fir.scopes.KotlinScopeProviderKt.unsubstitutedScope(KotlinScopeProvider.kt:83)
	at org.jetbrains.kotlin.idea.frontend.api.fir.components.KtFirScopeProvider$getMemberScope$lambda-3$lambda-2$$inlined$withFirForScope$1.invoke(FirRefWithValidityCheck.kt:83)
	at org.jetbrains.kotlin.idea.frontend.api.fir.components.KtFirScopeProvider$getMemberScope$lambda-3$lambda-2$$inlined$withFirForScope$1.invoke(FirRefWithValidityCheck.kt:41)
	at org.jetbrains.kotlin.idea.fir.low.level.api.api.LowLevelFirApiFacadeKt.withFirDeclaration(LowLevelFirApiFacade.kt:209)
	at org.jetbrains.kotlin.idea.frontend.api.fir.components.KtFirScopeProvider.getMemberScope(KtFirScopeProvider.kt:323)
	at org.jetbrains.kotlin.idea.frontend.api.components.KtScopeProviderMixIn$DefaultImpls.getMemberScope(KtScopeProvider.kt:34)
	at org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.getMemberScope(KtAnalysisSession.kt:26)
	at org.jetbrains.kotlin.idea.core.overrideImplement.KtOverrideMembersHandler.getOverridableMembers(KtOverrideMembersHandler.kt:54)
	at org.jetbrains.kotlin.idea.core.overrideImplement.KtOverrideMembersHandler.collectMembers(KtOverrideMembersHandler.kt:35)
	at org.jetbrains.kotlin.idea.core.overrideImplement.KtOverrideMembersHandler.collectMembersToGenerate(KtOverrideMembersHandler.kt:28)
	at org.jetbrains.kotlin.idea.codeInsight.AbstractOverrideImplementTest.doMultiOverrideImplement(AbstractOverrideImplementTest.kt:141)
	at org.jetbrains.kotlin.idea.codeInsight.AbstractOverrideImplementTest.doMultiFileTest(AbstractOverrideImplementTest.kt:98)
	at org.jetbrains.kotlin.idea.codeInsight.AbstractOverrideImplementTest.doMultiOverrideFileTest(AbstractOverrideImplementTest.kt:54)
	at org.jetbrains.kotlin.idea.codeInsight.OverrideImplementTest.testDelegatedMembers(OverrideImplementTest.kt:121)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at junit.framework.TestCase.runTest(TestCase.java:176)
	at com.intellij.testFramework.UsefulTestCase.lambda$runTest$9(UsefulTestCase.java:331)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:462)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:480)
	at com.intellij.testFramework.UsefulTestCase.invokeTestRunnable(UsefulTestCase.java:378)
	at com.intellij.testFramework.UsefulTestCase.runTest(UsefulTestCase.java:350)
	at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase.lambda$runTest$0(KotlinLightCodeInsightFixtureTestCaseBase.java:93)
	at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$runTestWithThrowable$3(KotlinTestUtils.java:495)
	... 36 more
.. 112 more
2021-05-07 00:40:42 +03:00
Tianyu Geng
53aafbd7d9 FIR IDE: enable override implement test for FIR 2021-05-07 00:40:41 +03:00
Tianyu Geng
00031c8eb1 FIR IDE: add action to override/implement missing members
This commit adds the following actions:

- quickfix to implement missing members
- quickfix to implement missing members as constructor parameters
- action to implement members (Code - Generate - Implement)
- action to override members (Code - Generate - Override)

The current implementation is still missing some pieces, which will be
addressed in future changes.

- fully qualified names are not shorten
- some Kotlin types are not rendered correctly
2021-05-07 00:40:40 +03:00
Tianyu Geng
34387e228f FIR IDE: extract common logic idea.core.overrideImplement
Also rename OverrideImplementMemberHandler to GenerateMemberHandler to
align with the naming of its member functions.
2021-05-07 00:40:38 +03:00
Tianyu Geng
06ba143afe FIR IDE: quickfix to make class abstract if member not implemented 2021-05-07 00:40:37 +03:00
Alexander Udalov
6e3009b82e JVM IR: generate adapted callable references as synthetic
As well as suspend conversion adapters, which are unsupported by default
right now.

 #KT-46259 Fixed
2021-05-06 22:58:18 +03:00
Leonid Startsev
d60a8f9baa Use correct type in KClassReference
Make sure that writeSelf function remains static
2021-05-06 19:53:21 +00:00
Leonid Startsev
a58f29aa06 Remove unnecessary ignoreIndexTo outside writeSelf
It never worked: descriptor.declaresDefaultValue used by property.isOptional
works only for current module
(since it looks up psi), so we never access default value initializers
outside current module
2021-05-06 19:53:21 +00:00
Leonid Startsev
66f39ca185 Use SerializerFactory interface and generate function
for sealed and abstract serializable classes.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1116
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1078
2021-05-06 19:53:20 +00:00
Jinseong Jeon
ebbef484ad FIR UAST: add utils to clean up identical render/log files 2021-05-06 20:19:29 +02:00
Jinseong Jeon
1385a4690e Revert "UAST Kotlin: update test data"
This reverts commit 291cd842

A directive to ignore FIR UAST is removed after facade support.
2021-05-06 20:19:29 +02:00
Jinseong Jeon
7f627ab480 FIR UAST: track all legacy test data since facade class is converted
These are mostly mechanical changes.
2021-05-06 20:19:29 +02:00
Jinseong Jeon
939740d26e FIR UAST: convert (light) class for facade 2021-05-06 20:19:29 +02:00
Ilya Goncharov
9baa24e626 [Gradle, JS] Fix with beta version of webpack-dev-server to work with webpack 5
^KT-46162 fixed
^KT-46331 fixed
2021-05-06 18:45:45 +03:00
Mads Ager
b6fa28ea81 [JVM_IR] Deal with inline-class arguments in large arity lambdas.
FunctionNVarargBridgeLowering checked the name of the method instead
of whether the method overrides an invoke method. That doesn't work
when the name of the function gets mangled because of inline class
arguments.

Fixed KT-45084.
2021-05-06 17:27:59 +02:00
pyos
1181854bd6 Add a couple more tests for array constructors and references 2021-05-06 18:25:56 +03:00
pyos
a30cfc332d JVM_IR: remove JvmArrayConstructorLowering
ExpressionCodegen already spills the stack before any loop, so it has
no effect.
2021-05-06 18:25:55 +03:00
pyos
9f53d70109 JVM_IR: move ArrayConstructor below function reference phases
This allows taking function references to inline array constructors.

Also, redundant classes are no longer generated when function references
are passed as arguments to the array constructors.

 #KT-46426 Fixed
2021-05-06 18:25:53 +03:00
Mikhail Glukhikh
776920f77d Cleanup code in FirAnnotationArgumentChecker 2021-05-06 17:51:24 +03:00
Mark Punzalan
18f617a582 FIR: Make FirAnnotationArgumentChecker a FirAnnotationCallChecker, to
run on all annotation calls, including those inside type annotations.
2021-05-06 17:51:22 +03:00
Mikhail Glukhikh
87d05bcf83 Fix spec test data after rebase 2021-05-06 17:50:37 +03:00
Mikhail Glukhikh
e451ecf000 Regenerate FIR IDE tests 2021-05-06 17:50:36 +03:00
Mikhail Glukhikh
1936a815e2 ConeTypeCompatibilityChecker: add temporary workaround for KT-46383 2021-05-06 17:50:35 +03:00
Tianyu Geng
db55a973d4 FIR: fix infinite recursion with equality operator checker 2021-05-06 17:50:34 +03:00
Tianyu Geng
d4717569b9 Fix inferred type of FirGetClassCall
The inferred type should be `KClass<out Blah>` for `FirGetClassCall`
invoked on expressions.
2021-05-06 17:50:33 +03:00
Tianyu Geng
7bb81ef157 FIR: add equality call checker
Added checker for FirEqualityOperatorCall. It's surfaced as one of the
following diagnostics depending on the PSI structure and types under
comparison:

* INCOMPATIBLE_TYPES(_WARNING)
* EQUALITY_NOT_APPLICABLE(_WARNING)
* INCOMPATIBLE_ENUM_COMPARISON_ERROR

Comparing with FE1.0, the current implementation is more conservative
and only highlights error if the types are known to follow certain
contracts with `equals` method. Otherwise, the checker reports warnings
instead.

However, the current checker is more strict in the following situations:
1. it now rejects incompatible enum types like `Enum<E1>` and
  `Enum<E2>`, which was previously accepted
2. it now rejects incompatible class types like `Class<String>` and
  `Class<Int>`, which was previously accepted
3. the check now takes smart cast into consideration, so
  `if (x is String) x == 3` is now rejected
2021-05-06 17:50:32 +03:00
Andrey Zinovyev
787c743333 [FIR] Syntax checkers
Introduce base class for checkers that dive into source trees.
2021-05-06 17:38:04 +03:00
Ilya Matveev
1be39cb505 [K/N] Replace thread_local with THREAD_LOCAL_VARIABLE
For some reason using C++'s thread_local modifier
causes crashes during TLS access on runtime initialization
Kotlin dlls on Windows. This patch replaces the thread_local
modifier with __thread which doesn't have this problem
2021-05-06 14:10:22 +00:00
Ilya Matveev
e2e173b92c [K/N][New MM] Disable tests for ObjC interop 2021-05-06 14:10:22 +00:00
Ilya Matveev
4d346d3735 [K/N][New MM] Support thread state switching
Including

* Support thread state switching in codegen
* Introduce and use GCUnsafeCall annotation
* Switch thread state in C++ runtime code

Also

* Register current thread in Mark&Sweep tests
* Store MemoryState in Worker instance
* Set worker tid in WorkerInit
2021-05-06 14:10:21 +00:00
Ilya Matveev
0b46ed3cde [K/N][New MM] Add thread state asserts to reference updates 2021-05-06 14:10:20 +00:00
Ilya Matveev
08688670b1 [K/N] Adjust repository root in K/N's .idea directory 2021-05-06 14:10:19 +00:00
Yahor Berdnikau
c6fc393417 Enable kotlin java toolchain support for kapt task.
With this change 'KaptWithoutKotlincTask' will also support overriding
default Gradle JDK to run kapt. In such case only 'in-process' kapt
 worker isolation mode is supported.

If user does not provide custom JDK, kapt worker isolation mode will
be 'no-isolation' as before.

^KT-45611 In Progress
2021-05-06 16:04:23 +02:00
Mads Ager
afa1b8bfdc [JVM] Extend boxing/unboxing optimizations to coroutine boxing. 2021-05-06 15:35:49 +02:00
Ivan Gavrilovic
4994cb3774 [Gradle] Create kotlinOptions during task init and keep outputFile for js
This is so that existing build scripts using
withType() do not break. Also, fix the failing
test.

It was necessary to keep outputFile for the js compile task
as it was accessed from the build scripts. Instead, a new
property is introduced which uses Gradle lazy properties.
2021-05-06 13:54:18 +03:00
Ivan Gavrilovic
80181c1091 [Gradle] Add Android bootclasspath lazily 2021-05-06 13:54:17 +03:00
Ivan Gavrilovic
1c0d40055e [Gradle] Support getting the sourceSet name from tasks when...
...Gradle property is being used, instead of the direct String
value.
2021-05-06 13:54:16 +03:00
Ivan Gavrilovic
98cc99e36b [Gradle] Fix adding KAPT generated classess to the compilation classes output 2021-05-06 13:54:15 +03:00
Ivan Gavrilovic
f5caa49c31 [Gradle] Use Gradle properties for KAPT tasks
Use lazy properties to configure KAPT tasks and in the model builder.
Also, avoid eager dependency resolution of the kaptExternalClasspath
file collection.
2021-05-06 13:54:14 +03:00
Ivan Gavrilovic
0882da1788 [Gradle] Introduce classes to configure KAPT tasks
Avoid storing references to KotlinCompile task and use lazy properties
to configure task. Values are kept in-sync with the
Kotlin compile task (for the stub generation) using this mechanism.
2021-05-06 13:54:13 +03:00
Ivan Gavrilovic
01dd15cc3e [Gradle] Use task properties to modify task configuration
This change migrates to using properties of KGP tasks and Gradle
built-in tasks. Also, in TaskProvider class, Configurator instances are
created to configure KGP tasks.
2021-05-06 13:54:12 +03:00
Ivan Gavrilovic
ad9f6e63b6 [Gradle] Extract configuration of KotlinJsIrLink to a class
Migrate KotlinJsIrLink to properties create Configurator class
to configure the task properties.
2021-05-06 13:54:11 +03:00
Ivan Gavrilovic
5eed9a4e6e [Gradle] Extract configuration of KotlinCompileCommon to a class
Migrate KotlinCompileCommon to properties create Configurator class
to configure the task properties.
2021-05-06 13:54:10 +03:00
Ivan Gavrilovic
ff27a61252 [Gradle] Use ConfigurableFileCollection for task local state
Use ConfigurableFileCollection so that tasks can simply append to the
file collection and tasks that do not need this, can simply do nothing.
2021-05-06 13:54:09 +03:00
Ivan Gavrilovic
571c9c10d4 [Gradle] Update compile tasks to use properties and clean up code
Update AbstractKotlinCompile, KotlinCompile, and Kotlin2JsCompile to
use Gradle properties, and introduce Configurator classes that are
using configuration-time data to configure task. Also, introduce
TaskConfigurator interface that should be implemented by classes that
are used to configure tasks.
2021-05-06 13:54:08 +03:00
Ivan Gavrilovic
56cad96718 [Gradle] Remove KotlinCompileTaskData
When getting the incremental compilation information use the
task graph which processes all tasks present in it. Tasks have
all information that is needed to get IncrementalModuleInfo for all
compilations.
2021-05-06 13:54:06 +03:00
Ivan Gavrilovic
b3d8187df4 [Gradle] Remove deprecated ways to specify compiler classpath
This change removes options to specify compiler classpath using
deprecated properties that were deprecated for more than 2 years.
2021-05-06 13:54:05 +03:00
Jinseong Jeon
61e21ef6a2 FIR: ensure the absence of FirResolvedTypeRef with erroneous type 2021-05-06 12:22:40 +03:00
Andrey Zinovyev
cba21c68a3 [lombok] Actualize README 2021-05-06 11:27:51 +03:00
Jinseong Jeon
e2dc21da90 FIR checker: warn useless as and is 2021-05-05 18:20:51 +03:00
Jinseong Jeon
19d939c36e TEST: remove redundant diagnostic directive (w/ syntax error) 2021-05-05 18:20:50 +03:00
Mikhail Glukhikh
7ee6597873 FIR: make inference context mandatory in withNullability() etc. 2021-05-05 17:35:50 +03:00
Jinseong Jeon
bb37728e4f FIR: use withNullability with type context whenever possible
It could simplify flexible type cases.
2021-05-05 17:35:48 +03:00
Anton Lakotka
f94ed1a00c Fail only when KotlinPm20ProjectExtension is passed
to buildKotlinProjectStructureMetadata
#Fixes KTIJ-11586
2021-05-05 16:53:20 +03:00
Jinseong Jeon
291cd842b9 UAST Kotlin: update test data
Addition of directive IGNORE_FIR alters synthetic local variable names.
2021-05-05 14:22:40 +02:00
Jinseong Jeon
dad198cb67 UAST Kotlin: make super type lookup test robust
Newly added directive IGNORE_FIR bothers lookup for object "O".
2021-05-05 14:22:40 +02:00
Jinseong Jeon
03d4cb0dfa FIR UAST: use uast-kotlin/testData for legecy tests 2021-05-05 14:22:40 +02:00
Jinseong Jeon
eac875b5d6 FIR UAST: commonize utils from UAST Kotlin 2021-05-05 14:22:40 +02:00
Jinseong Jeon
f37c722c76 UAST Kotlin: fix typos 2021-05-05 14:22:40 +02:00
Jinseong Jeon
40eaabdbb5 FIR UAST: prototype plugin entrypoint, declarations, test infra 2021-05-05 14:22:40 +02:00
Jinseong Jeon
225e3a747c LC: introduce light class interface for facade
so that FIR-based light class for facade can work well in LC utils
2021-05-05 14:11:48 +02:00
Jinseong Jeon
efba90c6f1 LC: rename KtLightClassForFacade to ...Impl
before introducing a common interface for light class for facade

This is a mechanical refactoring.
2021-05-05 14:11:48 +02:00
Alexander Udalov
c14a890e7e IR: fix capturing of type parameters in local functions
collectPotentiallyCapturedTypeParameters no longer stops on the first
class when going through parents. This is needed because otherwise type
parameters of the containing class, and its outer classes, were never
considered "captured", and thus not duplicated/remapped later in
LocalDeclarationsLowering.

This led to the IR where a local function referenced generic type
parameters of the outer class. On JVM, local function is generated into
a private static function in that container class, and static functions
can't use generic type parameters, which crashed some bytecode
processing tools.

Also, add another explicit call to `seeType` to cover references to
generic type parameters in function return types.

 #KT-45941 Fixed
2021-05-04 21:10:56 +02:00
Vasily Levchenko
b389fd6667 [performance][build][kotlin-build-gradle-plugin] version 0.0.27 (fix) 2021-05-04 15:44:19 +00:00
Stanislav Erokhin
d9be05fea8 Support getContainer for the synthetic it value parameter
Also fixed incorrect KtSymbolOrigin:
it was SOURCE instead of SOURCE_MEMBER_GENERATED
2021-05-04 17:25:34 +02:00
Stanislav Erokhin
c24ad0ba51 Use KtFunctionLiteral as key for KtAnonymousFunctionSymbol retrieving
It seems logical to do, because KtFunctionLiteral is KtDeclaration
and KtLambdaExpression is not. Also FirAnonymousFunction use it as
realPsi reference
2021-05-04 14:01:30 +02:00
Dmitriy Dolovov
75d2e415e1 [K/N][IR] Generate missing return statement, p. 2
^KT-42832
2021-05-04 13:26:02 +03:00
Alexander Shabalin
5e456ed82b Put GC implementations into separate modules.
The mm module now compiles separately for each GC implementation.
2021-05-04 10:23:16 +00:00
Ilya Kirillov
41ab97ff1f FIR IDE: introduce single function for checking if declaration can be lazily resolved 2021-05-04 08:19:50 +02:00
Ilya Kirillov
babf079c31 FIR IDE: fix resolving of inner type aliases 2021-05-04 08:19:50 +02:00
Ilya Kirillov
9e1bc5680d FIR IDE: do not consider KtEnumEntry as ktClassOrObject 2021-05-04 08:19:50 +02:00
Ilya Kirillov
ef5f0e77ec FIR IDE: use KtClassLikeDeclaration.classId instead of hacks 2021-05-04 08:19:50 +02:00
Ilya Kirillov
aff807e3af Stubs: bump stubs version 2021-05-04 08:19:50 +02:00
Ilya Kirillov
4942f5eb66 Stubs: add classId to KtTypeAlias stubs 2021-05-04 08:19:50 +02:00
Ilya Kirillov
fdb091d98e Stubs: add classId to KtClassOrObject stubs 2021-05-04 08:19:49 +02:00
Ilya Kirillov
09a94f3200 FIR IDE: ignore non-passing tests in compiler based tests 2021-05-04 08:19:49 +02:00
Ilya Kirillov
3503a54437 FIR IDE: run tests in parallel in module idea-fir-low-level-api 2021-05-04 08:19:49 +02:00
Ilya Kirillov
65ce641b22 FIR IDE: introduce diagnostics tests bases on FIR diagnostics tests 2021-05-04 08:19:49 +02:00
Ilya Muradyan
b771f9eea4 [REPL] Add completion for the call named parameters 2021-05-04 04:40:00 +03:00
Mads Ager
0c77565104 JVM_IR: Add more local variable tests for finally code. 2021-05-03 07:43:38 +02:00
Mads Ager
6095d8a7fa [JVM] Split the variable range for external finally blocks in inliner
When external finally blocks are inlined none of the current locals
are in scope of the finally block.
2021-05-03 07:43:37 +02:00
Mads Ager
6d9f02cfc6 [JVM_IR] Fix range of locals in connection with finally blocks.
For code such as:

```
try {
  var y = "y"
  for (i in 0 until 1) {
    return y
  }
} finally {
  println("finally")
}
```

The local variables `y` and `i` ended up covering the finally block as
well in the debugger.

This change splits the range of the locals so that they do
not cover the finally block.

This change does not change the inliner to do similar transformations,
so the range of locals is still wrong win finally blocks when inlined
into an inline function. Added a failing test to that effect.
2021-05-03 07:43:37 +02:00
Mikhail Glukhikh
0764a0601c Fix FIR IDE test data broken by 80a44986 2021-05-01 19:12:05 +03:00
sebastian.sellmair
a1ed81146e [Commonizer] Logging: NativeDistributionCommonizationCache: Log in level 'quite' on cache misses
^KT-36679 Verification Pending
2021-05-01 14:36:18 +03:00
sebastian.sellmair
b48850c993 [Commonizer] Logging: Implement CommonizerLogLevel and hide verbose output by default
^KT-36679 Fixed
2021-05-01 14:36:18 +03:00
sebastian.sellmair
7349ec8f2f [Commonizer] Logging: Implement ProgressLogger.fork
^KT-36679
2021-05-01 14:36:16 +03:00
sebastian.sellmair
ec440aecf6 [Commonizer] Logging: Remove 'COMMONIZATION' prologue
^KT-36679
2021-05-01 14:36:15 +03:00
sebastian.sellmair
9d9e11d6d8 [Commonizer] Logging: 'Preparing commonized Kotlin/Native libraries': show outputTarget instead of flat list of targets
^KT-36679
2021-05-01 14:36:14 +03:00
sebastian.sellmair
0d9e32f963 [Commonizer] Logging: Show [Step x of y] only when more than one task is scheduled
^KT-36679
2021-05-01 14:36:13 +03:00
Victor Petukhov
9eaec8d919 Use platform-independent line separator in jspecify tests handler 2021-05-01 13:39:28 +03:00
Nikolay Krasko
2a2fa31577 Allow emulate sonatype publishing when publishing to folder (KTI-552) 2021-05-01 01:41:30 +03:00
Nikolay Krasko
624740a80a Force usage of passed deploy url for sonatype publication (KTI-552) 2021-05-01 01:41:28 +03:00
Nikolay Krasko
2eda82f178 Allow in memory signing (KTI-552) 2021-05-01 01:41:27 +03:00
Nikolay Krasko
8f97d8a78e Drop legacy publishing 2021-05-01 01:37:09 +03:00
Mads Ager
df225c0c7f [JVM] Fix uninitialized locals after coroutine transformation.
The coroutine transformation would leave locals in the local
variable table across the code that reloads local variables from
the continuation on reentry. However, when reentering the function
the local has no value until after the reloads from the
continuation.

This change splits the locals in the local variable table to
avoid such uninitialized locals. A local alive across a
suspension point has its range split in two. One that goes
from the original start to the state label for the restart
after the suspension. The other goes from after the local
has been reloaded from the continuation until the previous
end of the local.
2021-04-30 22:24:03 +02:00
Dmitry Petrov
83e3a702c5 JVM_IR KT-46408 properly map fake overrides in method handles 2021-04-30 22:24:02 +03:00
Vasily Levchenko
ef2c2c2c9e [kotlin][tests][compiler/testData/debug/stepping] kt-42208 test added. 2021-04-30 18:44:55 +00:00
Vasily Levchenko
3160fc84fa [kotlin-native][tests] kt-42208 test added. 2021-04-30 18:44:54 +00:00
Vasily Levchenko
a6a7da31c9 [IR][provisional function expression] do generate function reference with offset of call site. 2021-04-30 18:44:54 +00:00
Tianyu Geng
b6bd4ae8e6 FIR: check DELEGATE_SPECIAL_FUNCTION_RETURN_TYPE_MISMATCH 2021-04-30 19:58:50 +03:00
Mikhael Bogdanov
84e67da2af Mute test on JDK 6 2021-04-30 18:24:10 +02:00
Mikhael Bogdanov
95d95f9a9b Put reification markers came from super object signature
#KT-44770 Fixed
  #KT-30696 Open
2021-04-30 17:34:16 +02:00
Sergey Shanshin
8dd307573a Fix IR compilation of external serializers in native 2021-04-30 18:17:08 +03:00
Mikhail Glukhikh
80a449862e FIR: implement diagnostics for qualifier as stand-alone expression case 2021-04-30 17:59:45 +03:00
Mikhail Glukhikh
84ccf7bbb1 FIR: use Java 8 rules in not implemented checker 2021-04-30 17:59:38 +03:00
Mikhail Glukhikh
5de8401494 Reset FirQualifiedNameResolver properly 2021-04-30 17:59:32 +03:00
Victor Petukhov
4fb78fab93 Temporary disable failing jspecify tests on Windows 2021-04-30 17:50:56 +03:00
Victor Petukhov
c9568c0744 Fix FIR tests 2021-04-30 16:49:56 +03:00
Victor Petukhov
7c62e9aecd Introduce warnings reporting by missed constraints because of incorrect optimization in the constraints processor 2021-04-30 15:46:04 +03:00
Victor Petukhov
e110b49cab Revert "Don't stop constraints processing if all type variables have proper equality constraints"
This reverts commit b87c2a15
2021-04-30 15:46:03 +03:00
Andrey Zinovyev
287ff3ed55 [FIR] Fix for AugmentedArraySetCall expression type
Hacky fix so it's type is Unit and not error
2021-04-30 15:25:44 +03:00
Simon Ogorodnik
6365164c21 FIR: Fix gradle integration tests broken by c6fa3634 2021-04-30 15:19:58 +03:00
Sergey Bogolepov
13464cce68 [Native] Adapt Skia interop to ClangArgs refactoring. 2021-04-30 12:07:46 +00:00
Victor Petukhov
f330d67740 Mute foreign annotations tests with compiled java through psi class files reading 2021-04-30 14:43:28 +03:00
Victor Petukhov
78ffefe107 Add jspecify license 2021-04-30 14:43:27 +03:00
Victor Petukhov
909f0d8bdb Implement caching module annotations per class id 2021-04-30 14:43:27 +03:00
Victor Petukhov
2e57ff25ee Leave KotlinCliJavaFileManager::findClass only passing JavaClassFinder.Request 2021-04-30 14:43:27 +03:00
Victor Petukhov
072bba109f Move foreign annotations logic into the corresponding configurator for the tests 2021-04-30 14:43:27 +03:00
Victor Petukhov
e93133a28f Implement jspecify marks processing in the tests properly, by adding specific handler and cleanuper 2021-04-30 14:43:27 +03:00
Victor Petukhov
b9536a25d6 Support type enhancement on freshly supported module level annotations
^KT-45189 Fixed
2021-04-30 14:43:27 +03:00
Victor Petukhov
bc5e92033b Support reading annotations on java 9 module on sources and binaries 2021-04-30 14:43:27 +03:00
Victor Petukhov
24685ee9d6 Add directive ALL_JAVA_AS_BINARIES and use it explicitly for foreign annotations tests with compiled java 2021-04-30 14:43:27 +03:00
Victor Petukhov
89270399db Update some third-party annotations 2021-04-30 14:43:26 +03:00
Victor Petukhov
cdcde634e8 Add basic Java 9 module tests 2021-04-30 14:43:26 +03:00
Victor Petukhov
757fdb2b32 Add Java 9 jspecify annotations including module level ones 2021-04-30 14:43:26 +03:00
Victor Petukhov
71755b7a5e Support java 9 modules in the diagnostic tests both in sources and binaries 2021-04-30 14:43:26 +03:00
Victor Petukhov
1f0616439c Introduce special common directives for tests based on foreign annotation tests 2021-04-30 14:43:26 +03:00
Victor Petukhov
6065f0e2d0 [Jspecify] Move diagnostic tests against compiled java under the new tests infrastructure 2021-04-30 14:43:26 +03:00
Victor Petukhov
8f097b14cc [Jspecify] Move jspecify test runner under the new tests infrastructure 2021-04-30 14:43:26 +03:00
Victor Petukhov
6f9694174f Move foreign annotation tests into diagnostics folder 2021-04-30 14:43:25 +03:00
Victor Petukhov
57bd4d3a98 [Jspecify] Remove Kotlin use sites generator: consider manually picking changes from the jspecify repo 2021-04-30 14:43:25 +03:00
Victor Petukhov
49e838781c Clean-up JavaModuleInfo.kt 2021-04-30 14:43:25 +03:00
Vasily Levchenko
788d3c022a [build][kotlin-build-gradle-plugin] version 0.0.27
- reading konanVersion and konanMetaVersion from project properties
2021-04-30 10:26:36 +00:00
Vasily Levchenko
9cbcafa8d1 [dependencies][kotlin-build-gradle-plugin] version 0.0.27
- reading konanVersion and konanMetaVersion from project properties
2021-04-30 10:26:35 +00:00
Dmitry Petrov
72804d2e8c JVM_IR KT-45779 don't generate intrinsic method refs via invokedynamic 2021-04-30 12:45:11 +03:00
Sergey Bogolepov
f3a935adb9 Support explicit C++ flags in run_konan tool 2021-04-30 08:39:27 +00:00
Sergey Bogolepov
25ebb3fa75 Remove obsolete Gradle native plugin configuration 2021-04-30 08:39:27 +00:00
Sergey Bogolepov
274d18a141 [Kotlin/Native] Add a workaround for Xcode 12.5
SDKs from Xcode 12.5 contain C++ stdlib and it
breaks compilation of C++ parts of compiler.
Mitigate this problem by explicitly specifying
path to C++ stdlib.
2021-04-30 08:39:26 +00:00
Victor Petukhov
8dd71ec5c8 Build recursive raw types and raw types which contain type parameters properly
1) Substitute erasure of other type parameters
2) Use star projection at top level for recursive raw types

^KT-46126 Fixed
2021-04-30 10:49:47 +03:00
Andi Wenger
f9d2ca68ce KJS IR: Fix KT-45738 - Consider recursive checkForPrimitiveOrPattern
Recursive results from checkForPrimitiveOrPattern were ignored. If it found a case/condition that could not be optimized the resulting "false" was not propagated. This would lead to a "optimized" when without all conditions.
- see KT-45738
- The return is now lifted out of the when to make it more obvious what is going on.
- New test for mixed multiple conditions in when
2021-04-29 23:52:01 +03:00
Ilya Kirillov
caff279255 FIR IDE: add missing binary extensions
This also reveals and error in find usages for fir: it does not work for library source files
So, corresponding tests are muted
2021-04-29 23:31:05 +03:00
Andrey Zinovyev
e4a5775570 Remove duplicated code in annotation-based-compiler-plugins-ide-support 2021-04-29 23:14:16 +03:00
Andrey Zinovyev
8afb6d2761 [lombok] Support import from gradle to IDE
Introduce base module for ide compiler plugins
2021-04-29 23:14:15 +03:00
Andrey Zinovyev
b58bea6fa1 [lombok] IDE plugin with maven import handler 2021-04-29 23:14:14 +03:00
Andrey Zinovyev
07daf2165a [lombok] Rename maven subplugin to 'lombok' 2021-04-29 23:14:13 +03:00
Andrey Zinovyev
b88f54b31a [lombok] Add maven plugin integration test with kapt 2021-04-29 23:14:12 +03:00
Andrey Zinovyev
3e883120dd [lombok] Simple maven plugin to enable lombok support 2021-04-29 23:14:11 +03:00
Ivan Kochurkin
7ec709cf46 FIR: fix incorrect reporting of underscores, simplify code, fix test data file 2021-04-29 22:31:39 +03:00
Jinseong Jeon
9b39a8abc2 FIR: avoid wrapping an erroneous type as FirResolvedTypeRef
Instead, use FirErrorTypeRef, a subtype of FirResolvedTypeRef
2021-04-29 22:31:38 +03:00
Alexander Gorshenev
887032667d [Kotlin/Native][Interop] Skia interop plugin for cinterop 2021-04-29 21:43:26 +03:00
Vladimir Ivanov
5f582ad28a [Kotlin/Native][Interop] Provide pure c wrappers over cpp for skia interop 2021-04-29 21:43:25 +03:00
Yahor Berdnikau
61825e9aec Made GradleCompileTaskProvder compative with configuration cache.
After moving compilerRunner() method evaluation into execution phase,
creation of GradleCompileTaskProvider class started to violate
configuration cache.

^KT-45611 In Progress
2021-04-29 20:43:59 +03:00
Yahor Berdnikau
816e955c61 Introduce KotlinJavaToolchain compile tasks input.
This task input provides a way to set different from current Gradle
JDK and use it for Kotlin files compilation. By default it provides
current Gradle JDK.

Provided JDK major version is used as task input, so on providing
different JDK user will see cache miss.

All required interfaces are located inside api module.

^KT-45611 In Progress
2021-04-29 20:43:58 +03:00
Yahor Berdnikau
201b6dfa60 Print path to java executable Kotlin daemon was started with.
Useful for tests to validate toolchain correct behaviour.

^KT-45611 In Progress
2021-04-29 20:43:57 +03:00
Yahor Berdnikau
85456bd6d8 Add helper methods simplifying working with lazy properties from Kotlin.
Just allow to write Kotlin code easier and nicer when using Gradle
lazy properties.

^KT-45611 In Progress
2021-04-29 20:43:55 +03:00
Yahor Berdnikau
007f11e22e Add initial test setup to enable and test Gradle build cache.
This will allow to write JUnit5 tests to verify tasks are re-using
build cache on rebuilding same project from clean state.

^KT-45611 In Progress
2021-04-29 20:43:54 +03:00
Ilya Kirillov
ddf451739b FIR IDE: add member type-alias test for FileStructureTest 2021-04-29 17:51:28 +02:00
Ilya Kirillov
d438d2db40 FIR IDE: do not remove duplicated diagnostics
This hides the real problem why diagnostics are duplicated
2021-04-29 17:51:28 +02:00
Ilya Kirillov
77ae1fa1f2 FIR IDE: run lazy resolve phases in ContextIndependent ResolutionMode 2021-04-29 17:51:28 +02:00
Ilya Kirillov
663c0d975d FIR IDE: add cases for diagnostics traversal test 2021-04-29 17:51:27 +02:00
Ilya Kirillov
602be42b24 FIR IDE: fix lazy resolve for generated synthetic accessors 2021-04-29 17:51:27 +02:00
Nikolay Krasko
66683d2952 Unwrap both parts of light element in KtLightElementBase.isEquivalentTo
Even if origins are same, wrapped light elements are not equivalent.

Revealed by running bunch of JavaAgainstKotlinBinariesCheckerTestGenerated
tests.

com.intellij.testFramework.LoggedErrorProcessor$TestLoggerAssertionError: Non-idempotent computation:
it returns different results when invoked multiple times or on different threads:

  KtLightMethodForDecompiledDeclaration of KtLightClassForDecompiledDeclaration of PsiFile:A.class != KtLightMethodForDecompiledDeclaration of KtLightClassForDecompiledDeclaration of PsiFile:A.class
2021-04-29 18:20:38 +03:00
Andrey Zinovyev
c8a81911c0 [lombok] Add message about experimental status of the plugin 2021-04-29 18:05:27 +03:00
Ivan Gavrilovic
f0199d7277 [Gradle] Simplify Parcelize Gradle plugin
Do not iterate over all configurations, just
add the dependency to the compile and runtime classpath.
2021-04-29 17:26:36 +03:00
Ilmir Usmanov
cb89bd0e13 Generate SuspendFunction marker interface if supertype is suspend
Otherwise, is/as checks will not work.
 #KT-18707
2021-04-29 17:11:31 +03:00
Margarita Bobova
5d296a01c2 Add changelog for 1.4.31 and 1.4.32 2021-04-29 16:13:13 +03:00
Dmitriy Novozhilov
dbaaf081d7 Fix warning in Kotlin/Native build 2021-04-29 16:07:24 +03:00
Dmitriy Novozhilov
df51856e65 Advance bootstrap to 1.5.20-dev-5753 2021-04-29 16:07:22 +03:00
Mikhail Glukhikh
8147a88353 Cleanup: OverrideResolver.kt 2021-04-29 15:24:57 +03:00
Mikhail Glukhikh
cc05d91bda FE 1.0: add deprecation ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED_WARNING
#KT-45508 Fixed
2021-04-29 15:24:49 +03:00
Svyatoslav Scherbina
59b5475350 Fix WITH_COROUTINES tests compilation on Native after 5617d83c 2021-04-29 11:16:02 +00:00
Steven Schäfer
84d78035e4 JVM IR: Avoid double mangling of function reference invoke methods 2021-04-29 13:10:43 +02:00
Alexander Udalov
276ffd5a4b JVM IR: fix ::class reference and type mapping for scripts
#KT-46284 Fixed
2021-04-29 00:33:34 +03:00
Alexander Udalov
d10f734594 Fix warnings after making getKotlinPluginVersion non-null
See 4cb6303fa8.
2021-04-29 00:18:07 +03:00
Ilya Kirillov
7149d08995 FIR IDE: resolve supertypes before retrieving them 2021-04-28 22:11:05 +03:00
Ilya Kirillov
cccf9b7d54 FIR IDE: add JVM checkers 2021-04-28 17:57:45 +02:00
Ilya Kirillov
81a7271009 FIR: Decouple AbstractDiagnosticCollectorComponent and AbstractDiagnosticCollector 2021-04-28 17:57:45 +02:00
Nikolay Krasko
e43835c9f5 Bump konanVersion: 1.5.30 2021-04-28 17:58:40 +03:00
Ivan Kochurkin
525cc6df97 [FIR] Implement MANY_LAMBDA_EXPRESSION_ARGUMENTS diagnostics, fix tests 2021-04-28 16:21:48 +03:00
Udi Cohen
b8002cb54f [Kapt] Support dumping processors stats to a file
Using the option -Kapt-dump-processor-timings
2021-04-28 11:48:19 +03:00
sebastian.sellmair
beba85a848 [Commonizer] Calculate 'commonModuleNames' in hierarchical context
^KT-46330 Verification Pending
2021-04-28 02:03:20 +03:00
Nikolay Krasko
f7fdffefd6 Add an explicit dependency on dist for UAST tests 2021-04-27 22:00:18 +03:00
Dmitry Petrov
b34e2c1474 JVM_IR KT-36646 fuze primitive equality with safe call 2021-04-27 19:41:31 +03:00
Dmitry Petrov
72849a3dc3 JVM_IR update test for KT-36637 2021-04-27 19:41:29 +03:00
Dmitry Petrov
bdf914e8d5 JVM_IR use static 'hashCode' for boxed primitives on JVM 1.8+ 2021-04-27 19:41:28 +03:00
Dmitriy Novozhilov
07b15f9de6 [FIR] Support effective visibility with @PublishedApi
#KT-46270 Fixed
2021-04-27 18:39:10 +03:00
Dmitriy Novozhilov
32c3f85679 [FIR] Add inline checker for bodies of inline functions
This checker doesn't support `@PublishedAPI` yet, so some BB tests for it
 were muted. #KT-46270
2021-04-27 18:39:09 +03:00
Dmitriy Novozhilov
7e052c1eb1 [FIR] Fix suppressing diagnostics for some expressions 2021-04-27 18:39:07 +03:00
Dmitriy Novozhilov
2a08923c51 [FIR] Add more utilities for builtin functional types 2021-04-27 18:39:06 +03:00
Dmitriy Novozhilov
8925b8c922 [FIR] Fix leaking mutable map type of resolved argument mapping 2021-04-27 18:39:05 +03:00
Dmitriy Novozhilov
1afb844e1a [FIR] Fix FirExpressionWithSmartcastImpl.acceptChildren 2021-04-27 18:39:03 +03:00
Dmitriy Novozhilov
12331cb10c [FIR] Build resolved declaration status for all non-raw declarations 2021-04-27 18:39:02 +03:00
Ivan Kochurkin
d54808e33f [FIR] Implement CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS diagnostics, fix tests 2021-04-27 18:27:39 +03:00
Alexander Likhachev
f2f2df90aa [Gradle] Prevent early resolve of compiler classpath
#KT-45834 Fixed
2021-04-27 18:21:19 +03:00
Dmitry Petrov
660208740e PSI2IR KT-44013 WA: function interface constructor call accepted by FE 2021-04-27 17:35:37 +03:00
Ivan Kochurkin
704b5a0e13 [FIR] Implement UNDERSCORE_IS_RESERVED, UNDERSCORE_USAGE_WITHOUT_BACKTICKS diagnostics (lighttree) 2021-04-27 17:03:53 +03:00
Ivan Kochurkin
ea2d9f7c0c [FIR] Implement UNDERSCORE_IS_RESERVED, UNDERSCORE_USAGE_WITHOUT_BACKTICKS diagnostics (psi only) 2021-04-27 17:03:52 +03:00
Sergey Bogolepov
cc4adb798f Add cacheable targets for macos_arm64 host. 2021-04-27 13:47:20 +00:00
Andrey Zinovyev
0c6066db74 [KAPT] Don't fail on illegal delegate
Kapt ignores error diagnostics, but backend can't
 compile such code at all
This is workaround so backend won't fail.
#KT-46176 Fixed
2021-04-27 16:18:44 +03:00
Ilmir Usmanov
0c0710bb79 Fix outer class accesses inside suspendImpl functions
We need to generate this$0 fields to get to the outer class and generate
accesses to these fields inside suspendImpl function.
 #KT-46214 Fixed
2021-04-27 10:44:18 +02:00
Pavel Kirpichenkov
71365d2452 [IDE] Move library dependency filtering to dependencies cache
The primary client of LibraryDependenciesCache is LibraryInfo,
but it is also used for maintaining modification trackers of
source-dependent libraries. Moving dependency filtering to
cache allows keeping all client in sync.

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

This fixes an issue where some FirAnnotationCalls can be left with some
implicit type refs if they have anonymous functions in the arguments.
2021-04-26 15:11:42 +03:00
Mark Punzalan
e69b729e21 FIR checker: Create a new kind of checker FirTypeChecker and add
FirSuspendModifierChecker to report WRONG_MODIFIER_TARGET for `suspend`
on  non-functional types.
2021-04-26 15:11:41 +03:00
Dmitriy Novozhilov
4282d17467 [FIR] Optimize imports 2021-04-26 15:11:40 +03:00
Mark Punzalan
b88913af1d FIR checker: Report WRONG_MODIFIER_TARGET for suspend on
non-functional types.
2021-04-26 15:11:39 +03:00
Mark Punzalan
9a4742c08d FIR: Properly build nullable suspend function types, and aggregate
modifiers and annotations within KtTypeReference/REFERENCE_TYPE nodes.
2021-04-26 15:11:38 +03:00
Mark Punzalan
9cf5ac1fbd FIR: Render "?" on nullable function types. 2021-04-26 15:11:37 +03:00
Ilya Gorbunov
a9cc046ec9 Add missing constructor for expect annotation class JvmRecord
KT-46280
2021-04-26 10:41:49 +00:00
Alexander Dudinsky
2c29957cb8 Move tests from GradleImportingTestCase to MultiplePluginVersionGradleImportingTestCase 2021-04-26 13:20:00 +03:00
Alexander Dudinsky
e96f64e6c9 Refactor MultiplePluginVersionGradleImportingTestCase
By this commit:
- Used `isTeamcityBuild` flag for a separating local run of the tests from CI
  For local run by default uses master version of gradle-plugin and
  LATEST_SUPPORTED_GRADLE_VERSION of the Gradle.
  But you can specify versions for local run by overriding sysenv
  `IMPORTING_TESTS_LOCAL_RUN_PARAMS`.
  For example: export IMPORTING_TESTS_LOCAL_RUN_PARAMS=6.7.1:1.4.30
- Moved main logic from `GradleImportingTestCase` to
  `MultiplePluginVersionGradleImportingTestCase` for removing the first one later
- Removed `AbstractModelBuilderTest` as useless only
 `DistributionLocator` left from this class.
2021-04-26 13:19:59 +03:00
Ilya Gorbunov
b59f668a50 Change the way kotlin.js source map paths are postprocessed
The idea is that we do no longer use `sourceMapBaseDirs` parameter
of `compileKotlin2Js` task to remove prefix from source paths,
but instead preserve the full paths relative to the output directory.
This allows us to avoid duplicate file names and to identify
source files more reliably.
Then, after sources have been embedded in the source map, we remove
several relative prefixes from source paths.
2021-04-26 13:13:21 +03:00
2873 changed files with 84880 additions and 13338 deletions

View File

@@ -1,5 +1,45 @@
# CHANGELOG
## 1.4.32
### IDE
- [`KT-43824`](https://youtrack.jetbrains.com/issue/KT-43824) KtLightClassForSourceDeclaration#isInheritor works in a different way than java implementation
- [`KT-45287`](https://youtrack.jetbrains.com/issue/KT-45287) LightClasses: `KtLightSimpleModifierList` is no more a parent of `KtLightAnnotationForSourceEntry`
- [`KT-45291`](https://youtrack.jetbrains.com/issue/KT-45291) LightClasses: can't get annotations for constructor val-parameter
- [`KT-45417`](https://youtrack.jetbrains.com/issue/KT-45417) ULC leakage of primitive type annotations
### Tools. CLI
- [`KT-44758`](https://youtrack.jetbrains.com/issue/KT-44758) kotlin-compiler-embeddable dependency includes unshaded `fastutil` package
- [`KT-45007`](https://youtrack.jetbrains.com/issue/KT-45007) Concurrent Kotlin script compilation/execution results in NullPointerException in KeyedExtensionCollector.getPoint()
## 1.4.31
### Compiler
- [`KT-39776`](https://youtrack.jetbrains.com/issue/KT-39776) 2020.3+: Unresolved reference to Kotlin stdlib function
### IDE. Gradle Integration
- [`KT-44845`](https://youtrack.jetbrains.com/issue/KT-44845) After update to Kotlin 1.4.30 all external dependencies is unresolved in IDE with kotlin.mpp.enableGranularSourceSetsMetadata=true
### IDE. Gradle. Script
- [`KTIJ-11137`](https://youtrack.jetbrains.com/issue/KTIJ-1137) build.gradle.kts: Fatal error during save/load standalone scripts settings
- [`KTIJ-898`](https://youtrack.jetbrains.com/issue/KTIJ-898) Unable to import with Kotlin DSL buildscript - NullPointerException in KotlinDslScriptModelProcessorKt.toListOfScriptModels
### IDE. Multiplatform
- [`KTIJ-1200`](https://youtrack.jetbrains.com/issue/KTIJ-1200) KotlinIconProviderKt.addExpectActualMarker takes up to 180+ seconds
### IDE
#### Fixes
- [`KT-44697`](https://youtrack.jetbrains.com/issue/KT-44697) New JVM IR backend notification - narrow its triggering to Kotlin projects
- [`KT-44523`](https://youtrack.jetbrains.com/issue/KT-44523) IDE notification for trying new JVM backend
- [`KTIJ-696`](https://youtrack.jetbrains.com/issue/KTIJ-696) Freeze during startup of IDEA with intellij project with Kotlin (211-1.4.10-release-IJ1440)
## 1.4.30

View File

@@ -4,6 +4,8 @@
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.jetbrains.com/scans?search.rootProjectNames=Kotlin)
[Join Kotlin 1.5 Online Event on May 25, 2021!](https://pages.jetbrains.com/kotlin-online-event-2021/github-readme)
# Kotlin Programming Language
Welcome to [Kotlin](https://kotlinlang.org/)!

View File

@@ -14,8 +14,11 @@ buildscript {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
maven("https://cache-redirector.jetbrains.com/repo.maven.apache.org/maven2")
} else {
maven("https://plugins.gradle.org/m2")
mavenCentral()
}
}
@@ -27,7 +30,7 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.27")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("serialization", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
@@ -333,7 +336,9 @@ extra["tasksWithWarnings"] = listOf(
":kotlin-stdlib-jdk7:compileTestKotlin",
":kotlin-stdlib-jdk8:compileTestKotlin",
":plugins:uast-kotlin:compileKotlin",
":plugins:uast-kotlin:compileTestKotlin"
":plugins:uast-kotlin:compileTestKotlin",
":plugins:uast-kotlin-fir:compileKotlin",
":plugins:uast-kotlin-fir:compileTestKotlin"
)
val tasksWithWarnings: List<String> by extra
@@ -378,7 +383,7 @@ apply {
}
apply {
if (extra["isSonatypeRelease"] as? Boolean == true) {
if (extra["isDeployStagingRepoGenerationRequired"] as? Boolean == true) {
logger.info("Applying configuration for sonatype release")
from("libraries/prepareSonatypeStaging.gradle")
}
@@ -844,11 +849,12 @@ tasks {
":idea:idea-fir:test",
":idea:idea-frontend-api:test",
":idea:idea-frontend-fir:test",
":idea:idea-frontend-fir:idea-fir-low-level-api:test"
":idea:idea-frontend-fir:idea-fir-low-level-api:test",
":plugins:uast-kotlin-fir:test",
":idea:idea-fir-fe10-binding:test"
)
}
register("android-ide-tests") {
dependsOn("dist")
dependsOn(
@@ -894,7 +900,6 @@ tasks {
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
dependsOn(":kotlin-annotation-processing-base:test")
@@ -962,6 +967,7 @@ tasks {
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:compiler-components-for-jps:publish",
":prepare:ide-plugin-dependencies:parcelize-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:lombok-compiler-plugin-for-ide:publish",
":kotlin-script-runtime:publish",
":kotlin-script-util:publish",
":kotlin-scripting-common:publish",

View File

@@ -22,7 +22,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.27")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -144,7 +144,7 @@ java {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.27")
implementation("com.gradle.publish:plugin-publish-plugin:0.14.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")

View File

@@ -18,9 +18,10 @@ buildscript {
} else {
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
}
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.27")
}
}

View File

@@ -229,23 +229,6 @@ fun Project.publish(moduleMetadata: Boolean = false, configure: MavenPublication
publication.configure()
}
fun Project.publishWithLegacyMavenPlugin(body: Upload.() -> Unit = {}): Upload {
apply<plugins.PublishedKotlinModule>()
if (artifactsRemovedDiagnosticFlag) {
error("`publish()` should be called before removing artifacts typically done in `noDefaultJar()` or `runtimeJar()` call")
}
afterEvaluate {
if (configurations.findByName("classes-dirs") != null)
throw GradleException("classesDirsArtifact() is incompatible with publish(), see sources comments for details")
}
return (tasks.getByName("uploadArchives") as Upload).apply {
body()
}
}
fun Project.idePluginDependency(block: () -> Unit) {
val shouldActivate = rootProject.findProperty("publish.ide.plugin.dependencies")?.toString()?.toBoolean() == true
if (shouldActivate) {

View File

@@ -164,7 +164,17 @@ fun Project.configureDefaultPublishing() {
private fun Project.configureSigning() {
configure<SigningExtension> {
sign(extensions.getByType<PublishingExtension>().publications) // all publications
useGpgCmd()
val signKeyId = project.findProperty("signKeyId") as? String
if (!signKeyId.isNullOrBlank()) {
val signKeyPrivate = project.findProperty("signKeyPrivate") as? String
?: error("Parameter `signKeyPrivate` not found")
val signKeyPassphrase = project.findProperty("signKeyPassphrase") as? String
?: error("Parameter `signKeyPassphrase` not found")
useInMemoryPgpKeys(signKeyId, signKeyPrivate, signKeyPassphrase)
} else {
useGpgCmd()
}
}
}

View File

@@ -1,173 +0,0 @@
@file:Suppress("DEPRECATION")
package plugins
import org.codehaus.groovy.runtime.InvokerHelper
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.maven.Conf2ScopeMappingContainer
import org.gradle.api.artifacts.maven.MavenDeployment
import org.gradle.api.artifacts.maven.MavenResolver
import org.gradle.api.plugins.MavenPluginConvention
import org.gradle.api.plugins.MavenRepositoryHandlerConvention
import org.gradle.api.publication.maven.internal.deployer.MavenRemoteRepository
import org.gradle.api.tasks.Upload
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import kotlin.properties.Delegates
/**
* Configures a Kotlin module for publication.
*/
open class PublishedKotlinModule : Plugin<Project> {
private fun String.toBooleanOrNull() = listOf(true, false).firstOrNull { it.toString().equals(this, ignoreCase = true) }
override fun apply(project: Project) {
project.run {
plugins.apply("maven")
configurations.maybeCreate("publishedRuntime").apply {
the<MavenPluginConvention>()
.conf2ScopeMappings
.addMapping(0, this, Conf2ScopeMappingContainer.RUNTIME)
}
configurations.maybeCreate("publishedCompile").apply {
the<MavenPluginConvention>()
.conf2ScopeMappings
.addMapping(0, this, Conf2ScopeMappingContainer.COMPILE)
}
if (!project.hasProperty("prebuiltJar")) {
plugins.apply("signing")
val signingRequired = project.findProperty("signingRequired")?.toString()?.toBooleanOrNull()
?: project.property("isSonatypeRelease") as Boolean
configure<SigningExtension> {
isRequired = signingRequired
sign(configurations["archives"])
useGpgCmd()
}
tasks.named<Sign>("signArchives").configure {
enabled = signingRequired
}
}
fun MavenResolver.configurePom() {
pom.project {
withGroovyBuilder {
"licenses" {
"license" {
"name"("The Apache Software License, Version 2.0")
"url"("http://www.apache.org/licenses/LICENSE-2.0.txt")
"distribution"("repo")
}
}
"name"("${project.group}:${project.name}")
"packaging"("jar")
// optionally artifactId can be defined here
"description"(project.description)
"url"("https://kotlinlang.org/")
"licenses" {
"license" {
"name"("The Apache License, Version 2.0")
"url"("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
"scm" {
"url"("https://github.com/JetBrains/kotlin")
"connection"("scm:git:https://github.com/JetBrains/kotlin.git")
"developerConnection"("scm:git:https://github.com/JetBrains/kotlin.git")
}
"developers" {
"developer" {
"name"("Kotlin Team")
setProperty("organization", "JetBrains")
"organizationUrl"("https://www.jetbrains.com")
}
}
}
}
pom.whenConfigured {
dependencies.removeIf {
InvokerHelper.getMetaClass(it).getProperty(it, "scope") == "test"
}
dependencies
.find {
InvokerHelper.getMetaClass(it).getProperty(it, "groupId") == "org.jetbrains.kotlin"
&& InvokerHelper.getMetaClass(it).getProperty(it, "artifactId") == "kotlin-stdlib"
}
?.also {
InvokerHelper.getMetaClass(it).setProperty(it, "exclusions", emptyList<Any>())
logger.warn("WARNING! Removed exclusions from kotlin-stdlib dependency of ${this.artifactId} artifact's maven metadata, check kotlin-stdlib dependency of ${project.path} project")
}
}
}
tasks.named<Upload>("uploadArchives").configure {
val preparePublication = project.rootProject.tasks.named("preparePublication").get()
dependsOn(preparePublication)
val username: String? by preparePublication.extra
val password: String? by preparePublication.extra
val repoUrl: String by preparePublication.extra
var repository by Delegates.notNull<MavenRemoteRepository>()
repositories {
withConvention(MavenRepositoryHandlerConvention::class) {
mavenDeployer {
withGroovyBuilder {
"beforeDeployment" {
val signing = project.the<SigningExtension>()
if (signing.isRequired)
signing.signPom(delegate as MavenDeployment)
}
"repository"("url" to repoUrl)!!.also { repository = it as MavenRemoteRepository }.withGroovyBuilder {
if (username != null && password != null) {
"authentication"("userName" to username, "password" to password)
}
}
}
configurePom()
}
}
}
doFirst {
repository.url = repoUrl
}
}
val install = if (tasks.names.contains("install")) tasks.getByName("install") as Upload
else tasks.create("install", Upload::class.java)
install.apply {
configuration = project.configurations.getByName(Dependency.ARCHIVES_CONFIGURATION)
description = "Installs the 'archives' artifacts into the local Maven repository."
repositories {
withConvention(MavenRepositoryHandlerConvention::class) {
mavenInstaller {
configurePom()
}
}
}
}
tasks.register("publish") {
dependsOn(tasks.named("uploadArchives"))
}
}
}
}

View File

@@ -354,8 +354,8 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
extractor.provideConfigurationKeys()
extractor.configure(keyConfiguration, module.directives)
}
val kind = configuratorForFlags.extractConfigurationKind(module.directives)
val jdkKind = configuratorForFlags.extractJdkKind(module.directives)
val kind = JvmEnvironmentConfigurator.extractConfigurationKind(module.directives)
val jdkKind = JvmEnvironmentConfigurator.extractJdkKind(module.directives)
keyConfiguration.languageVersionSettings = module.languageVersionSettings

View File

@@ -18,6 +18,7 @@ interface TypeMappingContext<Writer : JvmDescriptorTypeWriter<Type>> {
val typeContext: TypeSystemCommonBackendContextForTypeMapping
fun getClassInternalName(typeConstructor: TypeConstructorMarker): String
fun getScriptInternalName(typeConstructor: TypeConstructorMarker): String
fun Writer.writeGenericType(type: SimpleTypeMarker, asmType: Type, mode: TypeMappingMode)
}
@@ -117,9 +118,7 @@ object AbstractTypeMapper {
}
typeConstructor.isScript() -> {
val asmType = AsmTypes.JAVA_CLASS_TYPE
with(context) { sw?.writeGenericType(type, asmType, mode) }
return asmType
return Type.getObjectType(context.getScriptInternalName(typeConstructor))
}
typeConstructor.isTypeParameter() -> {

View File

@@ -265,13 +265,23 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
);
}
private static void addReifiedParametersFromSignature(@NotNull MemberCodegen member, @NotNull ClassDescriptor descriptor) {
private static void addReifiedParametersFromSignature(@NotNull MemberCodegen<?> member, @NotNull ClassDescriptor descriptor) {
for (KotlinType type : descriptor.getTypeConstructor().getSupertypes()) {
for (TypeProjection supertypeArgument : type.getArguments()) {
TypeParameterDescriptor parameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(supertypeArgument.getType());
if (parameterDescriptor != null && parameterDescriptor.isReified()) {
processTypeArguments(member, type);
}
}
private static void processTypeArguments(@NotNull MemberCodegen<?> member, KotlinType type) {
for (TypeProjection supertypeArgument : type.getArguments()) {
if (supertypeArgument.isStarProjection()) continue;
TypeParameterDescriptor parameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(supertypeArgument.getType());
if (parameterDescriptor != null) {
if (parameterDescriptor.isReified()) {
member.getReifiedTypeParametersUsages().addUsedReifiedParameter(parameterDescriptor.getName().asString());
}
} else {
processTypeArguments(member, supertypeArgument.getType());
}
}
}

View File

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

View File

@@ -650,7 +650,7 @@ class CoroutineTransformerMethodVisitor(
val livenessFrames = analyzeLiveness(methodNode)
// References shall be cleaned up after uspill (during spill in next suspension point) to prevent memory leaks,
// References shall be cleaned up after unspill (during spill in next suspension point) to prevent memory leaks,
val referencesToSpillBySuspensionPointIndex = arrayListOf<List<ReferenceToSpill>>()
// while primitives shall not
val primitivesToSpillBySuspensionPointIndex = arrayListOf<List<PrimitiveToSpill>>()
@@ -759,6 +759,35 @@ class CoroutineTransformerMethodVisitor(
referencesToCleanBySuspensionPointIndex += currentSpilledReferencesCount to predSpilledReferencesCount
}
// Calculate debug metadata mapping before modifying method node to make it easier to locate
// locals alive across suspension points.
fun calculateSpilledVariableAndField(
suspension: SuspensionPoint,
slot: Int,
spillableVariable: SpillableVariable?
): SpilledVariableAndField? {
if (spillableVariable == null) return null
val name = localVariableName(methodNode, slot, suspension.suspensionCallBegin.index()) ?: return null
return SpilledVariableAndField(spillableVariable.fieldName, name)
}
val spilledToVariableMapping = arrayListOf<List<SpilledVariableAndField>>()
for (suspensionPointIndex in suspensionPoints.indices) {
val suspension = suspensionPoints[suspensionPointIndex]
val spilledToVariable = arrayListOf<SpilledVariableAndField>()
referencesToSpillBySuspensionPointIndex[suspensionPointIndex].mapNotNullTo(spilledToVariable) { (slot, spillableVariable) ->
calculateSpilledVariableAndField(suspension, slot, spillableVariable)
}
primitivesToSpillBySuspensionPointIndex[suspensionPointIndex].mapNotNullTo(spilledToVariable) { (slot, spillableVariable) ->
calculateSpilledVariableAndField(suspension, slot, spillableVariable)
}
spilledToVariableMapping += spilledToVariable
}
// Mutate method node
fun generateSpillAndUnspill(suspension: SuspensionPoint, slot: Int, spillableVariable: SpillableVariable?) {
@@ -772,6 +801,22 @@ class CoroutineTransformerMethodVisitor(
return
}
// Find and remove the local variable node, if any, in the local variable table corresponding to the slot that is spilled.
var local: LocalVariableNode? = null
val localRestart = LabelNode().linkWithLabel()
val iterator = methodNode.localVariables.listIterator()
while (iterator.hasNext()) {
val node = iterator.next()
if (node.index == slot &&
methodNode.instructions.indexOf(node.start) <= methodNode.instructions.indexOf(suspension.suspensionCallBegin) &&
methodNode.instructions.indexOf(node.end) > methodNode.instructions.indexOf(suspension.tryCatchBlockEndLabelAfterSuspensionCall)
) {
local = node
iterator.remove()
break
}
}
with(instructions) {
// store variable before suspension call
insertBefore(suspension.suspensionCallBegin, withInstructionAdapter {
@@ -795,8 +840,31 @@ class CoroutineTransformerMethodVisitor(
)
StackValue.coerce(spillableVariable.normalizedType, spillableVariable.type, this)
store(slot, spillableVariable.type)
if (local != null) {
visitLabel(localRestart.label)
}
})
}
// Split the local variable range for the local so that it is visible until the next state label, but is
// not visible until it has been unspilled from the continuation on the reentry path.
if (local != null) {
val previousEnd = local.end
local.end = suspension.stateLabel
// Add the local back, but end it at the next state label.
methodNode.localVariables.add(local)
// Add a new entry that starts after the local variable is restored from the continuation.
methodNode.localVariables.add(
LocalVariableNode(
local.name,
local.desc,
local.signature,
localRestart,
previousEnd,
local.index
)
)
}
}
fun cleanUpField(suspension: SuspensionPoint, fieldIndex: Int) {
@@ -839,33 +907,6 @@ class CoroutineTransformerMethodVisitor(
}
}
// Calculate debug metadata mapping
fun calculateSpilledVariableAndField(
suspension: SuspensionPoint,
slot: Int,
spillableVariable: SpillableVariable?
): SpilledVariableAndField? {
if (spillableVariable == null) return null
val name = localVariableName(methodNode, slot, suspension.suspensionCallEnd.next.index()) ?: return null
return SpilledVariableAndField(spillableVariable.fieldName, name)
}
val spilledToVariableMapping = arrayListOf<List<SpilledVariableAndField>>()
for (suspensionPointIndex in suspensionPoints.indices) {
val suspension = suspensionPoints[suspensionPointIndex]
val spilledToVariable = arrayListOf<SpilledVariableAndField>()
referencesToSpillBySuspensionPointIndex[suspensionPointIndex].mapNotNullTo(spilledToVariable) { (slot, spillableVariable) ->
calculateSpilledVariableAndField(suspension, slot, spillableVariable)
}
primitivesToSpillBySuspensionPointIndex[suspensionPointIndex].mapNotNullTo(spilledToVariable) { (slot, spillableVariable) ->
calculateSpilledVariableAndField(suspension, slot, spillableVariable)
}
spilledToVariableMapping += spilledToVariable
}
return spilledToVariableMapping
}
@@ -901,7 +942,6 @@ class CoroutineTransformerMethodVisitor(
suspendMarkerVarIndex: Int,
suspendPointLineNumber: LineNumberNode?
): LabelNode {
val stateLabel = LabelNode().linkWithLabel()
val continuationLabelAfterLoadedResult = LabelNode()
val suspendElementLineNumber = lineNumber
var nextLineNumberNode = nextDefinitelyHitLineNumber(suspension)
@@ -929,7 +969,7 @@ class CoroutineTransformerMethodVisitor(
load(suspendMarkerVarIndex, AsmTypes.OBJECT_TYPE)
areturn(AsmTypes.OBJECT_TYPE)
// Mark place for continuation
visitLabel(stateLabel.label)
visitLabel(suspension.stateLabel.label)
})
// After suspension point there is always three nodes: L1, NOP, L2
@@ -985,7 +1025,7 @@ class CoroutineTransformerMethodVisitor(
}
}
return stateLabel
return suspension.stateLabel
}
// Find the next line number instruction that is defintely hit. That is, a line number
@@ -1154,6 +1194,7 @@ internal class SuspensionPoint(
) {
lateinit var tryCatchBlocksContinuationLabel: LabelNode
val stateLabel = LabelNode().linkWithLabel()
val unboxInlineClassInstructions: List<AbstractInsnNode> = findUnboxInlineClassInstructions()
private fun findUnboxInlineClassInstructions(): List<AbstractInsnNode> {

View File

@@ -320,8 +320,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
val splitBy = SimpleInterval(start.info as LabelNode, extension.finallyIntervalEnd)
processor.tryBlocksMetaInfo.splitAndRemoveCurrentIntervals(splitBy, true)
//processor.getLocalVarsMetaInfo().splitAndRemoveIntervalsFromCurrents(splitBy);
processor.localVarsMetaInfo.splitAndRemoveCurrentIntervals(splitBy, true);
mark.dropTo()
}
@@ -330,8 +329,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
}
processor.substituteTryBlockNodes(intoNode)
//processor.substituteLocalVarTable(intoNode);
processor.substituteLocalVarTable(intoNode);
}
protected abstract fun generateAssertFieldIfNeeded(info: RootInliningContext)

View File

@@ -47,7 +47,9 @@ abstract class LambdaInfo(@JvmField val isCrossInline: Boolean) : FunctionalArgu
abstract val invokeMethod: Method
abstract val invokeMethodDescriptor: FunctionDescriptor
abstract val invokeMethodParameters: List<KotlinType?>
abstract val invokeMethodReturnType: KotlinType?
abstract val capturedVars: List<CapturedParamDesc>
@@ -98,14 +100,16 @@ class PsiDefaultLambda(
offset: Int,
needReification: Boolean
) : DefaultLambda(lambdaClassType, capturedArgs, parameterDescriptor, offset, needReification) {
override fun mapAsmSignature(sourceCompiler: SourceCompilerForInline): Method {
return sourceCompiler.state.typeMapper.mapSignatureSkipGeneric(invokeMethodDescriptor).asmMethod
}
override fun mapAsmSignature(sourceCompiler: SourceCompilerForInline, descriptor: FunctionDescriptor): Method =
sourceCompiler.state.typeMapper.mapSignatureSkipGeneric(descriptor).asmMethod
override fun findInvokeMethodDescriptor(): FunctionDescriptor =
override fun findInvokeMethodDescriptor(isPropertyReference: Boolean): FunctionDescriptor =
parameterDescriptor.type.memberScope
.getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND)
.single()
.single().let {
// property reference generates erased 'get' method
if (isPropertyReference) it.original else it
}
}
abstract class DefaultLambda(
@@ -124,7 +128,13 @@ abstract class DefaultLambda(
final override lateinit var invokeMethod: Method
private set
override lateinit var invokeMethodDescriptor: FunctionDescriptor
private lateinit var invokeMethodDescriptor: FunctionDescriptor
override val invokeMethodParameters: List<KotlinType?>
get() = invokeMethodDescriptor.valueParameters.map { it.returnType } // should be FunctionN, so no extension receiver
override val invokeMethodReturnType: KotlinType?
get() = invokeMethodDescriptor.returnType
final override lateinit var capturedVars: List<CapturedParamDesc>
private set
@@ -155,10 +165,7 @@ abstract class DefaultLambda(
}
}, ClassReader.SKIP_CODE or ClassReader.SKIP_FRAMES or ClassReader.SKIP_DEBUG)
invokeMethodDescriptor = findInvokeMethodDescriptor().let {
//property reference generates erased 'get' method
if (isPropertyReference) it.original else it
}
invokeMethodDescriptor = findInvokeMethodDescriptor(isPropertyReference)
val descriptor = Type.getMethodDescriptor(Type.VOID_TYPE, *capturedArgs)
val constructor = getMethodNode(classBytes, "<init>", descriptor, lambdaClassType)?.node
@@ -182,7 +189,7 @@ abstract class DefaultLambda(
val methodName = (if (isPropertyReference) OperatorNameConventions.GET else OperatorNameConventions.INVOKE).asString()
val signature = mapAsmSignature(sourceCompiler)
val signature = mapAsmSignature(sourceCompiler, invokeMethodDescriptor)
node = getMethodNode(classBytes, methodName, signature.descriptor, lambdaClassType, signatureAmbiguity = true)
?: error("Can't find method '$methodName$signature' in '${classReader.className}'")
@@ -195,9 +202,10 @@ abstract class DefaultLambda(
}
}
protected abstract fun mapAsmSignature(sourceCompiler: SourceCompilerForInline): Method
protected abstract fun mapAsmSignature(sourceCompiler: SourceCompilerForInline, descriptor: FunctionDescriptor): Method
protected abstract fun findInvokeMethodDescriptor(): FunctionDescriptor
// TODO: get rid of this; descriptors should *only* be used by PsiDefaultLambda
protected abstract fun findInvokeMethodDescriptor(isPropertyReference: Boolean): FunctionDescriptor
private companion object {
val PROPERTY_REFERENCE_SUPER_CLASSES =
@@ -221,7 +229,6 @@ abstract class ExpressionLambda(isCrossInline: Boolean) : LambdaInfo(isCrossInli
node.node.preprocessSuspendMarkers(forInline = true, keepFakeContinuation = false)
}
abstract fun getInlineSuspendLambdaViewDescriptor(): FunctionDescriptor
abstract fun isCapturedSuspend(desc: CapturedParamDesc): Boolean
}
@@ -237,7 +244,24 @@ class PsiExpressionLambda(
override val invokeMethod: Method
override val invokeMethodDescriptor: FunctionDescriptor
val invokeMethodDescriptor: FunctionDescriptor
override val invokeMethodParameters: List<KotlinType?>
get() {
val actualInvokeDescriptor = if (isSuspend)
getOrCreateJvmSuspendFunctionView(
invokeMethodDescriptor,
languageVersionSettings.isReleaseCoroutines(),
typeMapper.bindingContext
)
else
invokeMethodDescriptor
val valueParameters = actualInvokeDescriptor.valueParameters.map { it.returnType }
return actualInvokeDescriptor.extensionReceiverParameter?.let { listOf(it.returnType) + valueParameters } ?: valueParameters
}
override val invokeMethodReturnType: KotlinType?
get() = invokeMethodDescriptor.returnType
val classDescriptor: ClassDescriptor
@@ -325,14 +349,6 @@ class PsiExpressionLambda(
val isPropertyReference: Boolean
get() = propertyReferenceInfo != null
override fun getInlineSuspendLambdaViewDescriptor(): FunctionDescriptor {
return getOrCreateJvmSuspendFunctionView(
invokeMethodDescriptor,
languageVersionSettings.isReleaseCoroutines(),
typeMapper.bindingContext
)
}
override fun isCapturedSuspend(desc: CapturedParamDesc): Boolean =
isCapturedSuspendLambda(closure, desc.fieldName, typeMapper.bindingContext)
}

View File

@@ -23,13 +23,13 @@ import org.jetbrains.kotlin.codegen.optimization.fixStack.top
import org.jetbrains.kotlin.codegen.optimization.nullCheck.isCheckParameterIsNotNull
import org.jetbrains.kotlin.codegen.pseudoInsns.PseudoInsn
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.util.OperatorNameConventions
import org.jetbrains.kotlin.utils.SmartList
import org.jetbrains.kotlin.utils.SmartSet
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
@@ -233,38 +233,24 @@ class MethodInliner(
return
}
// in case of inlining suspend lambda reference as ordinary parameter of inline function:
// suspend fun foo (...) ...
// inline fun inlineMe(c: (...) -> ...) ...
// builder {
// inlineMe(::foo)
// }
// we should create additional parameter for continuation.
val valueParameters = info.invokeMethodParameters
// If suspend lambda has no continuation at the end, add it here. (In the IR backend, suspend lambdas
// always come pre-lowered with the continuation parameter.)
var coroutineDesc = desc
val actualInvokeDescriptor: FunctionDescriptor
if (info.isSuspend) {
actualInvokeDescriptor = (info as ExpressionLambda).getInlineSuspendLambdaViewDescriptor()
val parametersSize = actualInvokeDescriptor.valueParameters.size +
(if (actualInvokeDescriptor.extensionReceiverParameter != null) 1 else 0)
// And here we expect invoke(...Ljava/lang/Object;) be replaced with invoke(...Lkotlin/coroutines/Continuation;)
// if this does not happen, insert fake continuation, since we could not have one yet.
if (!inliningContext.root.state.isIrBackend && info.isSuspend) {
val argumentTypes = Type.getArgumentTypes(desc)
if (argumentTypes.size != parametersSize &&
// But do not add it in IR. In IR we already have lowered lambdas with additional parameter, while in Old BE we don't.
!inliningContext.root.state.isIrBackend
) {
if (argumentTypes.size != valueParameters.size) {
addFakeContinuationMarker(this)
coroutineDesc = Type.getMethodDescriptor(Type.getReturnType(desc), *argumentTypes, AsmTypes.OBJECT_TYPE)
}
} else {
actualInvokeDescriptor = info.invokeMethodDescriptor
}
val valueParameters =
listOfNotNull(actualInvokeDescriptor.extensionReceiverParameter) + actualInvokeDescriptor.valueParameters
val erasedInvokeFunction = ClosureCodegen.getErasedInvokeFunction(actualInvokeDescriptor)
val invokeParameters = erasedInvokeFunction.valueParameters
// TODO: this is a weird way to get N instances of `Any?`
val moduleBuiltIns = inliningContext.root.sourceCompilerForInline.compilationContextDescriptor.builtIns
val erasedFunctionType = moduleBuiltIns.getFunction(valueParameters.size).defaultType
val erasedInvokeFunction = erasedFunctionType.memberScope
.getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND).first()
val invokeParameters = erasedInvokeFunction.valueParameters.map { it.returnType }
val valueParamShift = max(nextLocalIndex, markerShift)//NB: don't inline cause it changes
val parameterTypesFromDesc = info.invokeMethod.argumentTypes
@@ -305,7 +291,7 @@ class MethodInliner(
result.reifiedTypeParametersUsages.mergeAll(lambdaResult.reifiedTypeParametersUsages)
StackValue
.onStack(info.invokeMethod.returnType, info.invokeMethodDescriptor.returnType)
.onStack(info.invokeMethod.returnType, info.invokeMethodReturnType)
.put(OBJECT_TYPE, erasedInvokeFunction.returnType, this)
setLambdaInlining(false)
addInlineMarker(this, false)
@@ -1075,8 +1061,8 @@ class MethodInliner(
private fun putStackValuesIntoLocalsForLambdaOnInvoke(
directOrder: List<Type>,
directOrderOfArguments: List<ParameterDescriptor>,
directOrderOfInvokeParameters: List<ValueParameterDescriptor>,
directOrderOfArguments: List<KotlinType?>,
directOrderOfInvokeParameters: List<KotlinType?>,
shift: Int,
iv: InstructionAdapter,
descriptor: String
@@ -1099,8 +1085,8 @@ class MethodInliner(
val argumentKotlinType: KotlinType?
val invokeParameterKotlinType: KotlinType?
if (safeToUseArgumentKotlinType) {
argumentKotlinType = directOrderOfArguments[index].type
invokeParameterKotlinType = directOrderOfInvokeParameters[index].type
argumentKotlinType = directOrderOfArguments[index]
invokeParameterKotlinType = directOrderOfInvokeParameters[index]
} else {
argumentKotlinType = null
invokeParameterKotlinType = null

View File

@@ -18,12 +18,16 @@ package org.jetbrains.kotlin.codegen.optimization.boxing
import com.google.common.collect.ImmutableSet
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.coroutines.RELEASE_COROUTINES_VERSION_SETTINGS
import org.jetbrains.kotlin.codegen.coroutines.coroutinesJvmInternalPackageFqName
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
import org.jetbrains.kotlin.codegen.optimization.common.OptimizationBasicInterpreter
import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
import org.jetbrains.kotlin.codegen.topLevelClassInternalName
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
import org.jetbrains.org.objectweb.asm.Opcodes
@@ -174,7 +178,7 @@ fun AbstractInsnNode.isUnboxing(state: GenerationState) =
isPrimitiveUnboxing() || isJavaLangClassUnboxing() || isInlineClassUnboxing(state)
fun AbstractInsnNode.isBoxing(state: GenerationState) =
isPrimitiveBoxing() || isJavaLangClassBoxing() || isInlineClassBoxing(state)
isPrimitiveBoxing() || isJavaLangClassBoxing() || isInlineClassBoxing(state) || isCoroutinePrimitiveBoxing()
fun AbstractInsnNode.isPrimitiveUnboxing() =
isMethodInsnWith(Opcodes.INVOKEVIRTUAL) {
@@ -211,6 +215,19 @@ fun AbstractInsnNode.isPrimitiveBoxing() =
isBoxingMethodDescriptor()
}
private val BOXING_CLASS_INTERNAL_NAME =
RELEASE_COROUTINES_VERSION_SETTINGS.coroutinesJvmInternalPackageFqName().child(Name.identifier("Boxing")).topLevelClassInternalName()
private fun isJvmPrimitiveName(name: String) = JvmPrimitiveType.values().any { it.javaKeywordName == name }
fun AbstractInsnNode.isCoroutinePrimitiveBoxing(): Boolean {
return isMethodInsnWith(Opcodes.INVOKESTATIC) {
owner == BOXING_CLASS_INTERNAL_NAME &&
name.startsWith("box") &&
isJvmPrimitiveName(name.substring(3).lowercase())
}
}
private fun MethodInsnNode.isBoxingMethodDescriptor(): Boolean {
val ownerType = Type.getObjectType(owner)
return desc == Type.getMethodDescriptor(ownerType, AsmUtil.unboxType(ownerType))

View File

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

View File

@@ -377,7 +377,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise"""
)
var stringConcat: String? by NullableStringFreezableVar(JvmStringConcat.INLINE.description)
var stringConcat: String? by NullableStringFreezableVar(null)
@Argument(
value = "-Xsam-conversions",

View File

@@ -22,6 +22,7 @@ import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiJavaModule
import com.intellij.psi.PsiManager
import com.intellij.psi.impl.light.LightJavaModule
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.cli.common.config.ContentRoot
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
@@ -37,6 +38,7 @@ import org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder
import org.jetbrains.kotlin.cli.jvm.modules.JavaModuleGraph
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.isValidJavaFqName
import org.jetbrains.kotlin.resolve.jvm.KotlinCliJavaFileManager
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModule
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo
import org.jetbrains.kotlin.resolve.jvm.modules.KOTLIN_STDLIB_MODULE_NAME
@@ -52,10 +54,13 @@ class ClasspathRootsResolver(
private val contentRootToVirtualFile: (JvmContentRoot) -> VirtualFile?,
private val javaModuleFinder: CliJavaModuleFinder,
private val requireStdlibModule: Boolean,
private val outputDirectory: VirtualFile?
private val outputDirectory: VirtualFile?,
private val javaFileManager: KotlinCliJavaFileManager
) {
val javaModuleGraph = JavaModuleGraph(javaModuleFinder)
private val searchScope = GlobalSearchScope.allScope(psiManager.project)
data class RootsAndModules(val roots: List<JavaRoot>, val modules: List<JavaModule>)
private data class RootWithPrefix(val root: VirtualFile, val packagePrefix: String?)
@@ -160,7 +165,7 @@ class ClasspathRootsResolver(
}
if (moduleInfoFile != null) {
val moduleInfo = JavaModuleInfo.read(moduleInfoFile) ?: return null
val moduleInfo = JavaModuleInfo.read(moduleInfoFile, javaFileManager, searchScope) ?: return null
return JavaModule.Explicit(moduleInfo, listOf(JavaModule.Root(root, isBinary = true)), moduleInfoFile)
}

View File

@@ -37,7 +37,7 @@ class CliKotlinAsJavaSupport(
return findFacadeFilesInPackage(packageFqName, scope)
.groupBy { it.javaFileFacadeFqName }
.mapNotNull { (facadeClassFqName, _) ->
KtLightClassForFacade.createForFacade(psiManager, facadeClassFqName, scope)
KtLightClassForFacadeImpl.createForFacade(psiManager, facadeClassFqName, scope)
}
}
@@ -54,7 +54,7 @@ class CliKotlinAsJavaSupport(
.orEmpty()
override fun getFacadeClasses(facadeFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> {
return listOfNotNull(KtLightClassForFacade.createForFacade(psiManager, facadeFqName, scope))
return listOfNotNull(KtLightClassForFacadeImpl.createForFacade(psiManager, facadeFqName, scope))
}
override fun getScriptClasses(scriptFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> {

View File

@@ -35,6 +35,10 @@ class CliVirtualFileFinder(
override fun findVirtualFileWithHeader(classId: ClassId): VirtualFile? =
findBinaryClass(classId, classId.relativeClassName.asString().replace('.', '$') + ".class")
override fun findSourceOrBinaryVirtualFile(classId: ClassId) =
findBinaryClass(classId, classId.relativeClassName.asString().replace('.', '$') + ".class")
?: findSourceClass(classId, classId.relativeClassName.asString() + ".java")
override fun findMetadata(classId: ClassId): InputStream? {
assert(!classId.isNestedClass) { "Nested classes are not supported here: $classId" }
@@ -61,8 +65,11 @@ class CliVirtualFileFinder(
return findBinaryClass(classId, BuiltInSerializerProtocol.getBuiltInsFileName(packageFqName))?.inputStream
}
private fun findBinaryClass(classId: ClassId, fileName: String): VirtualFile? =
index.findClass(classId, acceptedRootTypes = JavaRoot.OnlyBinary) { dir, _ ->
private fun findClass(classId: ClassId, fileName: String, rootType: Set<JavaRoot.RootType>) =
index.findClass(classId, acceptedRootTypes = rootType) { dir, _ ->
dir.findChild(fileName)?.takeIf(VirtualFile::isValid)
}?.takeIf { it in scope }
private fun findBinaryClass(classId: ClassId, fileName: String) = findClass(classId, fileName, JavaRoot.OnlyBinary)
private fun findSourceClass(classId: ClassId, fileName: String) = findClass(classId, fileName, JavaRoot.OnlySource)
}

View File

@@ -82,7 +82,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
private val binaryCache: MutableMap<ClassId, JavaClass?> = THashMap()
private val signatureParsingComponent = BinaryClassSignatureParser()
fun findClass(classId: ClassId, searchScope: GlobalSearchScope): JavaClass? = findClass(JavaClassFinder.Request(classId), searchScope)
fun findClass(classId: ClassId, searchScope: GlobalSearchScope) = findClass(JavaClassFinder.Request(classId), searchScope)
override fun findClass(request: JavaClassFinder.Request, searchScope: GlobalSearchScope): JavaClass? {
val (classId, classFileContentFromRequest, outerClassFromRequest) = request

View File

@@ -190,11 +190,17 @@ class KotlinCoreEnvironment private constructor(
sourceFiles.sortBy { it.virtualFile.path }
val javaFileManager = ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl
val jdkHome = configuration.get(JVMConfigurationKeys.JDK_HOME)
val jrtFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.JRT_PROTOCOL)
val javaModuleFinder = CliJavaModuleFinder(jdkHome?.path?.let { path ->
jrtFileSystem?.findFileByPath(path + URLUtil.JAR_SEPARATOR)
})
val javaModuleFinder = CliJavaModuleFinder(
jdkHome?.path?.let { path ->
jrtFileSystem?.findFileByPath(path + URLUtil.JAR_SEPARATOR)
},
javaFileManager,
project
)
val outputDirectory =
configuration.get(JVMConfigurationKeys.MODULES)?.singleOrNull()?.getOutputDirectory()
@@ -207,7 +213,8 @@ class KotlinCoreEnvironment private constructor(
this::contentRootToVirtualFile,
javaModuleFinder,
!configuration.getBoolean(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE),
outputDirectory?.let(this::findLocalFile)
outputDirectory?.let(this::findLocalFile),
javaFileManager
)
val (initialRoots, javaModules) =
@@ -231,7 +238,7 @@ class KotlinCoreEnvironment private constructor(
updateClasspathFromRootsIndex(this)
}
(ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl).initialize(
javaFileManager.initialize(
rootsIndex,
packagePartProviders,
SingleJavaFileRootsIndex(singleJavaFileRoots),
@@ -240,7 +247,7 @@ class KotlinCoreEnvironment private constructor(
project.registerService(
JavaModuleResolver::class.java,
CliJavaModuleResolver(classpathRootsResolver.javaModuleGraph, javaModules, javaModuleFinder.systemModules.toList())
CliJavaModuleResolver(classpathRootsResolver.javaModuleGraph, javaModules, javaModuleFinder.systemModules.toList(), project)
)
val finderFactory = CliVirtualFileFinderFactory(rootsIndex)

View File

@@ -78,10 +78,7 @@ import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem
import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension
import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
import org.jetbrains.kotlin.config.APPEND_JAVA_SOURCE_ROOTS_HANDLER_KEY
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.extensions.*
import org.jetbrains.kotlin.extensions.internal.CandidateInterceptor
import org.jetbrains.kotlin.extensions.internal.TypeResolutionInterceptor
@@ -193,11 +190,16 @@ class KotlinCoreEnvironment private constructor(
sourceFiles.sortBy { it.virtualFile.path }
val javaFileManager = ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl
val jdkHome = configuration.get(JVMConfigurationKeys.JDK_HOME)
val jrtFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.JRT_PROTOCOL)
val javaModuleFinder = CliJavaModuleFinder(jdkHome?.path?.let { path ->
jrtFileSystem?.findFileByPath(path + URLUtil.JAR_SEPARATOR)
})
val javaModuleFinder = CliJavaModuleFinder(
jdkHome?.path?.let { path ->
jrtFileSystem?.findFileByPath(path + URLUtil.JAR_SEPARATOR)
},
javaFileManager
)
val outputDirectory =
configuration.get(JVMConfigurationKeys.MODULES)?.singleOrNull()?.getOutputDirectory()
@@ -210,7 +212,8 @@ class KotlinCoreEnvironment private constructor(
this::contentRootToVirtualFile,
javaModuleFinder,
!configuration.getBoolean(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE),
outputDirectory?.let(this::findLocalFile)
outputDirectory?.let(this::findLocalFile),
javaFileManager
)
val (initialRoots, javaModules) =
@@ -234,7 +237,7 @@ class KotlinCoreEnvironment private constructor(
updateClasspathFromRootsIndex(this)
}
(ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl).initialize(
javaFileManager.initialize(
rootsIndex,
packagePartProviders,
SingleJavaFileRootsIndex(singleJavaFileRoots),
@@ -243,7 +246,7 @@ class KotlinCoreEnvironment private constructor(
project.registerService(
JavaModuleResolver::class.java,
CliJavaModuleResolver(classpathRootsResolver.javaModuleGraph, javaModules, javaModuleFinder.systemModules.toList())
CliJavaModuleResolver(classpathRootsResolver.javaModuleGraph, javaModules, javaModuleFinder.systemModules.toList(), project)
)
val finderFactory = CliVirtualFileFinderFactory(rootsIndex)

View File

@@ -49,6 +49,9 @@ fun CompilerConfiguration.addJvmSdkRoots(files: List<File>) {
val CompilerConfiguration.jvmClasspathRoots: List<File>
get() = getList(CLIConfigurationKeys.CONTENT_ROOTS).filterIsInstance<JvmClasspathRoot>().map(JvmContentRoot::file)
val CompilerConfiguration.jvmModularRoots: List<File>
get() = getList(CLIConfigurationKeys.CONTENT_ROOTS).filterIsInstance<JvmModulePathRoot>().map(JvmContentRoot::file)
@JvmOverloads
fun CompilerConfiguration.addJavaSourceRoot(file: File, packagePrefix: String? = null) {
add(CLIConfigurationKeys.CONTENT_ROOTS, JavaSourceRoot(file, packagePrefix))

View File

@@ -45,6 +45,7 @@ data class JavaRoot(val file: VirtualFile, val type: RootType, val prefixFqName:
companion object RootTypes {
val OnlyBinary: Set<RootType> = EnumSet.of(RootType.BINARY)
val OnlySource: Set<RootType> = EnumSet.of(RootType.SOURCE)
val SourceAndBinary: Set<RootType> = EnumSet.of(RootType.BINARY, RootType.SOURCE)
}
}

View File

@@ -54,19 +54,20 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
}
}
if (arguments.stringConcat != null) {
val runtimeStringConcat = JvmStringConcat.fromString(arguments.stringConcat!!)
val stringConcat = arguments.stringConcat
if (stringConcat != null) {
val runtimeStringConcat = JvmStringConcat.fromString(stringConcat)
if (runtimeStringConcat != null) {
put(JVMConfigurationKeys.STRING_CONCAT, runtimeStringConcat)
if (jvmTarget.majorVersion < JvmTarget.JVM_9.majorVersion && runtimeStringConcat != JvmStringConcat.INLINE) {
messageCollector.report(
WARNING,
"`-Xstring-concat=${arguments.stringConcat}` does nothing with JVM target `${jvmTarget.description}`."
"`-Xstring-concat=$stringConcat` does nothing with JVM target `${jvmTarget.description}`."
)
}
} else {
messageCollector.report(
ERROR, "Unknown `-Xstring-concat` mode: ${arguments.stringConcat}\n" +
ERROR, "Unknown `-Xstring-concat` mode: $stringConcat\n" +
"Supported modes: ${JvmStringConcat.values().joinToString { it.description }}"
)
}

View File

@@ -16,16 +16,25 @@
package org.jetbrains.kotlin.cli.jvm.modules
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiJavaModule
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.resolve.jvm.KotlinCliJavaFileManager
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModule
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleFinder
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo
class CliJavaModuleFinder(jrtFileSystemRoot: VirtualFile?) : JavaModuleFinder {
class CliJavaModuleFinder(
jrtFileSystemRoot: VirtualFile?,
private val javaFileManager: KotlinCliJavaFileManager,
project: Project
) : JavaModuleFinder {
private val modulesRoot = jrtFileSystemRoot?.findChild("modules")
private val userModules = linkedMapOf<String, JavaModule>()
private val allScope = GlobalSearchScope.allScope(project)
fun addUserModule(module: JavaModule) {
userModules.putIfAbsent(module.name, module)
}
@@ -41,7 +50,7 @@ class CliJavaModuleFinder(jrtFileSystemRoot: VirtualFile?) : JavaModuleFinder {
private fun findSystemModule(moduleRoot: VirtualFile): JavaModule.Explicit? {
val file = moduleRoot.findChild(PsiJavaModule.MODULE_INFO_CLS_FILE) ?: return null
val moduleInfo = JavaModuleInfo.read(file) ?: return null
val moduleInfo = JavaModuleInfo.read(file, javaFileManager, allScope) ?: return null
return JavaModule.Explicit(moduleInfo, listOf(JavaModule.Root(moduleRoot, isBinary = true)), file)
}
}

View File

@@ -18,18 +18,24 @@ package org.jetbrains.kotlin.cli.jvm.modules
import com.intellij.ide.highlighter.JavaClassFileType
import com.intellij.ide.highlighter.JavaFileType
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.StandardFileSystems
import com.intellij.openapi.vfs.VfsUtilCore
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.load.java.structure.JavaAnnotation
import org.jetbrains.kotlin.load.kotlin.VirtualFileFinder
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModule
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleResolver
import java.util.concurrent.ConcurrentHashMap
class CliJavaModuleResolver(
private val moduleGraph: JavaModuleGraph,
private val userModules: List<JavaModule>,
private val systemModules: List<JavaModule.Explicit>
private val systemModules: List<JavaModule.Explicit>,
private val project: Project
) : JavaModuleResolver {
init {
assert(userModules.count(JavaModule::isSourceModule) <= 1) {
@@ -37,6 +43,14 @@ class CliJavaModuleResolver(
}
}
private val virtualFileFinder by lazy { VirtualFileFinder.getInstance(project) }
override fun getAnnotationsForModuleOwnerOfClass(classId: ClassId): List<JavaAnnotation>? {
val virtualFile = virtualFileFinder.findSourceOrBinaryVirtualFile(classId) ?: return null
return (findJavaModule(virtualFile) as? JavaModule.Explicit)?.moduleInfo?.annotations
}
private val sourceModule: JavaModule? = userModules.firstOrNull(JavaModule::isSourceModule)
private fun findJavaModule(file: VirtualFile): JavaModule? {
@@ -77,4 +91,8 @@ class CliJavaModuleResolver(
return null
}
companion object {
private const val MODULE_ANNOTATIONS_CACHE_SIZE = 10000
}
}

View File

@@ -101,7 +101,11 @@ object KotlinCompilerClient {
fun CompileService.leaseImpl(): CompileServiceSession? {
// the newJVMOptions could be checked here for additional parameters, if needed
registerClient(clientAliveFlagFile.absolutePath)
reportingTargets.report(DaemonReportCategory.DEBUG, "connected to the daemon")
val javaExecutablePath = compilerId.javaExecutable?.absolutePath ?: "'user jvm'"
reportingTargets.report(
DaemonReportCategory.DEBUG,
"connected to the daemon. Daemon is using following 'java' executable to run itself: $javaExecutablePath"
)
if (!leaseSession) return CompileServiceSession(this, CompileService.NO_SESSION)

View File

@@ -2789,6 +2789,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt");
}
@TestMetadata("symbolsAndDescriptors.kt")
public void testSymbolsAndDescriptors() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/symbolsAndDescriptors.kt");
}
@TestMetadata("transform.kt")
public void testTransform() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/transform.kt");

View File

@@ -1,5 +1,5 @@
public open class MethodWithFunctionTypes : R|kotlin/Any| {
public open fun foo(f: R|(kotlin/String?) -> kotlin/String|): R|kotlin/String.() -> kotlin/String?|
public open fun foo(f: R|(kotlin/String?) -> kotlin/String|): R|(kotlin/String.() -> kotlin/String?)?|
public constructor(): R|test/MethodWithFunctionTypes|

View File

@@ -1,8 +1,16 @@
public final fun test1(): R|suspend () -> kotlin/Unit|
public final fun test1N(): R|(suspend () -> kotlin/Unit)?|
public final fun test2(): R|suspend kotlin/Int.() -> kotlin/Int|
public final fun test2N(): R|(suspend kotlin/Int.() -> kotlin/Int)?|
public final fun test3(): R|kotlin/collections/List<kotlin/coroutines/SuspendFunction0<kotlin/Unit>>|
public final fun test3N(): R|kotlin/collections/List<kotlin/coroutines/SuspendFunction0<kotlin/Unit>?>|
public final fun test4(): R|suspend () -> kotlin/coroutines/SuspendFunction0<kotlin/Unit>|
public final fun test4N(): R|(suspend () -> kotlin/coroutines/SuspendFunction0<kotlin/Unit>?)?|

View File

@@ -10,7 +10,7 @@ FILE: A.kt
}
FILE: main.kt
public final fun test_1(): R|kotlin/Unit| {
lval a: R|ERROR CLASS: Unresolved name: A| = <Unresolved name: A>#()
lval a: <ERROR TYPE REF: Unresolved name: A> = <Unresolved name: A>#()
lval b: R|foo/A| = R|foo/A.A|()
lval c: R|foo/A| = <Unresolved name: A>#()
}

View File

@@ -1,5 +1,5 @@
FILE: safeCallOnTypeAlias.kt
public final typealias MyTypeAlias = R|() -> kotlin/String?|
public final typealias MyTypeAlias = R|(() -> kotlin/String?)?|
public final fun foo(x: R|MyTypeAlias|): R|kotlin/Unit| {
R|<local>/x|?.{ $subj$.R|kotlin/let|<R|() -> kotlin/String?|, R|kotlin/String?|>(<L> = let@fun <anonymous>(y: R|() -> kotlin/String?|): R|kotlin/String?| <inline=Inline, kind=EXACTLY_ONCE> {
^ R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/String?|>|()?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(<L> = let@fun <anonymous>(result: R|kotlin/String|): R|kotlin/String| <inline=Inline, kind=EXACTLY_ONCE> {

View File

@@ -18,7 +18,7 @@ FILE: cast.kt
}
public get(): R|(kotlin/String) -> kotlin/Boolean|
public final val hError: R|(ERROR CLASS: No type for parameter) -> kotlin/Boolean| = fun <anonymous>(_: R|ERROR CLASS: No type for parameter|): R|kotlin/Boolean| <inline=Unknown> {
public final val hError: R|(ERROR CLASS: No type for parameter) -> kotlin/Boolean| = fun <anonymous>(_: <ERROR TYPE REF: No type for parameter>): R|kotlin/Boolean| <inline=Unknown> {
^ Boolean(true)
}

View File

@@ -13,6 +13,6 @@ interface B
fun test_2(x: Any?) {
if (x is A && x is B) {
x is A
<!USELESS_IS_CHECK!>x is A<!>
}
}

View File

@@ -18,7 +18,7 @@ FILE: kt41982.kt
}
}
public final fun <Type : R|Base|, Base : R|DelegateProvider<Base>|> R|Type|.long(initializer: R|() -> kotlin/Long?| = Null(null)): R|Delegate<Type, kotlin/Long>| {
public final fun <Type : R|Base|, Base : R|DelegateProvider<Base>|> R|Type|.long(initializer: R|(() -> kotlin/Long?)?| = Null(null)): R|Delegate<Type, kotlin/Long>| {
^long Null(null)!!
}
public final class Test : R|DelegateProvider<kotlin/Any>| {

View File

@@ -25,7 +25,7 @@ FILE: instanceAccessBeforeSuperCall.kt
}
public constructor(x: R|kotlin/Int|): R|C| {
this<R|C|>(fun <anonymous>(): R|ERROR CLASS: Cannot access ''<this>'' before superclass constructor has been called| <inline=Unknown> {
this<R|C|>(fun <anonymous>(): <ERROR TYPE REF: Cannot access ''<this>'' before superclass constructor has been called> <inline=Unknown> {
lval a: R|kotlin/Int| = Int(10)
^ this@R|/C|
}
@@ -63,8 +63,8 @@ FILE: instanceAccessBeforeSuperCall.kt
}
public final fun test(f: R|F|): R|kotlin/Unit| {
}
public final val a: R|ERROR CLASS: 'this' is not defined in this context| = this#
public get(): R|ERROR CLASS: 'this' is not defined in this context|
public final val a: <ERROR TYPE REF: 'this' is not defined in this context> = this#
public get(): <ERROR TYPE REF: 'this' is not defined in this context>
public final class F : R|kotlin/Any| {
public constructor(a: R|kotlin/Int|, b: R|kotlin/Int|, closure: R|() -> kotlin/Unit|, instance: R|F?|): R|F| {
super<R|kotlin/Any|>()

View File

@@ -13,7 +13,7 @@ FILE: superIsNotAnExpression.kt
public final fun act(): R|kotlin/Unit| {
<Super cannot be a callee>#()
<Unresolved name: invoke>#()
<Super cannot be a callee>#(<L> = <Super cannot be a callee>@fun <anonymous>(): R|ERROR CLASS: Unresolved name: println| <inline=Unknown> {
<Super cannot be a callee>#(<L> = <Super cannot be a callee>@fun <anonymous>(): <ERROR TYPE REF: Unresolved name: println> <inline=Unknown> {
^ <Unresolved name: println>#(ERROR_EXPR(Incorrect character: 'weird'))
}
)

View File

@@ -22,10 +22,10 @@ FILE: typeArgumentsNotAllowed.kt
}
}
public final val a: R|ERROR CLASS: Unresolved name: MyClass| = Q|rest|.<Unresolved name: MyClass>#
public get(): R|ERROR CLASS: Unresolved name: MyClass|
public final val b: R|ERROR CLASS: Unresolved name: MyClass| = Q|rest/Best|.<Unresolved name: MyClass>#
public get(): R|ERROR CLASS: Unresolved name: MyClass|
public final val a: <ERROR TYPE REF: Unresolved name: MyClass> = Q|rest|.<Unresolved name: MyClass>#
public get(): <ERROR TYPE REF: Unresolved name: MyClass>
public final val b: <ERROR TYPE REF: Unresolved name: MyClass> = Q|rest/Best|.<Unresolved name: MyClass>#
public get(): <ERROR TYPE REF: Unresolved name: MyClass>
public final class B<E> : R|kotlin/Any| {
public constructor<E>(): R|rest/B<E>| {
super<R|kotlin/Any|>()

View File

@@ -22,7 +22,7 @@ FILE: upperBoundViolated.kt
lval b1: R|B<kotlin/Int>| = R|/B.B|<R|kotlin/Int|>()
lval b2: R|B<C>| = R|/B.B|<R|C|>()
lval b3: R|B<kotlin/Any?>| = R|/B.B|<R|kotlin/Any?|>()
lval b4: R|ERROR CLASS: Unresolved name: NumberPhile| = R|/B.B|<<ERROR TYPE REF: Symbol not found for UnexistingType>>().<Unresolved name: NL>#(ERROR_EXPR(No right operand)).<Unresolved name: Int>#(<Call has no callee>#()).<Unresolved name: NumberPhile>#(ERROR_EXPR(No right operand))
lval b4: <ERROR TYPE REF: Unresolved name: NumberPhile> = R|/B.B|<<ERROR TYPE REF: Symbol not found for UnexistingType>>().<Unresolved name: NL>#(ERROR_EXPR(No right operand)).<Unresolved name: Int>#(<Call has no callee>#()).<Unresolved name: NumberPhile>#(ERROR_EXPR(No right operand))
lval b5: R|B<B<ERROR CLASS: Symbol not found for UnexistingType>>| = R|/B.B|<R|B<ERROR CLASS: Symbol not found for UnexistingType>|>()
R|/fest|<R|kotlin/Boolean|>()
R|/fest|<R|C|>()
@@ -58,8 +58,8 @@ FILE: upperBoundViolated.kt
}
public final typealias NL<K> = R|NumColl<kotlin/collections/List<K>>|
public final val test7: R|ERROR CLASS: Unresolved name: NumberPhile| = R|/NumColl.NumColl|<R|kotlin/Int|>().<Unresolved name: NumberPhile>#(ERROR_EXPR(No right operand))
public get(): R|ERROR CLASS: Unresolved name: NumberPhile|
public final val test7: <ERROR TYPE REF: Unresolved name: NumberPhile> = R|/NumColl.NumColl|<R|kotlin/Int|>().<Unresolved name: NumberPhile>#(ERROR_EXPR(No right operand))
public get(): <ERROR TYPE REF: Unresolved name: NumberPhile>
public final val test8: R|NumColl<kotlin/collections/List<kotlin/String>>| = R|/NumColl.NumColl|<R|kotlin/String|>()
public get(): R|NumColl<kotlin/collections/List<kotlin/String>>|
public final class NumberPhile<T : R|kotlin/Number|> : R|kotlin/Any| {

View File

@@ -1,6 +1,6 @@
FILE: main.kt
public final fun test_1(e: R|JavaEnum|): R|kotlin/Unit| {
lval a: R|ERROR CLASS: Unresolved name: plus| = when (R|<local>/e|) {
lval a: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
==($subj$, Q|JavaEnum|.R|/JavaEnum.A|) -> {
Int(1)
}
@@ -9,7 +9,7 @@ FILE: main.kt
}
}
.<Unresolved name: plus>#(Int(0))
lval b: R|ERROR CLASS: Unresolved name: plus| = when (R|<local>/e|) {
lval b: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
==($subj$, Q|JavaEnum|.R|/JavaEnum.A|) -> {
Int(1)
}
@@ -44,7 +44,7 @@ FILE: main.kt
.R|kotlin/Int.plus|(Int(0))
}
public final fun test_2(e: R|JavaEnum?|): R|kotlin/Unit| {
lval a: R|ERROR CLASS: Unresolved name: plus| = when (R|<local>/e|) {
lval a: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
==($subj$, Q|JavaEnum|.R|/JavaEnum.A|) -> {
Int(1)
}

View File

@@ -77,7 +77,7 @@ FILE: exhaustiveness_sealedSubClass.kt
.R|kotlin/Int.plus|(Int(0))
}
public final fun test_2(e: R|A|): R|kotlin/Unit| {
lval a: R|ERROR CLASS: Unresolved name: plus| = when (R|<local>/e|) {
lval a: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
($subj$ is R|D|) -> {
Int(1)
}
@@ -86,7 +86,7 @@ FILE: exhaustiveness_sealedSubClass.kt
}
}
.<Unresolved name: plus>#(Int(0))
lval b: R|ERROR CLASS: Unresolved name: plus| = when (R|<local>/e|) {
lval b: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
($subj$ is R|B|) -> {
Int(1)
}
@@ -98,7 +98,7 @@ FILE: exhaustiveness_sealedSubClass.kt
}
}
.<Unresolved name: plus>#(Int(0))
lval c: R|ERROR CLASS: Unresolved name: plus| = when (R|<local>/e|) {
lval c: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
($subj$ is R|B|) -> {
Int(1)
}

View File

@@ -27,7 +27,7 @@ fun test_1(e: A) {
val d = when (e) {
is E -> 1
is A -> 2
<!USELESS_IS_CHECK!>is A<!> -> 2
}.plus(0)
}

View File

@@ -29,8 +29,8 @@ FILE: CallBasedInExpressionGenerator.kt
public final val codegen: R|org/jetbrains/kotlin/codegen/range/inExpression/ExpressionCodegen| = R|<local>/codegen|
public get(): R|org/jetbrains/kotlin/codegen/range/inExpression/ExpressionCodegen|
private final val resolvedCall: R|ERROR CLASS: Unresolved name: getResolvedCallWithAssert| = R|<local>/operatorReference|.<Unresolved name: getResolvedCallWithAssert>#(this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.codegen|.<Unresolved name: bindingContext>#)
private get(): R|ERROR CLASS: Unresolved name: getResolvedCallWithAssert|
private final val resolvedCall: <ERROR TYPE REF: Unresolved name: getResolvedCallWithAssert> = R|<local>/operatorReference|.<Unresolved name: getResolvedCallWithAssert>#(this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.codegen|.<Unresolved name: bindingContext>#)
private get(): <ERROR TYPE REF: Unresolved name: getResolvedCallWithAssert>
private final val isInverted: R|kotlin/Boolean| = ==(R|<local>/operatorReference|.<Unresolved name: getReferencedNameElementType>#(), <Unresolved name: KtTokens>#.<Unresolved name: NOT_IN>#)
private get(): R|kotlin/Boolean|
@@ -75,7 +75,7 @@ FILE: CallBasedInExpressionGenerator.kt
}
private final fun invokeFunction(v: R|org/jetbrains/kotlin/codegen/range/inExpression/InstructionAdapter|): R|kotlin/Unit| {
lval result: R|ERROR CLASS: Unresolved name: invokeFunction| = this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.codegen|.<Unresolved name: invokeFunction>#(this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|.<Unresolved name: call>#, this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|, <Unresolved name: none>#())
lval result: <ERROR TYPE REF: Unresolved name: invokeFunction> = this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.codegen|.<Unresolved name: invokeFunction>#(this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|.<Unresolved name: call>#, this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|, <Unresolved name: none>#())
R|<local>/result|.<Unresolved name: put>#(R|<local>/result|.<Unresolved name: type>#, R|<local>/result|.<Unresolved name: kotlinType>#, R|<local>/v|)
}

View File

@@ -57,7 +57,7 @@ FILE: access.kt
lval a: R|kotlin/Int| = Int(10)
lval b: R|kotlin/Int| = R|<local>/a|
lval d: R|kotlin/String| = String()
lval c: R|ERROR CLASS: Unresolved name: c| = <Unresolved name: c>#
lval c: <ERROR TYPE REF: Unresolved name: c> = <Unresolved name: c>#
<Unresolved name: abc>#()
local final fun bcd(): R|kotlin/Unit| {
}

View File

@@ -29,7 +29,7 @@ FILE: Test.kt
lval bbd: R|BB.D| = Q|BB.D|
lval aac: R|AA.C| = Q|AA.C|
Q|JavaClass|.R|/JavaClass.bar|()
lval errC: R|ERROR CLASS: Unresolved name: C| = Q|BB|.<Unresolved name: C>#
lval errBarViaBB: R|ERROR CLASS: Unresolved name: bar| = Q|BB|.<Unresolved name: bar>#()
lval errBarViaAA: R|ERROR CLASS: Unresolved name: bar| = Q|AA|.<Unresolved name: bar>#()
lval errC: <ERROR TYPE REF: Unresolved name: C> = Q|BB|.<Unresolved name: C>#
lval errBarViaBB: <ERROR TYPE REF: Unresolved name: bar> = Q|BB|.<Unresolved name: bar>#()
lval errBarViaAA: <ERROR TYPE REF: Unresolved name: bar> = Q|AA|.<Unresolved name: bar>#()
}

View File

@@ -4,7 +4,7 @@ class Factory {
}
companion object {
val f = Function
val f = <!NO_COMPANION_OBJECT!>Function<!>
val x = Function.Default
}
}

View File

@@ -47,5 +47,5 @@ FILE: companion.kt
Q|B|.R|/B.Companion.baz|()
lval x: R|kotlin/String| = Q|A|.R|/A.Companion.D|
lval y: R|kotlin/String| = Q|B|.R|/B.Companion.C|
lval z: R|ERROR CLASS: Unresolved name: D| = Q|B|.<Unresolved name: D>#
lval z: <ERROR TYPE REF: Unresolved name: D> = Q|B|.<Unresolved name: D>#
}

View File

@@ -18,10 +18,10 @@ FILE: errCallable.kt
}
public final fun foo(): R|kotlin/Unit| {
lval x: R|ERROR CLASS: Unresolved reference: Nested| = ::<Unresolved reference: Nested>#
lval x: <ERROR TYPE REF: Unresolved reference: Nested> = ::<Unresolved reference: Nested>#
}
}
public final fun R|Your|.foo(): R|kotlin/Unit| {
lval x: R|ERROR CLASS: Unresolved reference: Nested| = ::<Unresolved reference: Nested>#
lval x: <ERROR TYPE REF: Unresolved reference: Nested> = ::<Unresolved reference: Nested>#
}

View File

@@ -2,5 +2,5 @@ class Outer {
inner class Inner
}
val x = Outer.Inner
val x = Outer.<!NO_COMPANION_OBJECT!>Inner<!>
val klass = Outer.Inner::class

View File

@@ -1,11 +1,11 @@
FILE: propertyWithExtensionType.kt
public final class A : R|kotlin/Any| {
public constructor(x: R|kotlin/String.() -> kotlin/Unit|, y: R|kotlin/String.() -> kotlin/Int|): R|A| {
public constructor(x: R|(kotlin/String.() -> kotlin/Unit)?|, y: R|kotlin/String.() -> kotlin/Int|): R|A| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/String.() -> kotlin/Unit| = R|<local>/x|
public get(): R|kotlin/String.() -> kotlin/Unit|
public final val x: R|(kotlin/String.() -> kotlin/Unit)?| = R|<local>/x|
public get(): R|(kotlin/String.() -> kotlin/Unit)?|
public final val y: R|kotlin/String.() -> kotlin/Int| = R|<local>/y|
public get(): R|kotlin/String.() -> kotlin/Int|
@@ -14,7 +14,7 @@ FILE: propertyWithExtensionType.kt
public final fun test(a: R|A|): R|kotlin/Unit| {
when () {
!=(R|<local>/a|.R|/A.x|, Null(null)) -> {
lval b: R|kotlin/String.() -> kotlin/Unit| = R|<local>/a|.R|/A.x|
lval b: R|(kotlin/String.() -> kotlin/Unit)?| = R|<local>/a|.R|/A.x|
R|<local>/b|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(String())
}
}

View File

@@ -40,5 +40,5 @@ FILE: localObjects.kt
Q|B|.R|/B.foo|()
}
public final val bb: R|ERROR CLASS: Unresolved name: foo| = <Unresolved name: B>#.<Unresolved name: foo>#()
public get(): R|ERROR CLASS: Unresolved name: foo|
public final val bb: <ERROR TYPE REF: Unresolved name: foo> = <Unresolved name: B>#.<Unresolved name: foo>#()
public get(): <ERROR TYPE REF: Unresolved name: foo>

View File

@@ -25,7 +25,7 @@ FILE: nestedObjects.kt
}
}
public final val err: R|ERROR CLASS: Unresolved name: B| = Q|B|.<Unresolved name: A>#.<Unresolved name: B>#
public get(): R|ERROR CLASS: Unresolved name: B|
public final val err: <ERROR TYPE REF: Unresolved name: B> = Q|B|.<Unresolved name: A>#.<Unresolved name: B>#
public get(): <ERROR TYPE REF: Unresolved name: B>
public final val correct: R|A.B.A| = Q|A.B.A|
public get(): R|A.B.A|

View File

@@ -33,7 +33,7 @@ FILE: privateObjectLiteral.kt
internal get(): R|kotlin/Any|
public final val w: R|ERROR CLASS: Unresolved name: foo| = this@R|/C|.R|/C.z|.<Unresolved name: foo>#()
public get(): R|ERROR CLASS: Unresolved name: foo|
public final val w: <ERROR TYPE REF: Unresolved name: foo> = this@R|/C|.R|/C.z|.<Unresolved name: foo>#()
public get(): <ERROR TYPE REF: Unresolved name: foo>
}

View File

@@ -23,7 +23,8 @@ object D {
val D.E get() = ""
val def = D.E.F // object
val de = D.E // extension
// See KT-46409
val de = D.<!NO_COMPANION_OBJECT!>E<!> // Should be: extension & no error, in fact: qualifier
enum class G {
H;

View File

@@ -1,6 +1,6 @@
fun foo() = if (true) 1 else 0
fun bar(arg: Any?) = when (arg) {
is Int -> arg as Int
is Int -> arg <!USELESS_CAST!>as Int<!>
else -> 42
}

View File

@@ -5,7 +5,7 @@ interface I {
}
class A {
fun too(): <!NOT_AN_ANNOTATION_CLASS, NOT_AN_ANNOTATION_CLASS!>@Annotation<!> Unit {}
fun too(): <!NOT_AN_ANNOTATION_CLASS!>@Annotation<!> Unit {}
fun foo(): <!REDUNDANT_RETURN_UNIT_TYPE!>Unit<!>
{

View File

@@ -8,8 +8,8 @@ FILE: kt41989.kt
}
public abstract interface C : R|B| {
public open val lineCellStyle: R|A.() -> kotlin/Unit|
public get(): R|A.() -> kotlin/Unit| {
public open val lineCellStyle: R|(A.() -> kotlin/Unit)?|
public get(): R|(A.() -> kotlin/Unit)?| {
^ when () {
R|/cond|() -> {
fun R|A|.<anonymous>(): R|kotlin/Unit| <inline=Unknown> {

View File

@@ -41,7 +41,7 @@ FILE: inner.kt
public final fun test(): R|kotlin/Unit| {
lval o: R|Owner| = R|/Owner.Owner|()
R|<local>/o|.R|/Owner.foo|()
lval err: R|ERROR CLASS: Unresolved name: Inner| = Q|Owner|.<Unresolved name: Inner>#()
lval err: <ERROR TYPE REF: Unresolved name: Inner> = Q|Owner|.<Unresolved name: Inner>#()
R|<local>/err|.<Unresolved name: baz>#()
lval i: R|Owner.Inner| = R|<local>/o|.R|/Owner.Inner.Inner|()
R|<local>/i|.R|/Owner.Inner.gau|()

View File

@@ -21,14 +21,14 @@ FILE: lambdaArgInScopeFunction.kt
this@R|special/anonymous|.R|/_|<R|KotlinClass?|>()
}
)
lval lambda: R|() -> KotlinClass| = R|<local>/kotlinClass|?.{ $subj$.R|kotlin/let|<R|KotlinClass|, R|() -> KotlinClass|>(<L> = let@fun <anonymous>(it: R|KotlinClass|): R|() -> KotlinClass| <inline=Inline, kind=EXACTLY_ONCE> {
lval lambda: R|(() -> KotlinClass)?| = R|<local>/kotlinClass|?.{ $subj$.R|kotlin/let|<R|KotlinClass|, R|() -> KotlinClass|>(<L> = let@fun <anonymous>(it: R|KotlinClass|): R|() -> KotlinClass| <inline=Inline, kind=EXACTLY_ONCE> {
^ let@fun <anonymous>(): R|KotlinClass| <inline=Unknown> {
^ R|<local>/it|
}
}
) }
R|<local>/lambda|.R|/checkType|<R|() -> KotlinClass|>(<L> = checkType@fun R|CheckTypeInv<kotlin/Function0<KotlinClass>?>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
R|<local>/lambda|.R|/checkType|<R|(() -> KotlinClass)?|>(<L> = checkType@fun R|CheckTypeInv<kotlin/Function0<KotlinClass>?>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
this@R|special/anonymous|.<Inapplicable(INAPPLICABLE_WRONG_RECEIVER): /_>#<R|(kotlin/Unit) -> KotlinClass?|>()
}
)

View File

@@ -32,7 +32,7 @@ fun case1(javaClass: JavaClass?) {
}
class Case1(val javaClass: JavaClass?) {
val x = if (javaClass != null) { it -> it == javaClass } else BooCase2.FILTER
val x = if (javaClass != null) { it -> <!EQUALITY_NOT_APPLICABLE_WARNING!>it == javaClass<!> } else BooCase2.FILTER
}
class BooCase1() {

View File

@@ -35,7 +35,7 @@ FILE: nestedClassContructor.kt
public final fun foo(): R|kotlin/Unit| {
lval a: R|A| = R|/A.A|()
lval ac: R|A.C| = Q|A|.R|/A.C.C|()
lval c: R|ERROR CLASS: Unresolved name: C| = <Unresolved name: C>#()
lval c: <ERROR TYPE REF: Unresolved name: C> = <Unresolved name: C>#()
}
}

View File

@@ -26,7 +26,7 @@ FILE: test.kt
public final fun test(): R|kotlin/Unit| {
lval descriptor: R|WrappedPropertyDescriptor| = R|/WrappedPropertyDescriptor.WrappedPropertyDescriptor|()
lval res1: R|kotlin/String| = R|<local>/descriptor|.R|/WrappedPropertyDescriptor.setter|
lval res2: R|ERROR CLASS: Unresolved name: getSetter| = R|<local>/descriptor|.<Unresolved name: getSetter>#()
lval res2: <ERROR TYPE REF: Unresolved name: getSetter> = R|<local>/descriptor|.<Unresolved name: getSetter>#()
lval res3: R|kotlin/Boolean| = R|<local>/descriptor|.R|/WrappedPropertyDescriptor.isDelegated|
lval res4: R|ERROR CLASS: Unresolved name: isDelegated| = R|<local>/descriptor|.<Unresolved name: isDelegated>#()
lval res4: <ERROR TYPE REF: Unresolved name: isDelegated> = R|<local>/descriptor|.<Unresolved name: isDelegated>#()
}

View File

@@ -1,5 +1,5 @@
FILE: main.kt
public final fun test(): R|kotlin/Unit| {
lval some: R|foo/Some| = R|foo/Some.Some|()
lval another: R|ERROR CLASS: Unresolved name: Another| = <Unresolved name: Another>#()
lval another: <ERROR TYPE REF: Unresolved name: Another> = <Unresolved name: Another>#()
}

View File

@@ -1,3 +1,4 @@
// FIR_IDE_IGNORE
// FILE: foo/Some.java
package foo;

View File

@@ -0,0 +1,46 @@
FILE: symbolsAndDescriptors.kt
public final class IrClassSymbolImpl : R|IrBindableSymbolBase<kotlin/String>|, R|IrClassSymbol| {
public constructor(descriptor: R|kotlin/String?| = Null(null)): R|IrClassSymbolImpl| {
super<R|IrBindableSymbolBase<kotlin/String>|>(R|<local>/descriptor|)
}
}
public abstract interface IrClassSymbol : R|IrClassifierSymbol|, R|IrBindableSymbol<kotlin/String>| {
}
public abstract interface IrClassifierSymbol : R|IrSymbol|, R|TypeConstructorMarker| {
public abstract override val descriptor: R|kotlin/CharSequence|
public get(): R|kotlin/CharSequence|
}
public abstract interface IrSymbol : R|kotlin/Any| {
public abstract val descriptor: R|kotlin/Any|
public get(): R|kotlin/Any|
}
public abstract interface TypeConstructorMarker : R|kotlin/Any| {
}
public abstract interface IrBindableSymbol<out D : R|kotlin/Any|> : R|IrSymbol| {
public abstract override val descriptor: R|D|
public get(): R|D|
}
public abstract class IrBindableSymbolBase<out D : R|kotlin/Any|> : R|IrBindableSymbol<D>|, R|IrSymbolBase<D>| {
public constructor<out D : R|kotlin/Any|>(descriptor: R|D?|): R|IrBindableSymbolBase<D>| {
super<R|IrSymbolBase<D>|>(R|<local>/descriptor|)
}
}
public abstract class IrSymbolBase<out D : R|kotlin/Any|> : R|IrSymbol| {
public constructor<out D : R|kotlin/Any|>(_descriptor: R|D?|): R|IrSymbolBase<D>| {
super<R|kotlin/Any|>()
}
private final val _descriptor: R|D?| = R|<local>/_descriptor|
private get(): R|D?|
public open override val descriptor: R|D|
public get(): R|D| {
^ this@R|/IrSymbolBase|.R|/IrSymbolBase._descriptor|!!
}
}

View File

@@ -0,0 +1,33 @@
class IrClassSymbolImpl(descriptor: String? = null) :
IrBindableSymbolBase<String>(descriptor),
IrClassSymbol
interface IrClassSymbol : IrClassifierSymbol, IrBindableSymbol<String>
interface IrClassifierSymbol : IrSymbol, TypeConstructorMarker {
override val descriptor: CharSequence
}
interface IrSymbol {
val descriptor: Any
}
interface TypeConstructorMarker
interface IrBindableSymbol<out D : Any> : IrSymbol {
override val descriptor: D
}
abstract class IrBindableSymbolBase<out D : Any>(descriptor: D?) :
IrBindableSymbol<D>, IrSymbolBase<D>(descriptor)
abstract class IrSymbolBase<out D : Any>(
private val _descriptor: D?
) : IrSymbol {
override val descriptor: D
get() = _descriptor!!
}

View File

@@ -1,15 +1,15 @@
FILE: main.kt
public final fun test_1(x: R|A|): R|kotlin/Unit| {
lval str1: R|ft<kotlin/String, kotlin/String?>| = R|<local>/x|.R|/A.vmParameters|
lval str2: R|ERROR CLASS: Unresolved name: vMParameters| = R|<local>/x|.<Unresolved name: vMParameters>#
lval str2: <ERROR TYPE REF: Unresolved name: vMParameters> = R|<local>/x|.<Unresolved name: vMParameters>#
}
public final fun test_2(x: R|B|): R|kotlin/Unit| {
lval int: R|ft<kotlin/Int, kotlin/Int?>| = R|<local>/x|.R|/B.vmParameters|
lval error: R|ERROR CLASS: Unresolved name: vMParameters| = R|<local>/x|.<Unresolved name: vMParameters>#
lval error: <ERROR TYPE REF: Unresolved name: vMParameters> = R|<local>/x|.<Unresolved name: vMParameters>#
}
public final fun test_3(x: R|C|): R|kotlin/Unit| {
lval error: R|ERROR CLASS: Ambiguity: vmParameters, [/C.vmParameters, /C.vmParameters]| = R|<local>/x|.<Ambiguity: vmParameters, [/C.vmParameters, /C.vmParameters]>#
lval int: R|ERROR CLASS: Unresolved name: vMParameters| = R|<local>/x|.<Unresolved name: vMParameters>#
lval error: <ERROR TYPE REF: Ambiguity: vmParameters, [/C.vmParameters, /C.vmParameters]> = R|<local>/x|.<Ambiguity: vmParameters, [/C.vmParameters, /C.vmParameters]>#
lval int: <ERROR TYPE REF: Unresolved name: vMParameters> = R|<local>/x|.<Unresolved name: vMParameters>#
}
public final class Foo : R|kotlin/Any| {
public constructor(): R|Foo| {

View File

@@ -7,7 +7,7 @@ FILE: leakedImplicitType.kt
public final fun bar(): R|kotlin/Unit| {
}
public final fun f(): R|ERROR CLASS: Unresolved reference: bar| {
public final fun f(): <ERROR TYPE REF: Unresolved reference: bar> {
^f <Unresolved name: Unresolved>#()::<Unresolved reference: bar>#
}

View File

@@ -40,8 +40,8 @@ FILE: referenceToExtension.kt
}
public final fun test_2(): R|kotlin/Unit| {
lval extensionValRef: R|ERROR CLASS: Unresolved reference: extensionVal| = Q|GenericTest.B|::<Unresolved reference: extensionVal>#
lval extensionFunRef: R|ERROR CLASS: Unresolved reference: extensionFun| = Q|GenericTest.B|::<Unresolved reference: extensionFun>#
lval extensionValRef: <ERROR TYPE REF: Unresolved reference: extensionVal> = Q|GenericTest.B|::<Unresolved reference: extensionVal>#
lval extensionFunRef: <ERROR TYPE REF: Unresolved reference: extensionFun> = Q|GenericTest.B|::<Unresolved reference: extensionFun>#
}
}

View File

@@ -1,5 +1,5 @@
FILE: smartcastOnLambda.kt
public final fun test(func: R|() -> kotlin/Unit|): R|kotlin/Unit| {
public final fun test(func: R|(() -> kotlin/Unit)?|): R|kotlin/Unit| {
when () {
!=(R|<local>/func|, Null(null)) -> {
R|<local>/func|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()

View File

@@ -3,7 +3,7 @@ class Some
fun foo(): () -> Boolean {
val s = Some()
if (true) {
return { if (s is Some) true else false }
return { if (<!USELESS_IS_CHECK!>s is Some<!>) true else false }
} else {
return { true }
}

View File

@@ -45,12 +45,12 @@ fun case3() {
val flag = "" //A
val l1 = <!NO_ELSE_IN_WHEN!>when<!> (flag<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>) {// should be NO_ELSE_IN_WHEN
A.A1 -> B() //should be INCOMPATIBLE_TYPES
A.A2 -> B() //should be INCOMPATIBLE_TYPES
<!INCOMPATIBLE_TYPES!>A.A1<!> -> B() //should be INCOMPATIBLE_TYPES
<!INCOMPATIBLE_TYPES!>A.A2<!> -> B() //should be INCOMPATIBLE_TYPES
}
val l2 = <!NO_ELSE_IN_WHEN!>when<!> (flag) {// should be NO_ELSE_IN_WHEN
A.A1 -> B() //should be INCOMPATIBLE_TYPES
A.A2 -> B() //should be INCOMPATIBLE_TYPES
<!INCOMPATIBLE_TYPES!>A.A1<!> -> B() //should be INCOMPATIBLE_TYPES
<!INCOMPATIBLE_TYPES!>A.A2<!> -> B() //should be INCOMPATIBLE_TYPES
}
}

View File

@@ -13,7 +13,7 @@ FILE: beyoundCalls.kt
}
public final fun foo(): R|kotlin/Unit| {
lval x: R|(kotlin/String) -> kotlin/Int| = ::R|/bar|
lval y: R|ERROR CLASS: Ambiguity: bar, [/bar, /bar]| = ::<Ambiguity: bar, [/bar, /bar]>#
lval y: <ERROR TYPE REF: Ambiguity: bar, [/bar, /bar]> = ::<Ambiguity: bar, [/bar, /bar]>#
lval z: R|kotlin/reflect/KFunction1<kotlin/String, kotlin/Int>| = ::R|/baz|
lval w: R|(kotlin/String) -> kotlin/Int| = ::R|/foobaz<kotlin/String, kotlin/Int>|
::R|/baz|

View File

@@ -9,7 +9,7 @@ FILE: moreSpecificAmbiguousExtensions.kt
}
public final fun test(): R|kotlin/Unit| {
lval extFun1: R|@ExtensionFunctionType kotlin/reflect/KFunction2<IA, IB, kotlin/Unit>| = Q|IA|::R|/extFun|
lval extFun2: R|ERROR CLASS: Ambiguity: extFun, [/extFun, /extFun]| = Q|IB|::<Ambiguity: extFun, [/extFun, /extFun]>#
lval extFun2: <ERROR TYPE REF: Ambiguity: extFun, [/extFun, /extFun]> = Q|IB|::<Ambiguity: extFun, [/extFun, /extFun]>#
}
public final fun testWithExpectedType(): R|kotlin/Unit| {
lval extFun_AB_A: R|IA.(IB) -> kotlin/Unit| = Q|IA|::R|/extFun|

View File

@@ -172,9 +172,9 @@ FILE: forLoopChecker.kt
}
public final fun test(notRange1: R|NotRange1|, notRange2: R|NotRange2|, notRange3: R|NotRange3|, notRange4: R|NotRange4|, notRange5: R|NotRange5|, notRange6: R|NotRange6|, notRange7: R|NotRange7|, notRange8: R|NotRange8|, notRange9: R|NotRange9|, range0: R|Range0|, range1: R|Range1|): R|kotlin/Unit| {
{
lval <iterator>: R|ERROR CLASS: Unresolved name: iterator| = R|<local>/notRange1|.<Unresolved name: iterator>#()
lval <iterator>: <ERROR TYPE REF: Unresolved name: iterator> = R|<local>/notRange1|.<Unresolved name: iterator>#()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|ERROR CLASS: Unresolved name: next| = R|<local>/<iterator>|.<Unresolved name: next>#()
lval i: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#()
}
}
@@ -182,7 +182,7 @@ FILE: forLoopChecker.kt
{
lval <iterator>: R|kotlin/Unit| = R|<local>/notRange2|.R|/NotRange2.iterator|()
while(R|<local>/<iterator>|.<Unresolved name: hasNext>#()) {
lval i: R|ERROR CLASS: Unresolved name: next| = R|<local>/<iterator>|.<Unresolved name: next>#()
lval i: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#()
}
}
@@ -190,7 +190,7 @@ FILE: forLoopChecker.kt
{
lval <iterator>: R|ImproperIterator1| = R|<local>/notRange3|.R|/NotRange3.iterator|()
while(R|<local>/<iterator>|.R|/ImproperIterator1.hasNext|()) {
lval i: R|ERROR CLASS: Unresolved name: next| = R|<local>/<iterator>|.<Unresolved name: next>#()
lval i: <ERROR TYPE REF: Unresolved name: next> = R|<local>/<iterator>|.<Unresolved name: next>#()
}
}

View File

@@ -1,3 +1,4 @@
// FIR_IDE_IGNORE
// FILE: K1.kt
class KSub : J1()

View File

@@ -7,8 +7,8 @@ FILE: test.kt
super<R|kotlin/Any|>()
}
private final val klass: R|java/lang/Class<MyTest>| = <getClass>(this@R|/MyTest|).R|kotlin/jvm/java|<R|MyTest|>
private get(): R|java/lang/Class<MyTest>|
private final val klass: R|java/lang/Class<out MyTest>| = <getClass>(this@R|/MyTest|).R|kotlin/jvm/java|<R|MyTest|>
private get(): R|java/lang/Class<out MyTest>|
private final val logger: R|ft<Logger, Logger?>| = Q|Logger|.R|/Logger.getInstance|(this@R|/MyTest|.R|/MyTest.klass|)
private get(): R|ft<Logger, Logger?>|

View File

@@ -1,3 +1,4 @@
// FIR_IDE_IGNORE
// FILE: K1.kt
class K2: J1() {
class Q : <!UNRESOLVED_REFERENCE!>Nested<!>()

View File

@@ -0,0 +1,30 @@
FILE: capturedTypeInEquality.kt
public abstract interface FirTargetElement : R|kotlin/Any| {
}
public abstract interface FirFunction<F : R|FirFunction<F>|> : R|FirTargetElement| {
}
public abstract interface FirPropertyAccessor : R|FirFunction<FirPropertyAccessor>| {
}
public abstract interface FirProperty : R|kotlin/Any| {
public abstract val getter: R|FirPropertyAccessor|
public get(): R|FirPropertyAccessor|
}
public abstract interface FirTarget<E : R|FirTargetElement|> : R|kotlin/Any| {
public abstract val labeledElement: R|E|
public get(): R|E|
}
public final fun foo(target: R|FirTarget<FirFunction<*>>|, property: R|FirProperty|): R|kotlin/Unit| {
lval functionTarget: R|FirFunction<*>| = R|<local>/target|.R|SubstitutionOverride</FirTarget.labeledElement: R|FirFunction<*>|>|
lval x: R|kotlin/Int?| = (R|<local>/functionTarget| as? R|FirFunction<CapturedType(*)>|)?.{ $subj$.R|kotlin/let|<R|FirFunction<*>|, R|kotlin/Int|>(<L> = let@fun <anonymous>(it: R|FirFunction<*>|): R|kotlin/Int| <inline=Inline, kind=EXACTLY_ONCE> {
when () {
===(R|<local>/property|.R|/FirProperty.getter|, R|<local>/functionTarget|) -> {
^@let Int(1)
}
}
^ Int(0)
}
) }
}

View File

@@ -0,0 +1,23 @@
interface FirTargetElement
interface FirFunction<F : FirFunction<F>> : FirTargetElement
interface FirPropertyAccessor : FirFunction<FirPropertyAccessor>
interface FirProperty {
val getter: FirPropertyAccessor
}
interface FirTarget<E : FirTargetElement> {
val labeledElement: E
}
fun foo(target: FirTarget<FirFunction<*>>, property: FirProperty) {
val functionTarget = target.labeledElement
val x = (functionTarget as? FirFunction)?.let {
if (<!EQUALITY_NOT_APPLICABLE_WARNING!>property.getter === functionTarget<!>) {
return@let 1
}
0
}
}

View File

@@ -14,7 +14,7 @@ class Case1() {
this.yield("") //UNRESOLVED_REFERENCE
this as SequenceScope<String>
this <!USELESS_CAST!>as SequenceScope<String><!>
yield("") // resolved to SequenceScope.yield
@@ -31,10 +31,10 @@ fun case2() {
this.yield("") //UNRESOLVED_REFERENCE
this as SequenceScope<String>
this <!USELESS_CAST!>as SequenceScope<String><!>
yield("") // UNRESOLVED_REFERENCE
this.yield("") // UNRESOLVED_REFERENCE
}
}
}

View File

@@ -3159,6 +3159,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt");
}
@Test
@TestMetadata("symbolsAndDescriptors.kt")
public void testSymbolsAndDescriptors() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/symbolsAndDescriptors.kt");
}
@Test
@TestMetadata("transform.kt")
public void testTransform() throws Exception {
@@ -5287,6 +5293,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@Test
@TestMetadata("capturedTypeInEquality.kt")
public void testCapturedTypeInEquality() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/capturedTypeInEquality.kt");
}
@Test
@TestMetadata("DeepCopyIrTree.kt")
public void testDeepCopyIrTree() throws Exception {

View File

@@ -3159,6 +3159,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt");
}
@Test
@TestMetadata("symbolsAndDescriptors.kt")
public void testSymbolsAndDescriptors() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/problems/symbolsAndDescriptors.kt");
}
@Test
@TestMetadata("transform.kt")
public void testTransform() throws Exception {
@@ -5287,6 +5293,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@Test
@TestMetadata("capturedTypeInEquality.kt")
public void testCapturedTypeInEquality() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/capturedTypeInEquality.kt");
}
@Test
@TestMetadata("DeepCopyIrTree.kt")
public void testDeepCopyIrTree() throws Exception {

View File

@@ -620,6 +620,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/RecursiveTypeInference.kt");
}
@Test
@TestMetadata("RecursiveTypeParameterEqualityCheck.kt")
public void testRecursiveTypeParameterEqualityCheck() throws Exception {
runTest("compiler/testData/diagnostics/tests/RecursiveTypeParameterEqualityCheck.kt");
}
@Test
@TestMetadata("ReserveYield.kt")
public void testReserveYield() throws Exception {
@@ -5680,6 +5686,136 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/coroutines/callableReference/outsideSuspend.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype")
@TestDataPath("$PROJECT_ROOT")
public class SuspendFunctionAsSupertype {
@Test
public void testAllFilesPresentInSuspendFunctionAsSupertype() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN")
@TestDataPath("$PROJECT_ROOT")
public class KSuspendFunctionN {
@Test
public void testAllFilesPresentInKSuspendFunctionN() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypes.kt")
public void testMixingSuspendAndNonSuspendSupertypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/mixingSuspendAndNonSuspendSupertypes.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperFunInterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperinterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/simple.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple")
@TestDataPath("$PROJECT_ROOT")
public class Simple {
@Test
public void testAllFilesPresentInSimple() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypes.kt")
public void testMixingSuspendAndNonSuspendSupertypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/mixingSuspendAndNonSuspendSupertypes.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperFunInterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperinterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/simple.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN")
@TestDataPath("$PROJECT_ROOT")
public class SuspendFunctionN {
@Test
public void testAllFilesPresentInSuspendFunctionN() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypes.kt")
public void testMixingSuspendAndNonSuspendSupertypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/mixingSuspendAndNonSuspendSupertypes.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperFunInterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperinterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/simple.kt");
}
}
}
}
@Nested
@@ -8941,6 +9077,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/enum/starImportNestedClassAndEntries.kt");
}
@Test
@TestMetadata("typeCompatibility.kt")
public void testTypeCompatibility() throws Exception {
runTest("compiler/testData/diagnostics/tests/enum/typeCompatibility.kt");
}
@Test
@TestMetadata("typeParametersInEnum.kt")
public void testTypeParametersInEnum() throws Exception {
@@ -12457,6 +12599,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/inference/violatingUpperBoundForSelfType.kt");
}
@Test
@TestMetadata("violatingUpperBoundForSelfTypeError.kt")
public void testViolatingUpperBoundForSelfTypeError() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/violatingUpperBoundForSelfTypeError.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/inference/builderInference")
@TestDataPath("$PROJECT_ROOT")
@@ -16710,6 +16858,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/java8Overrides/abstractBaseClassMemberNotImplemented.kt");
}
@Test
@TestMetadata("abstractBaseClassMemberNotImplemented_15.kt")
public void testAbstractBaseClassMemberNotImplemented_15() throws Exception {
runTest("compiler/testData/diagnostics/tests/java8Overrides/abstractBaseClassMemberNotImplemented_15.kt");
}
@Test
@TestMetadata("abstractVsAbstract.kt")
public void testAbstractVsAbstract() throws Exception {
@@ -16739,6 +16893,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/java8Overrides/implementingMethodOfAny.kt");
}
@Test
@TestMetadata("kt45508.kt")
public void testKt45508() throws Exception {
runTest("compiler/testData/diagnostics/tests/java8Overrides/kt45508.kt");
}
@Test
@TestMetadata("notAMethodOfAny.kt")
public void testNotAMethodOfAny() throws Exception {
@@ -21000,6 +21160,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt");
}
@Test
@TestMetadata("dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.kt")
public void testDontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.kt");
}
@Test
@TestMetadata("dontSubstituteAnotherErasedTypeArgumentIfRecursive.kt")
public void testDontSubstituteAnotherErasedTypeArgumentIfRecursive() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.kt");
}
@Test
@TestMetadata("errorType.kt")
public void testErrorType() throws Exception {
@@ -21090,6 +21262,30 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/starProjectionToRaw.kt");
}
@Test
@TestMetadata("substituteAnotherErasedTypeArgument.kt")
public void testSubstituteAnotherErasedTypeArgument() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.kt");
}
@Test
@TestMetadata("substituteOtherErasedDeepTypeArguments.kt")
public void testSubstituteOtherErasedDeepTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.kt");
}
@Test
@TestMetadata("substituteSeveralOtherErasedDependentTypeArguments.kt")
public void testSubstituteSeveralOtherErasedDependentTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.kt");
}
@Test
@TestMetadata("substituteSeveralOtherErasedTypeArguments.kt")
public void testSubstituteSeveralOtherErasedTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.kt");
}
@Test
@TestMetadata("typeEnhancement.kt")
public void testTypeEnhancement() throws Exception {
@@ -29017,6 +29213,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/typeParameters/kt42042.kt");
}
@Test
@TestMetadata("kt42042Error.kt")
public void testKt42042Error() throws Exception {
runTest("compiler/testData/diagnostics/tests/typeParameters/kt42042Error.kt");
}
@Test
@TestMetadata("kt42396.kt")
public void testKt42396() throws Exception {

View File

@@ -620,6 +620,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/RecursiveTypeInference.kt");
}
@Test
@TestMetadata("RecursiveTypeParameterEqualityCheck.kt")
public void testRecursiveTypeParameterEqualityCheck() throws Exception {
runTest("compiler/testData/diagnostics/tests/RecursiveTypeParameterEqualityCheck.kt");
}
@Test
@TestMetadata("ReserveYield.kt")
public void testReserveYield() throws Exception {
@@ -5680,6 +5686,136 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/coroutines/callableReference/outsideSuspend.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype")
@TestDataPath("$PROJECT_ROOT")
public class SuspendFunctionAsSupertype {
@Test
public void testAllFilesPresentInSuspendFunctionAsSupertype() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN")
@TestDataPath("$PROJECT_ROOT")
public class KSuspendFunctionN {
@Test
public void testAllFilesPresentInKSuspendFunctionN() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypes.kt")
public void testMixingSuspendAndNonSuspendSupertypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/mixingSuspendAndNonSuspendSupertypes.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperFunInterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperinterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/kSuspendFunctionN/simple.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple")
@TestDataPath("$PROJECT_ROOT")
public class Simple {
@Test
public void testAllFilesPresentInSimple() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypes.kt")
public void testMixingSuspendAndNonSuspendSupertypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/mixingSuspendAndNonSuspendSupertypes.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperFunInterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperinterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/simple/simple.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN")
@TestDataPath("$PROJECT_ROOT")
public class SuspendFunctionN {
@Test
public void testAllFilesPresentInSuspendFunctionN() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypes.kt")
public void testMixingSuspendAndNonSuspendSupertypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/mixingSuspendAndNonSuspendSupertypes.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperClass.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperFunInterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperFunInterface.kt");
}
@Test
@TestMetadata("mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt")
public void testMixingSuspendAndNonSuspendSupertypesThruSuperinterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/mixingSuspendAndNonSuspendSupertypesThruSuperinterface.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendFunctionAsSupertype/suspendFunctionN/simple.kt");
}
}
}
}
@Nested
@@ -8941,6 +9077,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/enum/starImportNestedClassAndEntries.kt");
}
@Test
@TestMetadata("typeCompatibility.kt")
public void testTypeCompatibility() throws Exception {
runTest("compiler/testData/diagnostics/tests/enum/typeCompatibility.kt");
}
@Test
@TestMetadata("typeParametersInEnum.kt")
public void testTypeParametersInEnum() throws Exception {
@@ -12457,6 +12599,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/inference/violatingUpperBoundForSelfType.kt");
}
@Test
@TestMetadata("violatingUpperBoundForSelfTypeError.kt")
public void testViolatingUpperBoundForSelfTypeError() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/violatingUpperBoundForSelfTypeError.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/inference/builderInference")
@TestDataPath("$PROJECT_ROOT")
@@ -16710,6 +16858,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/java8Overrides/abstractBaseClassMemberNotImplemented.kt");
}
@Test
@TestMetadata("abstractBaseClassMemberNotImplemented_15.kt")
public void testAbstractBaseClassMemberNotImplemented_15() throws Exception {
runTest("compiler/testData/diagnostics/tests/java8Overrides/abstractBaseClassMemberNotImplemented_15.kt");
}
@Test
@TestMetadata("abstractVsAbstract.kt")
public void testAbstractVsAbstract() throws Exception {
@@ -16739,6 +16893,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/java8Overrides/implementingMethodOfAny.kt");
}
@Test
@TestMetadata("kt45508.kt")
public void testKt45508() throws Exception {
runTest("compiler/testData/diagnostics/tests/java8Overrides/kt45508.kt");
}
@Test
@TestMetadata("notAMethodOfAny.kt")
public void testNotAMethodOfAny() throws Exception {
@@ -21000,6 +21160,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt");
}
@Test
@TestMetadata("dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.kt")
public void testDontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.kt");
}
@Test
@TestMetadata("dontSubstituteAnotherErasedTypeArgumentIfRecursive.kt")
public void testDontSubstituteAnotherErasedTypeArgumentIfRecursive() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.kt");
}
@Test
@TestMetadata("errorType.kt")
public void testErrorType() throws Exception {
@@ -21090,6 +21262,30 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/starProjectionToRaw.kt");
}
@Test
@TestMetadata("substituteAnotherErasedTypeArgument.kt")
public void testSubstituteAnotherErasedTypeArgument() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.kt");
}
@Test
@TestMetadata("substituteOtherErasedDeepTypeArguments.kt")
public void testSubstituteOtherErasedDeepTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.kt");
}
@Test
@TestMetadata("substituteSeveralOtherErasedDependentTypeArguments.kt")
public void testSubstituteSeveralOtherErasedDependentTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.kt");
}
@Test
@TestMetadata("substituteSeveralOtherErasedTypeArguments.kt")
public void testSubstituteSeveralOtherErasedTypeArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.kt");
}
@Test
@TestMetadata("typeEnhancement.kt")
public void testTypeEnhancement() throws Exception {
@@ -29017,6 +29213,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/typeParameters/kt42042.kt");
}
@Test
@TestMetadata("kt42042Error.kt")
public void testKt42042Error() throws Exception {
runTest("compiler/testData/diagnostics/tests/typeParameters/kt42042Error.kt");
}
@Test
@TestMetadata("kt42396.kt")
public void testKt42396() throws Exception {

View File

@@ -94,7 +94,7 @@ class Generator(
printPackageAndCopyright()
printImports()
printGeneratedMessage()
println("internal class $composedComponentName : $checkersComponentName() {")
println("class $composedComponentName : $checkersComponentName() {")
withIndent {
// public overrides
for (alias in configuration.aliases.values) {
@@ -122,7 +122,7 @@ class Generator(
// register function
println(CHECKERS_COMPONENT_INTERNAL_ANNOTATION)
println("internal fun register(checkers: $checkersComponentName) {")
println("fun register(checkers: $checkersComponentName) {")
withIndent {
for (alias in configuration.aliases.values) {
println("_${alias.fieldName} += checkers.${alias.fieldName}")

View File

@@ -9,11 +9,17 @@ import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.DIAGNOSTICS_LIST
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.generateDiagnostics
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.types.FirTypeRef
import java.io.File
fun main(args: Array<String>) {
val generationPath = args.firstOrNull()?.let { File(it) } ?: File("compiler/fir/checkers/gen").absoluteFile
val typePackage = "org.jetbrains.kotlin.fir.analysis.checkers.type"
generateCheckersComponents(generationPath, typePackage, "FirTypeChecker") {
alias<FirTypeRef>("TypeRefChecker")
}
val expressionPackage = "org.jetbrains.kotlin.fir.analysis.checkers.expression"
generateCheckersComponents(generationPath, expressionPackage, "FirExpressionChecker") {
alias<FirStatement>("BasicExpressionChecker")
@@ -32,6 +38,8 @@ fun main(args: Array<String>) {
alias<FirEqualityOperatorCall>("EqualityOperatorCallChecker")
alias<FirAnonymousFunction>("AnonymousFunctionAsExpressionChecker")
alias<FirStringConcatenationCall>("StringConcatenationCallChecker")
alias<FirTypeOperatorCall>("TypeOperatorCallChecker")
alias<FirResolvedQualifier>("ResolvedQualifierChecker")
}
val declarationPackage = "org.jetbrains.kotlin.fir.analysis.checkers.declaration"

View File

@@ -52,6 +52,7 @@ enum class PositioningStrategy(private val strategy: String? = null) {
CONST_MODIFIER,
ARRAY_ACCESS,
SAFE_ACCESS,
AS_TYPE,
USELESS_ELVIS,
NAME_OF_NAMED_ARGUMENT,
VALUE_ARGUMENTS,
@@ -67,6 +68,7 @@ enum class PositioningStrategy(private val strategy: String? = null) {
FUN_MODIFIER,
SUSPEND_MODIFIER,
FUN_INTERFACE,
RESERVED_UNDERSCORE,
;

View File

@@ -82,6 +82,10 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
val NO_THIS by error<PsiElement>()
}
val CALL_RESOLUTION by object : DiagnosticGroup("Call resolution") {
val CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS by error<KtExpression>()
}
val SUPER by object : DiagnosticGroup("Super") {
val SUPER_IS_NOT_AN_EXPRESSION by error<PsiElement>(PositioningStrategy.REFERENCED_NAME_BY_QUALIFIED)
val SUPER_NOT_AVAILABLE by error<PsiElement>(PositioningStrategy.REFERENCED_NAME_BY_QUALIFIED)
@@ -251,6 +255,8 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
val NAMED_PARAMETER_NOT_FOUND by error<KtValueArgument>(PositioningStrategy.NAME_OF_NAMED_ARGUMENT) {
parameter<String>("name")
}
val MANY_LAMBDA_EXPRESSION_ARGUMENTS by error<KtValueArgument>()
}
val AMBIGUITY by object : DiagnosticGroup("Ambiguity") {
@@ -354,6 +360,16 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
val MISPLACED_TYPE_PARAMETER_CONSTRAINTS by warning<KtTypeParameter>()
val DYNAMIC_UPPER_BOUND by error<KtTypeReference>()
val INCOMPATIBLE_TYPES by error<KtElement> {
parameter<ConeKotlinType>("typeA")
parameter<ConeKotlinType>("typeB")
}
val INCOMPATIBLE_TYPES_WARNING by warning<KtElement> {
parameter<ConeKotlinType>("typeA")
parameter<ConeKotlinType>("typeB")
}
}
val REFLECTION by object : DiagnosticGroup("Reflection") {
@@ -589,6 +605,9 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
val UNINITIALIZED_VARIABLE by error<KtSimpleNameExpression> {
parameter<FirPropertySymbol>("variable")
}
val UNINITIALIZED_PARAMETER by error<KtSimpleNameExpression> {
parameter<FirVariableSymbol<FirValueParameter>>("parameter")
}
val UNINITIALIZED_ENUM_ENTRY by error<KtSimpleNameExpression> {
parameter<FirVariableSymbol<FirEnumEntry>>("enumEntry")
}
@@ -648,6 +667,13 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
val USELESS_ELVIS_RIGHT_IS_NULL by warning<KtBinaryExpression>(PositioningStrategy.USELESS_ELVIS)
}
val CASTS_AND_IS_CHECKS by object : DiagnosticGroup("Casts and is-checks") {
val USELESS_CAST by warning<KtBinaryExpressionWithTypeRHS>(PositioningStrategy.AS_TYPE)
val USELESS_IS_CHECK by warning<KtElement> {
parameter<Boolean>("compileTimeCheckResult")
}
}
val WHEN_EXPRESSIONS by object : DiagnosticGroup("When expressions") {
val NO_ELSE_IN_WHEN by error<KtWhenExpression>(PositioningStrategy.WHEN_EXPRESSION) {
parameter<List<WhenMissingCase>>("missingWhenCases")
@@ -663,6 +689,10 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
val TYPE_PARAMETER_ON_LHS_OF_DOT by error<KtSimpleNameExpression> {
parameter<FirTypeParameterSymbol>("typeParameter")
}
val NO_COMPANION_OBJECT by error<KtSimpleNameExpression>(PositioningStrategy.SELECTOR_BY_QUALIFIED) {
parameter<FirRegularClassSymbol>("klass")
}
val EXPRESSION_EXPECTED_PACKAGE_FOUND by error<KtSimpleNameExpression>(PositioningStrategy.SELECTOR_BY_QUALIFIED)
}
val FUNCTION_CONTRACTS by object : DiagnosticGroup("Function contracts") {
@@ -696,6 +726,29 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
parameter<String>("expectedFunctionSignature")
parameter<Collection<AbstractFirBasedSymbol<*>>>("candidates")
}
val DELEGATE_SPECIAL_FUNCTION_RETURN_TYPE_MISMATCH by error<KtExpression> {
parameter<String>("delegateFunction")
parameter<ConeKotlinType>("expected")
parameter<ConeKotlinType>("actual")
}
val UNDERSCORE_IS_RESERVED by error<KtExpression>(PositioningStrategy.RESERVED_UNDERSCORE)
val UNDERSCORE_USAGE_WITHOUT_BACKTICKS by error<KtExpression>(PositioningStrategy.RESERVED_UNDERSCORE)
val EQUALITY_NOT_APPLICABLE by error<KtBinaryExpression> {
parameter<String>("operator")
parameter<ConeKotlinType>("leftType")
parameter<ConeKotlinType>("rightType")
}
val EQUALITY_NOT_APPLICABLE_WARNING by warning<KtBinaryExpression> {
parameter<String>("operator")
parameter<ConeKotlinType>("leftType")
parameter<ConeKotlinType>("rightType")
}
val INCOMPATIBLE_ENUM_COMPARISON_ERROR by error<KtElement> {
parameter<ConeKotlinType>("leftType")
parameter<ConeKotlinType>("rightType")
}
}
val TYPE_ALIAS by object : DiagnosticGroup("Type alias") {
@@ -725,6 +778,49 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
val RETURN_NOT_ALLOWED by error<KtReturnExpression>(PositioningStrategy.RETURN_WITH_LABEL)
val RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY by error<KtReturnExpression>(PositioningStrategy.RETURN_WITH_LABEL)
}
val INLINE by object : DiagnosticGroup("Inline") {
val USAGE_IS_NOT_INLINABLE by error<KtElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED) {
parameter<Symbol>("parameter")
}
val NON_LOCAL_RETURN_NOT_ALLOWED by error<KtElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED) {
parameter<Symbol>("parameter")
}
val RECURSION_IN_INLINE by error<KtElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED) {
parameter<Symbol>("symbol")
}
val NON_PUBLIC_CALL_FROM_PUBLIC_INLINE by error<KtElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED) {
parameter<Symbol>("inlineDeclaration")
parameter<Symbol>("referencedDeclaration")
}
val PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE by error<KtElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED) {
parameter<Symbol>("inlineDeclaration")
parameter<Symbol>("referencedDeclaration")
}
val PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR by error<KtElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED) {
parameter<Symbol>("inlineDeclaration")
parameter<Symbol>("referencedDeclaration")
}
val PROTECTED_CALL_FROM_PUBLIC_INLINE by warning<KtElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED) {
parameter<Symbol>("inlineDeclaration")
parameter<Symbol>("referencedDeclaration")
}
val PRIVATE_CLASS_MEMBER_FROM_INLINE by error<KtElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED) {
parameter<Symbol>("inlineDeclaration")
parameter<Symbol>("referencedDeclaration")
}
val SUPER_CALL_FROM_PUBLIC_INLINE by warning<KtElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED) {
parameter<Symbol>("symbol")
}
}
}
private val exposedVisibilityDiagnosticInit: DiagnosticBuilder.() -> Unit = {

View File

@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker
* DO NOT MODIFY IT MANUALLY
*/
internal class ComposedDeclarationCheckers : DeclarationCheckers() {
class ComposedDeclarationCheckers : DeclarationCheckers() {
override val basicDeclarationCheckers: Set<FirBasicDeclarationChecker>
get() = _basicDeclarationCheckers
override val memberDeclarationCheckers: Set<FirMemberDeclarationChecker>
@@ -54,7 +54,7 @@ internal class ComposedDeclarationCheckers : DeclarationCheckers() {
private val _variableAssignmentCfaBasedCheckers: MutableSet<AbstractFirPropertyInitializationChecker> = mutableSetOf()
@CheckersComponentInternal
internal fun register(checkers: DeclarationCheckers) {
fun register(checkers: DeclarationCheckers) {
_basicDeclarationCheckers += checkers.basicDeclarationCheckers
_memberDeclarationCheckers += checkers.memberDeclarationCheckers
_functionCheckers += checkers.functionCheckers

View File

@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.fir.analysis.CheckersComponentInternal
* DO NOT MODIFY IT MANUALLY
*/
internal class ComposedExpressionCheckers : ExpressionCheckers() {
class ComposedExpressionCheckers : ExpressionCheckers() {
override val basicExpressionCheckers: Set<FirBasicExpressionChecker>
get() = _basicExpressionCheckers
override val qualifiedAccessCheckers: Set<FirQualifiedAccessChecker>
@@ -45,6 +45,10 @@ internal class ComposedExpressionCheckers : ExpressionCheckers() {
get() = _anonymousFunctionAsExpressionCheckers
override val stringConcatenationCallCheckers: Set<FirStringConcatenationCallChecker>
get() = _stringConcatenationCallCheckers
override val typeOperatorCallCheckers: Set<FirTypeOperatorCallChecker>
get() = _typeOperatorCallCheckers
override val resolvedQualifierCheckers: Set<FirResolvedQualifierChecker>
get() = _resolvedQualifierCheckers
private val _basicExpressionCheckers: MutableSet<FirBasicExpressionChecker> = mutableSetOf()
private val _qualifiedAccessCheckers: MutableSet<FirQualifiedAccessChecker> = mutableSetOf()
@@ -62,9 +66,11 @@ internal class ComposedExpressionCheckers : ExpressionCheckers() {
private val _equalityOperatorCallCheckers: MutableSet<FirEqualityOperatorCallChecker> = mutableSetOf()
private val _anonymousFunctionAsExpressionCheckers: MutableSet<FirAnonymousFunctionAsExpressionChecker> = mutableSetOf()
private val _stringConcatenationCallCheckers: MutableSet<FirStringConcatenationCallChecker> = mutableSetOf()
private val _typeOperatorCallCheckers: MutableSet<FirTypeOperatorCallChecker> = mutableSetOf()
private val _resolvedQualifierCheckers: MutableSet<FirResolvedQualifierChecker> = mutableSetOf()
@CheckersComponentInternal
internal fun register(checkers: ExpressionCheckers) {
fun register(checkers: ExpressionCheckers) {
_basicExpressionCheckers += checkers.basicExpressionCheckers
_qualifiedAccessCheckers += checkers.qualifiedAccessCheckers
_functionCallCheckers += checkers.functionCallCheckers
@@ -81,5 +87,7 @@ internal class ComposedExpressionCheckers : ExpressionCheckers() {
_equalityOperatorCallCheckers += checkers.equalityOperatorCallCheckers
_anonymousFunctionAsExpressionCheckers += checkers.anonymousFunctionAsExpressionCheckers
_stringConcatenationCallCheckers += checkers.stringConcatenationCallCheckers
_typeOperatorCallCheckers += checkers.typeOperatorCallCheckers
_resolvedQualifierCheckers += checkers.resolvedQualifierCheckers
}
}

View File

@@ -33,6 +33,8 @@ abstract class ExpressionCheckers {
open val equalityOperatorCallCheckers: Set<FirEqualityOperatorCallChecker> = emptySet()
open val anonymousFunctionAsExpressionCheckers: Set<FirAnonymousFunctionAsExpressionChecker> = emptySet()
open val stringConcatenationCallCheckers: Set<FirStringConcatenationCallChecker> = emptySet()
open val typeOperatorCallCheckers: Set<FirTypeOperatorCallChecker> = emptySet()
open val resolvedQualifierCheckers: Set<FirResolvedQualifierChecker> = emptySet()
@CheckersComponentInternal internal val allBasicExpressionCheckers: Set<FirBasicExpressionChecker> get() = basicExpressionCheckers
@CheckersComponentInternal internal val allQualifiedAccessCheckers: Set<FirQualifiedAccessChecker> get() = qualifiedAccessCheckers + basicExpressionCheckers
@@ -50,4 +52,6 @@ abstract class ExpressionCheckers {
@CheckersComponentInternal internal val allEqualityOperatorCallCheckers: Set<FirEqualityOperatorCallChecker> get() = equalityOperatorCallCheckers + basicExpressionCheckers
@CheckersComponentInternal internal val allAnonymousFunctionAsExpressionCheckers: Set<FirAnonymousFunctionAsExpressionChecker> get() = anonymousFunctionAsExpressionCheckers + basicExpressionCheckers
@CheckersComponentInternal internal val allStringConcatenationCallCheckers: Set<FirStringConcatenationCallChecker> get() = stringConcatenationCallCheckers + basicExpressionCheckers
@CheckersComponentInternal internal val allTypeOperatorCallCheckers: Set<FirTypeOperatorCallChecker> get() = typeOperatorCallCheckers + basicExpressionCheckers
@CheckersComponentInternal internal val allResolvedQualifierCheckers: Set<FirResolvedQualifierChecker> get() = resolvedQualifierCheckers + basicExpressionCheckers
}

View File

@@ -19,11 +19,13 @@ import org.jetbrains.kotlin.fir.expressions.FirEqualityOperatorCall
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
import org.jetbrains.kotlin.fir.expressions.FirGetClassCall
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
import org.jetbrains.kotlin.fir.expressions.FirReturnExpression
import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression
import org.jetbrains.kotlin.fir.expressions.FirStatement
import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall
import org.jetbrains.kotlin.fir.expressions.FirTryExpression
import org.jetbrains.kotlin.fir.expressions.FirTypeOperatorCall
import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment
import org.jetbrains.kotlin.fir.expressions.FirWhenExpression
@@ -43,3 +45,5 @@ typealias FirSafeCallExpressionChecker = FirExpressionChecker<FirSafeCallExpress
typealias FirEqualityOperatorCallChecker = FirExpressionChecker<FirEqualityOperatorCall>
typealias FirAnonymousFunctionAsExpressionChecker = FirExpressionChecker<FirAnonymousFunction>
typealias FirStringConcatenationCallChecker = FirExpressionChecker<FirStringConcatenationCall>
typealias FirTypeOperatorCallChecker = FirExpressionChecker<FirTypeOperatorCall>
typealias FirResolvedQualifierChecker = FirExpressionChecker<FirResolvedQualifier>

View File

@@ -0,0 +1,25 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.analysis.checkers.type
import org.jetbrains.kotlin.fir.analysis.CheckersComponentInternal
/*
* This file was generated automatically
* DO NOT MODIFY IT MANUALLY
*/
class ComposedTypeCheckers : TypeCheckers() {
override val typeRefCheckers: Set<FirTypeRefChecker>
get() = _typeRefCheckers
private val _typeRefCheckers: MutableSet<FirTypeRefChecker> = mutableSetOf()
@CheckersComponentInternal
fun register(checkers: TypeCheckers) {
_typeRefCheckers += checkers.typeRefCheckers
}
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.analysis.checkers.type
/*
* This file was generated automatically
* DO NOT MODIFY IT MANUALLY
*/
import org.jetbrains.kotlin.fir.types.FirTypeRef
typealias FirTypeRefChecker = FirTypeChecker<FirTypeRef>

View File

@@ -0,0 +1,23 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.analysis.checkers.type
import org.jetbrains.kotlin.fir.analysis.CheckersComponentInternal
/*
* This file was generated automatically
* DO NOT MODIFY IT MANUALLY
*/
abstract class TypeCheckers {
companion object {
val EMPTY: TypeCheckers = object : TypeCheckers() {}
}
open val typeRefCheckers: Set<FirTypeRefChecker> = emptySet()
@CheckersComponentInternal internal val allTypeRefCheckers: Set<FirTypeRefChecker> get() = typeRefCheckers
}

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