Commit Graph

25922 Commits

Author SHA1 Message Date
Steven Schäfer cdd3f82396 JVM IR: Use correct scope owner in JvmInlineClassLowering 2019-09-18 18:52:58 +02:00
Alexander Udalov 6ef434a711 JVM IR: add -Xir-check-local-names to check names for consistency
Since KotlinTypeMapper is no longer used in the JVM IR backend, we need
not run CodegenBinding.initTrace and check that names of local entities
are exactly equal to local names computed by that algorithm.

However, it's still useful as an opt-in flag, to discover issues where
unwanted elements take part in the naming (such as temporary IR
variables, see for example cb2e68fece). So we introduce a new command
line argument -Xir-check-local-names which, when the IR backend is used
(via -Xuse-ir), launches the name computation algorithm from the old
backend and then compares that the names are exactly equal to the names
computed by the IR backend in InventNamesForLocalClasses.
2019-09-18 17:55:42 +02:00
Alexander Udalov 530c1411c3 Remove IR backend-specific code from KotlinTypeMapper
Add an assertion to check that we don't call mapType anymore in JVM IR.
2019-09-18 17:55:41 +02:00
Alexander Udalov aa77f6c245 Improve KParameter.toString for instance and extension receiver parameter
#KT-17860 Fixed
2019-09-18 14:05:43 +02:00
Alexander Udalov 59186b2617 Psi2ir: ignore unresolved class literals in annotations
Similarly to 38536638, skip annotation arguments that reference classes
which are not found in our compilation classpath.

This fix is especially needed because of the way _nested_ classes are
currently referenced in annotations. Since we don't generate all needed
InnerClasses attributes yet (KT-27936), we can't unambiguously resolve a
reference to a nested class in annotation arguments. This leads to an
ErrorValue loaded in the annotation descriptor. The old backend doesn't
care, since it doesn't look at that annotation or its arguments, but
psi2ir tries to convert all annotation arguments and it crashed with CCE
here, trying to cast IrErrorType to IrSimpleType.
2019-09-18 14:05:28 +02:00
Alexander Udalov c69997491f JVM IR: generate file annotations on file facade classes 2019-09-18 14:05:28 +02:00
Nikolay Krasko 4387862d20 Remap android home directory to allow parallel test execution (KT-33870)
Using same directory for android (user home) leads to exception on Windows
because of file lock:

com.google.gson.JsonSyntaxException: java.io.IOException: The process cannot access the file because another process has locked a portion of the file
at com.google.gson.Gson.fromJson(Gson.java:942)
at com.google.gson.Gson.fromJson(Gson.java:865)
at com.android.tools.analytics.AnalyticsSettings.loadSettingsData(AnalyticsSettings.kt:140)
at com.android.tools.analytics.AnalyticsSettings.initialize(AnalyticsSettings.kt:211)
at org.jetbrains.android.AndroidPlugin.initializeForNonStudio(AndroidPlugin.java:56)
at org.jetbrains.android.AndroidPlugin.initComponent(AndroidPlugin.java:30)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:503)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:126)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:411)
at com.intellij.idea.IdeaTestApplication.a(IdeaTestApplication.java:114)
at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:61)
at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:54)
at com.intellij.testFramework.LightPlatformTestCase.initApplication(LightPlatformTestCase.java:166)
at com.intellij.testFramework.fixtures.impl.LightIdeaTestFixtureImpl.setUp(LightIdeaTestFixtureImpl.java:41)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$setUp$27(CodeInsightTestFixtureImpl.java:1142)
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(EdtTestUtil.kt:63)
at com.intellij.testFramework.EdtTestUtil$Companion.runInEdtAndWait(EdtTestUtil.kt:18)
at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.kt)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.setUp(CodeInsightTestFixtureImpl.java:1141)
at com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase.setUp(LightJavaCodeInsightFixtureTestCase.java:96)
at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase.setUp(KotlinLightCodeInsightFixtureTestCase.kt:66)
at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:388)
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$3.run(EdtTestUtil.kt:67)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
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.dispatchEvent(IdeEventQueue.java:433)
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.io.IOException: The process cannot access the file because another process has locked a portion of the file
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:61)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:197)
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:159)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at com.google.gson.stream.JsonReader.fillBuffer(JsonReader.java:1295)
at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1333)
at com.google.gson.stream.JsonReader.consumeNonExecutePrefix(JsonReader.java:1576)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:534)
at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
at com.google.gson.Gson.fromJson(Gson.java:923)
... 41 more

#KT-33870 Fixed
2019-09-18 11:30:02 +03:00
Denis Zharkov 2bdbed978b FIR: Support SAM constructors 2019-09-18 10:03:55 +07:00
Denis Zharkov b3e96a1fcf FIR: Merge FirTopLevelDeclaredMemberScope into FirSelfImportingScope
It's strange that those scopes have similar semantics but belong
to different level (that might change semantics a bit)
2019-09-18 10:03:55 +07:00
Denis Zharkov 391346ae46 FIR: Pass BodyResolveComponents to ScopeTowerLevel 2019-09-18 10:03:28 +07:00
Denis Zharkov fb4b6b8290 FIR: Move constructor processing from scopes to tower resolvers 2019-09-18 10:03:28 +07:00
Denis Zharkov 08a8a9fa61 FIR: Move SamResolver to BodyResolveComponents 2019-09-18 10:00:04 +07:00
Denis Zharkov 5ebde93eb9 FIR: Provide BodyResolveComponents instead of InferenceComponents to resolution
It seems to be more reasonable to store SamResolver, ScopeSession
and other per-transformer/per-thread components there
2019-09-18 10:00:04 +07:00
Denis Zharkov 5567620563 FIR: Support SAM conversion 2019-09-18 10:00:04 +07:00
Denis Zharkov f501730d86 Minor. Reformat Arguments.kt in fir 2019-09-18 10:00:04 +07:00
Denis Zharkov 9d517d914b Minor. Get rid of redundant elvis operand in AbstractConeSubstitutor::substituteOrNull 2019-09-18 10:00:04 +07:00
Denis Zharkov 6e51bed30c FIR: Support lambda inference from platform types 2019-09-18 10:00:04 +07:00
Denis Zharkov d787df3880 Minor. Reformat ConeKotlinType::isBuiltinFunctionalType 2019-09-18 10:00:04 +07:00
Mikhail Zarechenskiy 0431c21f9a [NI] Remove unneeded computation of possible types for return type
This call was needed at some point for smartcasts on qualified
 expressions but become obsolete (most likely after
 daa27016ca).

 Now `ComplexDataFlowBenchmark` has similar results for NI and OI
2019-09-18 00:19:21 +03:00
Mikhail Zarechenskiy d47fc85868 [NI] Minor, small improvements around KotlinCall creation 2019-09-18 00:13:10 +03:00
Mikhail Zarechenskiy 971b02494c [NI] Minor, simplify code a bit for sub calls preparation 2019-09-18 00:13:10 +03:00
Vyacheslav Gerasimov 6327f657a5 193: Add bunches for 193 platform 2019-09-17 21:16:13 +03:00
Ilmir Usmanov 0e3f0c98e5 JVM_IR: Support inline suspend lambdas 2019-09-17 19:19:27 +03:00
Dmitriy Novozhilov 61ae98df40 [FIR] Add default visitors and transformers with useful part of visited hierarchy 2019-09-17 18:09:18 +03:00
Dmitriy Novozhilov e70c1d6959 [FIR] Remove default visited hierarchy 2019-09-17 18:09:18 +03:00
Simon Ogorodnik df3fbaf417 Add various configuration parameters to Non Fir modularized tests 2019-09-17 16:10:37 +03:00
Simon Ogorodnik f3a0632b9a [FIR] Fix dump html for each pass 2019-09-17 16:10:32 +03:00
Dmitry Petrov 0531bd4fe6 KT-29229 Intrinsify 'in' operator for unsigned integer ranges
Support mixed type case, e.g., '[UByte] in [UIntRange]'.
2019-09-17 15:50:47 +03:00
Mikhail Glukhikh 13b16cfe75 Refactoring: get rid of firSafeNullable, enhance getSymbolByLookupTag 2019-09-17 10:10:07 +03:00
Mikhail Glukhikh 0493432723 Remove some usages of FirBasedSymbol 2019-09-17 10:10:06 +03:00
Matthew Gharrity a1f4a4572a Check cancelation in KotlinJavaPsiFacade.findPackage()
This may help with some UI freezes caused by KT-33394, although
it does not fix the underlying performance problem.
2019-09-16 10:58:58 -07:00
Pavel Kirpichenkov 0a1b3a8455 Clearify diagnostic messages that involve internal visibilities
KT-7354 Fixed

Visibility.displayText is deprecated with warning.
Diagnostics for java visibilities changed.
2019-09-16 19:00:43 +03:00
Mikhail Glukhikh 20c45a8382 FIR general refactoring: get rid of ConeSymbols 2019-09-16 16:55:42 +03:00
Ilmir Usmanov c1c46daa01 Use en_US.UTF-8 locale instead of default locale to work around errors
in tr_TR.UTF-8 locale in coroutines-specific code.

 #KT-33821: Fixed
2019-09-16 16:50:05 +03:00
Ilmir Usmanov 1951ff8054 JVM_IR: Minor. Unmute tests 2019-09-16 16:49:24 +03:00
Ilmir Usmanov a3284326af JVM_IR: Do not box/unbox result in continuations
Otherwise, it leads to CCE from kotlin/Result.
2019-09-16 16:49:22 +03:00
Ilmir Usmanov 402a77126f JVM_IR: Support inline suspend functions
Only no state-machine version for now.
2019-09-16 16:49:21 +03:00
Ilmir Usmanov 2ec3417e0e JVM_IR: Move suspend functions into view transformation to codegen phase
Support suspend functions with default arguments.
2019-09-16 16:49:18 +03:00
Alexander Udalov 5259af157a JVM IR: workaround correspondingPropertySymbol absence after deep copy 2019-09-16 14:57:21 +02:00
Alexander Udalov b782cf6bdb JVM IR: workaround KotlinTypeMapper usages in boxing optimization on inline classes 2019-09-16 14:57:21 +02:00
Alexander Udalov c425bd0e0b JVM IR: do not use KotlinTypeMapper in BuilderFactoryForDuplicateSignatureDiagnostics 2019-09-16 14:57:21 +02:00
Alexander Udalov 3a0c41dca4 JVM IR: do not use KotlinTypeMapper indirectly in CallableReferenceLowering 2019-09-16 14:57:21 +02:00
Alexander Udalov 26874a6e1e JVM IR: do not use KotlinTypeMapper in MethodSignatureMapper 2019-09-16 14:57:20 +02:00
Alexander Udalov ee976020bc JVM IR: add KotlinTypeMapperBase, do not use KotlinTypeMapper in metadata serialization 2019-09-16 14:57:20 +02:00
Alexander Udalov bd8ea9412d JVM IR: implement MethodSignatureMapper.mapFunctionName directly 2019-09-16 14:57:20 +02:00
Alexander Udalov 36c242764f JVM IR: implement MethodSignatureMapper.mapSignature directly
As well as mapFieldSignature, mapReturnType, mapAsmMethod and smaller
methods. This removes yet another dependency on KotlinTypeMapper in the
IR backend.
2019-09-16 14:44:16 +02:00
Alexander Udalov 46ced326b8 JVM IR: minimize usages of some methods in MethodSignatureMapper
Also do not pass useless parameters such as OwnerKind which is always
IMPLEMENTATION in the IR backend
2019-09-16 14:44:16 +02:00
Alexander Udalov 4dc1d61c38 JVM IR: do not remove overridden symbols in BridgeLowering
This information might be needed in subsequent lowerings or codegen. For
example, it'll be needed in MethodSignatureMapper to determine that we
need to box primitive return type if one of overridden functions has a
non-primitive return type.

For invoke in lambda classes specifically though, we need to remove this
override from the specialized invoke because otherwise we'd call a boxed
version in the bridge (see 73d2ae961c). In this change, we still keep
the override on a bridge though just for the sake of IR consistency.
2019-09-16 14:44:16 +02:00
Alexander Udalov 45929f57b6 Minor, add test on name mangling of private multi-file part members 2019-09-16 14:44:16 +02:00
Alexander Udalov 9d257a1ed8 JVM IR: generate call to checkNotNull in IrCheckNotNull since 1.4
#KT-22275
2019-09-16 12:33:01 +02:00