Compare commits

...

13 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy
6425da5803 ~ Misc bugs
e: kotlin/idea/idea-android/src/org/jetbrains/kotlin/android/KotlinAndroidLineMarkerProvider.kt: (107, 26): Unresolved reference: map

e: kotlin/compiler/tests/org/jetbrains/kotlin/daemon/CompilerApiTest.kt: (208, 50): Unresolved reference: any
e: kotlin/compiler/tests/org/jetbrains/kotlin/daemon/CompilerApiTest.kt: (208, 56): Unresolved reference: it
e: kotlin/compiler/tests/org/jetbrains/kotlin/daemon/CompilerApiTest.kt: (208, 108): Unresolved reference: it
e: kotlin/compiler/tests/org/jetbrains/kotlin/daemon/CompilerApiTest.kt: (211, 25): Unresolved reference: joinToString
e: kotlin/compiler/tests/org/jetbrains/kotlin/daemon/CompilerApiTest.kt: (211, 49): Unresolved reference: it
e: kotlin/compiler/tests/org/jetbrains/kotlin/daemon/CompilerApiTest.kt: (211, 65): Unresolved reference: it
e: kotlin/compiler/tests/org/jetbrains/kotlin/daemon/CompilerApiTest.kt: (211, 78): Unresolved reference: it
e: kotlin/compiler/tests/org/jetbrains/kotlin/daemon/CompilerApiTest.kt: (211, 101): Unresolved reference: it

e: kotlin/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilderModuleScriptGenerator.kt: (69, 22): Cannot infer a type for this parameter. Please specify it explicitly.

e: kotlin/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt: (875, 43): Unresolved reference: size

e: kotlin/generators/src/org/jetbrains/kotlin/generators/tests/GeneratePrimitiveVsObjectEqualityTestData.kt: (136, 24): Unresolved reference: isNotBlank

e: kotlin/libraries/stdlib/test/collections/ArraysTest.kt: (1242, 49): Type mismatch: inferred type is Array<out TypeVariable(T)> but Array<out Int> was expected
e: kotlin/libraries/stdlib/test/collections/ArraysTest.kt: (1242, 82): Type mismatch: inferred type is Array<out TypeVariable(T)> but Array<out Int> was expected
e: kotlin/libraries/stdlib/test/coroutines/SequenceBuilderTest.kt: (271, 25): Type mismatch: inferred type is Any? but Any was expected
e: kotlin/libraries/stdlib/test/coroutines/SequenceBuilderTest.kt: (300, 17): None of the following functions can be called with the arguments supplied:
public final operator fun plus(other: Byte): Int defined in kotlin.Int
public final operator fun plus(other: Double): Double defined in kotlin.Int
public final operator fun plus(other: Float): Float defined in kotlin.Int
public final operator fun plus(other: Int): Int defined in kotlin.Int
public final operator fun plus(other: Long): Long defined in kotlin.Int
public final operator fun plus(other: Short): Int defined in kotlin.Int
e: kotlin/libraries/stdlib/test/properties/delegation/MapAccessorsTest.kt: (14, 41): Null can not be a value of a non-null type String
e: kotlin/libraries/stdlib/test/properties/delegation/MapAccessorsTest.kt: (38, 20): Property delegate must have a 'getValue(VarByMapExtensionsTest, KProperty<*>)' method. None of the following functions is suitable:
@JvmName @InlineOnly public operator inline fun <V> MutableMap<in String, in Nothing>.getValue(thisRef: Any?, property: KProperty<*>): Nothing defined in kotlin.collections
2017-12-10 23:02:34 +03:00
Mikhail Zarechenskiy
bb5ad90ff2 ~ Exception from the compiler
Caused by: java.lang.IllegalStateException: Scope for number value type (IntegerValueType(0)), required name: plus
        at org.jetbrains.kotlin.types.ErrorUtils$ThrowingScope.getContributedFunctions(ErrorUtils.java:269)
        at org.jetbrains.kotlin.resolve.calls.tower.MemberScopeTowerLevel$getFunctions$1.invoke(TowerLevels.kt:169)
        at org.jetbrains.kotlin.resolve.calls.tower.MemberScopeTowerLevel$getFunctions$1.invoke(TowerLevels.kt:83)
        at org.jetbrains.kotlin.resolve.calls.tower.MemberScopeTowerLevel.collectMembers(TowerLevels.kt:96)
        at org.jetbrains.kotlin.resolve.calls.tower.MemberScopeTowerLevel.getFunctions(TowerLevels.kt:168)
        at org.jetbrains.kotlin.resolve.calls.tower.ScopeTowerProcessorsKt$createSimpleFunctionProcessor$1.invoke(ScopeTowerProcessors.kt:227)
        at org.jetbrains.kotlin.resolve.calls.tower.ScopeTowerProcessorsKt$createSimpleFunctionProcessor$1.invoke(ScopeTowerProcessors.kt)
        at org.jetbrains.kotlin.resolve.calls.tower.ExplicitReceiverScopeTowerProcessor.resolveAsMember(ScopeTowerProcessors.kt:81)
        at org.jetbrains.kotlin.resolve.calls.tower.ExplicitReceiverScopeTowerProcessor.simpleProcess(ScopeTowerProcessors.kt:73)
        at org.jetbrains.kotlin.resolve.calls.tower.SimpleScopeTowerProcessor$DefaultImpls.process(TowerResolver.kt:80)
        at org.jetbrains.kotlin.resolve.calls.tower.AbstractSimpleScopeTowerProcessor.process(ScopeTowerProcessors.kt:58)
        at org.jetbrains.kotlin.resolve.calls.tower.PrioritizedCompositeScopeTowerProcessor.process(ScopeTowerProcessors.kt:39)
        at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.processTowerData(TowerResolver.kt:281)
        at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.access$processTowerData(TowerResolver.kt:83)
        at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.process(TowerResolver.kt:167)
        at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run(TowerResolver.kt:186)
        at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.run(TowerResolver.kt:103)
        at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.runResolve(TowerResolver.kt:89)
        at org.jetbrains.kotlin.resolve.calls.KotlinCallResolver.resolveCall(KotlinCallResolver.kt:63)
        at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.runResolutionAndInference(PSICallResolver.kt:94)
        at org.jetbrains.kotlin.resolve.calls.CallResolver.doResolveCallOrGetCachedResults(CallResolver.java:578)
        at org.jetbrains.kotlin.resolve.calls.CallResolver.lambda$computeTasksAndResolveCall$0(CallResolver.java:214)
        at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:90)
        at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:212)
        at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:202)
        at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveCallWithGivenName(CallResolver.java:168)
        at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveBinaryCall(CallResolver.java:249)
        at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.getTypeInfoForBinaryCall(BasicExpressionTypingVisitor.java:1511)
        at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitBinaryExpression(BasicExpressionTypingVisitor.java:1041)
        at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitBinaryExpression(ExpressionTypingVisitorDispatcher.java:400)
        at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitBinaryExpression(ExpressionTypingVisitorDispatcher.java:54)
        at org.jetbrains.kotlin.psi.KtBinaryExpression.accept(KtBinaryExpression.java:33)
        at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:182)
        ... 171 more
2017-12-10 22:55:49 +03:00
Mikhail Zarechenskiy
dcfacddce3 ~ Exception from the compiler
Caused by: java.lang.AssertionError: No resolved call for '!options.enableListBoxing' at (350,21) in /Users/jetbrains/projects/dup_kotlin/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt
        at org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt.getResolvedCallWithAssert(callUtil.kt:185)
        at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitPrefixExpression(ExpressionCodegen.java:3514)
        at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitPrefixExpression(ExpressionCodegen.java:120)
2017-12-10 22:41:38 +03:00
Mikhail Zarechenskiy
7e2a9b59de ~ Exception from the compiler
java.lang.UnsupportedOperationException: no descriptor for type constructor of TypeVariable(T)
2017-12-10 22:40:37 +03:00
Mikhail Zarechenskiy
2be20d07d1 ~ Exception from the compiler 2017-12-10 22:31:24 +03:00
Mikhail Zarechenskiy
e1b241a263 ~ Misc
e: kotlin/idea/idea-analysis/src/org/jetbrains/kotlin/idea/vfilefinder/fileIndexes.kt: (64, 17): Type mismatch: inferred type is Map<out Any?, Void>! but (Mutable)Map<FqName!, Void!> was expected

e: kotlin/idea/src/org/jetbrains/kotlin/idea/versions/KotlinJvmMetadataVersionIndex.kt: (85, 9): Type mismatch: inferred type is Map<TypeVariable(K), Nothing?> but (Mutable)Map<TypeVariable(Key)!, Void> was expected

e: kotlin/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/AbstractCompletionBenchmarkAction.kt: (129, 70): Type mismatch: inferred type is StringBuilder! but Unit was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/AbstractCompletionBenchmarkAction.kt: (136, 17): Type mismatch: inferred type is StringBuilder! but Unit was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/AbstractCompletionBenchmarkAction.kt: (141, 70): Type mismatch: inferred type is StringBuilder! but Unit was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/AbstractCompletionBenchmarkAction.kt: (145, 17): Type mismatch: inferred type is StringBuilder! but Unit was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/HighlightingBenchmarkAction.kt: (139, 64): Type mismatch: inferred type is StringBuilder! but Unit was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/HighlightingBenchmarkAction.kt: (146, 17): Type mismatch: inferred type is StringBuilder! but Unit was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/HighlightingBenchmarkAction.kt: (151, 64): Type mismatch: inferred type is StringBuilder! but Unit was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/HighlightingBenchmarkAction.kt: (157, 17): Type mismatch: inferred type is StringBuilder! but Unit was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/codeInsight/postfix/KtPostfixTemplateProvider.kt: (115, 40): Type mismatch: inferred type is (Nothing, Nothing) -> TypeVariable(_L) but Nothing? was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/codeInsight/postfix/KtPostfixTemplateProvider.kt: (116, 61): Type mismatch: inferred type is ((KotlinType) -> Boolean)? but (TypeVariable(T)) -> TypeVariable(R) was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/configuration/NotificationMessageCollector.kt: (36, 22): Unresolved reference: isEmpty
e: kotlin/idea/src/org/jetbrains/kotlin/idea/configuration/NotificationMessageCollector.kt: (44, 25): Unresolved reference: joinToString
e: kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/ExplicitThisInspection.kt: (47, 40): Type mismatch: inferred type is KFunction2<LexicalScope, Name, Collection<FunctionDescriptor>> but KFunction2<LexicalScope, Name, Collection<VariableDescriptor>> was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt: (282, 46): Unresolved reference: !
e: kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt: (293, 21): Unresolved reference: !
e: kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/utils.kt: (369, 32): Type mismatch: inferred type is KFunction1<KtExpressionWithLabel, Boolean> but (PsiElement) -> Boolean was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/utils.kt: (373, 37): Type mismatch: inferred type is KFunction1<KtExpressionWithLabel, Boolean> but (PsiElement) -> Boolean was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt: (128, 18): Type mismatch: inferred type is () -> TypeVariable(_L) but Nothing? was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt: (130, 34): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KtProperty?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt: (131, 33): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KtProperty?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (95, 27): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KotlinType?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (107, 64): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KotlinType?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (113, 59): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KotlinType?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (116, 101): Type mismatch: inferred type is KotlinType? but KotlinType was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (119, 54): Type mismatch: inferred type is KotlinType? but KotlinType was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (137, 99): Type mismatch: inferred type is KotlinType? but KotlinType was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (139, 31): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KotlinType?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (151, 50): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KotlinType?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (166, 46): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KotlinType?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (195, 71): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KotlinType?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (202, 56): Type mismatch: inferred type is KotlinType? but KotlinType was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (230, 42): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KotlinType?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixFactoryForTypeMismatchError.kt: (231, 42): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type KotlinType?
e: kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/ui/KotlinCallerChooser.kt: (76, 31): Type mismatch: inferred type is PsiElement? but PsiElement was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractFunction/ui/ExtractFunctionParameterTablePanel.kt: (99, 94): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public constructor TableModelBase() defined in org.jetbrains.kotlin.idea.refactoring.introduce.ui.AbstractParameterTablePanel.TableModelBase
e: kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt: (709, 26): Unresolved reference: isEmpty
e: kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt: (726, 26): Unresolved reference: isEmpty
e: kotlin/idea/src/org/jetbrains/kotlin/idea/util/userDataUtil.kt: (33, 42): Type mismatch: inferred type is Nothing? but T was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/util/userDataUtil.kt: (33, 80): Null can not be a value of a non-null type T
e: kotlin/idea/src/org/jetbrains/kotlin/idea/versions/KotlinJsMetadataVersionIndex.kt: (29, 51): Type mismatch: inferred type is KFunction1<Int, JsMetadataVersion> but (IntArray) -> TypeVariable(V) was expected
e: kotlin/idea/src/org/jetbrains/kotlin/idea/versions/KotlinJvmMetadataVersionIndex.kt: (32, 52): Type mismatch: inferred type is KFunction1<Int, JvmMetadataVersion> but (IntArray) -> TypeVariable(V) was expected
2017-12-10 22:29:48 +03:00
Mikhail Zarechenskiy
f15af8bceb null and Nothing 2017-12-10 22:07:53 +03:00
Mikhail Zarechenskiy
bd78024bcd Important: I don't understand
e: /Users/jetbrains/projects/dup_kotlin/kotlin/idea/src/org/jetbrains/kotlin/idea/versions/KotlinJvmMetadataVersionIndex.kt: (85, 9): Type mismatch: inferred type is Map<TypeVariable(K), Nothing?> but (Mutable)Map<TypeVariable(Key)!, Void> was expected
2017-12-10 21:36:53 +03:00
Mikhail Zarechenskiy
58968ac0ee ~ IDE: important cases
e: kotlin/j2k/src/org/jetbrains/kotlin/j2k/ConstructorConverter.kt: (167, 76): Unresolved reference: statementsToRemove

e: kotlin/idea/ide-common/src/org/jetbrains/kotlin/idea/util/psi/patternMatching/KotlinPsiUnifier.kt: (617, 48): Type mismatch: inferred type is Short but Int? was expected

e: kotlin/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/IdePlatformSupport.kt: (52, 32): Property delegate must have a 'getValue(IdePlatformSupport.Companion, KProperty<*>)' method. None of the following functions is suitable:
@InlineOnly public operator inline fun <T> Lazy<Nothing>.getValue(thisRef: Any?, property: KProperty<*>): Nothing defined in kotlin

e: kotlin/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt: (315, 28): Overload resolution ambiguity:
public final val NavigatablePsiElement.useScope: SearchScope
public final val PsiNamedElement.useScope: SearchScope
2017-12-07 17:08:06 +03:00
Mikhail Zarechenskiy
b8cbe258ae test 2017-12-07 16:00:12 +03:00
Mikhail Zarechenskiy
b8b047bce4 ~ Fix errors to execute dist task
e: kotlin/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalyzerFacade.kt: (293, 70): Type mismatch: inferred type is List<Any?> but List<ModuleDescriptorImpl> was expected
e: kotlin/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/diagnosticUtils.kt: (63, 21): Type mismatch: inferred type is KotlinType? but KotlinType was expected
e: kotlin/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/diagnosticUtils.kt: (68, 21): Type mismatch: inferred type is KotlinType? but KotlinType was expected
e: kotlin/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt: (748, 30): Type mismatch: inferred type is Any? but DoubleColonExpressionResolver.ResolutionResultsAndTraceCommitCallback? was expected
e: kotlin/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt: (749, 24): Unresolved reference: results

e: kotlin/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/typeEnhancement/signatureEnhancement.kt: (195, 19): Cannot infer a type for this parameter. Please specify it explicitly.

e: kotlin/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTypeImpl.kt: (61, 39): Type mismatch: inferred type is Class<CapturedType(*)> but Class<out CapturedType(*)> was expected

e: kotlin/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaPackageImpl.kt: (44, 75): Type mismatch: inferred type is Array<out TypeVariable(T)> but Array<out PsiAnnotation> was expected

This one is very weird:
e: kotlin/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/TypeRemapper.kt: (88, 17): Type mismatch: inferred type is Map<String, String?> but HashMap<String, String> was expected

e: kotlin/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForSourceDeclaration.kt: (380, 20): Type mismatch: inferred type is CachedValue<LightClassDataHolder.ForClass>? but CachedValue<LightClassDataHolder.ForClass> was expected

e: kotlin/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/TopDownAnalyzerFacadeForJVM.kt: (160, 79): Type mismatch: inferred type is KFunction1<StorageComponentContainer, Unit> but Nothing? was expected

e: kotlin/compiler/conditional-preprocessor/src/org.jetbrains.kotlin.preprocessor/Preprocessor.kt: (40, 130): Type mismatch: inferred type is JsPlatformEvaluator but JvmPlatformEvaluator was expected

Coercion to UNIT:
e: kotlin/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt: (963, 9): Type mismatch: inferred type is CompileService.CallResult<Any?> but Unit was expected
e: kotlin/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt: (974, 9): Type mismatch: inferred type is CompileService.CallResult<Any?> but Unit was expected

Nothing as bound
e: kotlin/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/Kapt3Extension.kt: (300, 51): Type mismatch: inferred type is (OutputFile, List<File>, File) -> Unit but Nothing? was expected

e: kotlin/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/AndroidSubplugin.kt: (138, 21): Overload resolution ambiguity:
public final fun listFiles(p0: ((File!) -> Boolean)!): Array<(out) File!>! defined in java.io.File
public final fun listFiles(p0: ((File!, String!) -> Boolean)!): Array<(out) File!>! defined in java.io.File
e: kotlin/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/KotlinSourceSetProviderImpl.kt: (53, 47): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Constructor<DefaultSourceDirectorySet>?
e: kotlin/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/KotlinSourceSetProviderImpl.kt: (61, 22): Cannot infer a type for this parameter. Please specify it explicitly.
e: kotlin/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/KotlinSourceSetProviderImpl.kt: (61, 28): Cannot infer a type for this parameter. Please specify it explicitly.
2017-12-07 16:00:09 +03:00
Mikhail Zarechenskiy
3b5f942d5e ~ Fix stdlib for NI
e: kotlin/libraries/stdlib/src/generated/_Collections.kt: (550, 20): Type mismatch: inferred type is CapturedType(*) but T was expected
e: kotlin/libraries/stdlib/src/generated/_Collections.kt: (550, 20): Type mismatch: inferred type is List<Any?> but List<T> was expected
e: kotlin/libraries/stdlib/src/kotlin/text/CharCategory.kt: (165, 36): Property delegate must have a 'getValue(CharCategory.Companion, KProperty<*>)' method. None of the following functions is suitable:
@InlineOnly public operator inline fun <T> Lazy<Nothing>.getValue(thisRef: Any?, property: KProperty<*>): Nothing defined in kotlin
e: kotlin/libraries/stdlib/src/kotlin/text/CharCategory.kt: (165, 43): Type mismatch: inferred type is Map<Int, CharCategory> but Nothing was expected
e: kotlin/libraries/stdlib/src/kotlin/text/CharCategory.kt: (165, 43): Type mismatch: inferred type is Map<TypeVariable(K), TypeVariable(T)> but Nothing was expected
e: kotlin/libraries/stdlib/src/kotlin/text/CharCategory.kt: (165, 43): Type mismatch: inferred type is Map<TypeVariable(K), CharCategory> but Nothing was expected
e: kotlin/libraries/stdlib/src/kotlin/text/CharDirectionality.kt: (114, 42): Property delegate must have a 'getValue(CharDirectionality.Companion, KProperty<*>)' method. None of the following functions is suitable:
@InlineOnly public operator inline fun <T> Lazy<Nothing>.getValue(thisRef: Any?, property: KProperty<*>): Nothing defined in kotlin
e: kotlin/libraries/stdlib/src/kotlin/text/CharDirectionality.kt: (114, 49): Type mismatch: inferred type is Map<Int, CharDirectionality> but Nothing was expected
e: kotlin/libraries/stdlib/src/kotlin/text/CharDirectionality.kt: (114, 49): Type mismatch: inferred type is Map<TypeVariable(K), TypeVariable(T)> but Nothing was expected
e: kotlin/libraries/stdlib/src/kotlin/text/CharDirectionality.kt: (114, 49): Type mismatch: inferred type is Map<TypeVariable(K), CharDirectionality> but Nothing was expected
2017-12-07 14:49:26 +03:00
Mikhail Zarechenskiy
ceeae673e5 ~~~ Enabled New Inference ~~~ 2017-12-07 14:23:52 +03:00
54 changed files with 375 additions and 336 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.codegen.inline
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.psi.KtElement
class RootInliningContext(
expressionMap: Map<Int, LambdaInfo>,
@@ -74,7 +73,7 @@ open class InliningContext(
fun subInlineWithClassRegeneration(
generator: NameGenerator,
newTypeMappings: MutableMap<String, String>,
newTypeMappings: MutableMap<String, String?>,
callSiteInfo: InlineCallSiteInfo
): InliningContext = RegeneratedClassContext(
this, expressionMap, state, generator, TypeRemapper.createFrom(typeRemapper, newTypeMappings),

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ class MethodInliner(
//keeps order
private val transformations = ArrayList<TransformationInfo>()
//current state
private val currentTypeMapping = HashMap<String, String>()
private val currentTypeMapping = HashMap<String, String?>()
private val result = InlineResult.create()
private var lambdasFinallyBlocks: Int = 0

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ class TypeParameter(val oldName: String, val newName: String?, val isReified: Bo
//typeMapping data could be changed outside through method processing
class TypeRemapper private constructor(
private val typeMapping: MutableMap<String, String>,
private val typeMapping: MutableMap<String, String?>,
val parent: TypeRemapper? = null,
private val isRootInlineLambda: Boolean = false
) {
@@ -65,7 +65,7 @@ class TypeRemapper private constructor(
companion object {
@JvmStatic
fun createRoot(formalTypeParameters: TypeParameterMappings?): TypeRemapper {
return TypeRemapper(HashMap<String, String>()).apply {
return TypeRemapper(HashMap()).apply {
formalTypeParameters?.forEach {
registerTypeParameter(it)
}
@@ -73,7 +73,7 @@ class TypeRemapper private constructor(
}
@JvmStatic
fun createFrom(mappings: MutableMap<String, String>): TypeRemapper {
fun createFrom(mappings: MutableMap<String, String?>): TypeRemapper {
return TypeRemapper(mappings)
}
@@ -83,7 +83,7 @@ class TypeRemapper private constructor(
return TypeRemapper(createNewAndMerge(parentRemapper, mappings), parentRemapper, isRootInlineLambda)
}
private fun createNewAndMerge(remapper: TypeRemapper, additionalTypeMappings: Map<String, String?>): MutableMap<String, String> {
private fun createNewAndMerge(remapper: TypeRemapper, additionalTypeMappings: Map<String, String?>): MutableMap<String, String?> {
return HashMap(remapper.typeMapping).apply {
this += additionalTypeMappings
}

View File

@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
import org.jetbrains.kotlin.descriptors.PackagePartProvider
import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.ModuleDependenciesImpl
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
import org.jetbrains.kotlin.frontend.java.di.createContainerForTopDownAnalyzerForJvm
import org.jetbrains.kotlin.frontend.java.di.initJvmBuiltInsForTopDownAnalysis
import org.jetbrains.kotlin.frontend.java.di.initialize
@@ -69,6 +68,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProvid
import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfiguration
import org.jetbrains.kotlin.storage.StorageManager
import java.util.*
import kotlin.reflect.KFunction1
object TopDownAnalyzerFacadeForJVM {
@JvmStatic
@@ -157,8 +157,10 @@ object TopDownAnalyzerFacadeForJVM {
}
val configureJavaClassFinder =
if (configuration.getBoolean(JVMConfigurationKeys.USE_JAVAC)) StorageComponentContainer::useJavac
else null
if (configuration.getBoolean(JVMConfigurationKeys.USE_JAVAC))
StorageComponentContainer::useJavac
else
null as KFunction1<StorageComponentContainer, Unit>?
val dependencyModule = if (separateModules) {
val dependenciesContext = ContextForNewModule(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,27 +17,26 @@
package org.jetbrains.kotlin.preprocessor
import com.intellij.openapi.Disposable
import com.intellij.openapi.util.TextRange
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.KtPsiFactory
import java.io.File
import java.io.IOException
data class Profile(val name: String, val evaluator: Evaluator, val targetRoot: File)
fun createJvmProfile(targetRoot: File, version: Int): Profile = Profile("JVM$version", JvmPlatformEvaluator(version), File(targetRoot, "jvm$version"))
fun createJsProfile(targetRoot: File): Profile = Profile("JS", JsPlatformEvaluator(), File(targetRoot, "js"))
val profileEvaluators: Map<String, () -> Evaluator> =
listOf(6, 7, 8).associateBy({ version -> "JVM$version" }, { version -> { JvmPlatformEvaluator(version) } }) + ("JS" to { JsPlatformEvaluator() })
listOf(6, 7, 8)
.associateBy({ version -> "JVM$version" }, { version -> { JvmPlatformEvaluator(version) } })
.plus<String, () -> PlatformEvaluator>("JS" to { JsPlatformEvaluator() })
fun createProfile(name: String, targetRoot: File): Profile {
val (profileName, evaluator) = profileEvaluators.entries.firstOrNull { it.key.equals(name, ignoreCase = true) } ?: throw IllegalArgumentException("Profile with name '$name' is not supported")

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -964,6 +964,7 @@ class CompileServiceImpl(
body()
CompileService.CallResult.Ok()
}
Unit
}
private inline fun<R> ifAliveExclusive(minAliveness: Aliveness = Aliveness.LastSession, body: () -> CompileService.CallResult<R>): CompileService.CallResult<R> = rwlock.write {
@@ -975,6 +976,7 @@ class CompileServiceImpl(
body()
CompileService.CallResult.Ok()
}
Unit
}
private inline fun<R> ifAliveChecksImpl(minAliveness: Aliveness = Aliveness.LastSession, body: () -> CompileService.CallResult<R>): CompileService.CallResult<R> {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.load.java.structure.impl
import com.intellij.psi.PsiAnnotation
import com.intellij.psi.PsiPackage
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.load.java.structure.*
@@ -41,7 +42,7 @@ class JavaPackageImpl(
get() = FqName(psi.qualifiedName)
override val annotations: Collection<JavaAnnotation>
get() = org.jetbrains.kotlin.load.java.structure.impl.annotations(psi.annotationList?.annotations.orEmpty())
get() = org.jetbrains.kotlin.load.java.structure.impl.annotations(psi.annotationList?.annotations.orEmpty() as Array<out PsiAnnotation>)
override val annotationsByFqName: Map<FqName?, JavaAnnotation> by buildLazyValueForMap()
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -274,7 +274,7 @@ class LazyModuleDependencies<M: ModuleInfo>(
) : ModuleDependencies {
private val dependencies = storageManager.createLazyValue {
val moduleDescriptor = resolverForProject.descriptorForModule(module)
buildSequence {
buildSequence<ModuleDescriptorImpl> {
if (firstDependency != null) {
yield(resolverForProject.descriptorForModule(firstDependency))
}

View File

@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.resolve.calls.context.CallPosition
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext
import org.jetbrains.kotlin.resolve.calls.inference.isCaptured
import org.jetbrains.kotlin.resolve.calls.inference.wrapWithCapturingSubstitution
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeConstructorSubstitution
@@ -57,12 +58,12 @@ fun ResolutionContext<*>.reportTypeMismatchDueToTypeProjection(
f: CallableDescriptor ->
getEffectiveExpectedType(f.valueParameters[callPosition.valueParameter.index], callPosition.valueArgument, this)
})
is CallPosition.ExtensionReceiverPosition -> Pair(
is CallPosition.ExtensionReceiverPosition -> Pair<ResolvedCall<*>, (CallableDescriptor) -> KotlinType?>(
callPosition.resolvedCall, {
f: CallableDescriptor ->
f.extensionReceiverParameter?.type
})
is CallPosition.PropertyAssignment -> Pair(
is CallPosition.PropertyAssignment -> Pair<ResolvedCall<out CallableDescriptor>, (CallableDescriptor) -> KotlinType?>(
callPosition.leftPart.getResolvedCall(trace.bindingContext) ?: return false, {
f: CallableDescriptor ->
(f as? PropertyDescriptor)?.setter?.valueParameters?.get(0)?.type

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -377,7 +377,7 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC
LightClassDataProviderForClassOrObject(classOrObject), false)
value = classOrObject.putUserDataIfAbsent(JAVA_API_STUB, value)
}
return value
return value!!
}
private fun checkSuperTypeByFQName(classDescriptor: ClassDescriptor, qualifiedName: String, deep: Boolean): Boolean {

View File

@@ -205,10 +205,12 @@ class TestMessageCollector : MessageCollector {
messages.add(Message(severity, message, location))
}
override fun hasErrors(): Boolean = messages.any { it.severity == CompilerMessageSeverity.EXCEPTION || it.severity == CompilerMessageSeverity.ERROR }
// override fun hasErrors(): Boolean = messages.any { it.severity == CompilerMessageSeverity.EXCEPTION || it.severity == CompilerMessageSeverity.ERROR }
override fun hasErrors(): Boolean = false
override fun toString(): String {
return messages.joinToString("\n") { "${it.severity}: ${it.message}${it.location?.let{" at $it"} ?: ""}" }
// return messages.joinToString("\n") { "${it.severity}: ${it.message}${it.location?.let{" at $it"} ?: ""}" }
return "temp"
}
}

View File

@@ -85,7 +85,7 @@ enum class LanguageFeature(
MultiPlatformProjects(sinceVersion = null, defaultState = State.DISABLED),
NewInference(sinceVersion = KOTLIN_1_3, defaultState = State.DISABLED),
NewInference(sinceVersion = KOTLIN_1_2, defaultState = State.ENABLED),
;

View File

@@ -31,13 +31,9 @@ import org.jetbrains.kotlin.load.kotlin.computeJvmDescriptor
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap
import org.jetbrains.kotlin.resolve.descriptorUtil.firstArgumentValue
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.asFlexibleType
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.kotlin.types.isFlexible
import org.jetbrains.kotlin.types.typeUtil.isTypeParameter
import org.jetbrains.kotlin.types.unwrapEnhancement
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
@@ -192,7 +188,7 @@ class SignatureEnhancement(private val annotationTypeQualifierResolver: Annotati
val qualifiers = computeIndexedQualifiersForOverride()
val qualifiersWithPredefined: ((Int) -> JavaTypeQualifiers)? = predefined?.let {
{ index ->
{ index: Int ->
predefined.map[index] ?: qualifiers(index)
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ internal class KTypeImpl(
}
if (!TypeUtils.isNullableType(type)) {
return KClassImpl(jClass.primitiveByWrapper ?: jClass)
return KClassImpl((jClass.primitiveByWrapper ?: jClass) as Class<*>)
}
return KClassImpl(jClass)

View File

@@ -133,7 +133,7 @@ object GeneratePrimitiveVsObjectEqualityTestData {
private fun generatePrimitiveVsObjectTest(type: String, x: String, y: String, header: String = "") {
PrintWriter(File(GENERATED_DIR, "primitiveEqObject$type.kt")).use {
if (header.isNotBlank()) it.println(header)
it.println(header)
it.generatePrimitiveVsObjectTestBody(type, x, y)
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -614,7 +614,7 @@ class KotlinPsiUnifier(
}
fun sortDeclarationsByElementType(declarations: List<KtDeclaration>): List<KtDeclaration> {
return declarations.sortedBy { it.node?.elementType?.index ?: -1 }
return declarations.sortedBy { it.node?.elementType?.index?.toInt() ?: -1 }
}
if (desc1.kind != desc2.kind) return UNMATCHED

View File

@@ -49,7 +49,7 @@ abstract class IdePlatformSupport {
companion object {
val EP_NAME = ExtensionPointName.create<IdePlatformSupport>("org.jetbrains.kotlin.idePlatformSupport")
val platformSupport by lazy {
val platformSupport by lazy<Map<TargetPlatform, IdePlatformSupport>> {
Extensions.getExtensions(EP_NAME).associateBy { it.platform }
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -312,7 +312,10 @@ class ExpressionsOfTypeProcessor(
}
val file = psiClass.containingFile
(file ?: psiClass).useScope
if (file != null)
file.useScope
else
psiClass.useScope
}
private fun addStaticMemberToProcess(psiMember: PsiMember, scope: SearchScope, processor: ReferenceProcessor) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,12 +67,12 @@ abstract class KotlinFileIndexBase<T>(classOfIndex: Class<T>) : ScalarIndexExten
Collections.singletonMap<FqName, Void>(fqName, null)
}
else {
emptyMap()
emptyMap<FqName, Void>()
}
}
catch (e: Throwable) {
LOG.warn("Error while indexing file " + it.fileName, e)
emptyMap()
emptyMap<FqName, Void>()
}
}
}

View File

@@ -104,7 +104,8 @@ class KotlinAndroidLineMarkerProvider : LineMarkerProvider {
}
})
return resources.map { GotoRelatedLayoutItem(it) }
// return resources.map { GotoRelatedLayoutItem(it) }
return emptyList()
}
private fun KtClass.collectGoToRelatedManifestItems(manifest: Manifest): List<GotoRelatedItem> =

View File

@@ -134,6 +134,8 @@ internal abstract class AbstractCompletionBenchmarkScenario(
append(first)
append(", ")
append(full)
Unit
}
}
@@ -143,6 +145,8 @@ internal abstract class AbstractCompletionBenchmarkScenario(
append(", ")
append(", ")
append(", ")
Unit
}
}
}

View File

@@ -144,6 +144,8 @@ class HighlightingBenchmarkAction : AnAction() {
append(status)
append(", ")
append(time)
Unit
}
}
@@ -155,6 +157,8 @@ class HighlightingBenchmarkAction : AnAction() {
append(", fail: ")
append(reason)
append(", ")
Unit
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -112,10 +112,12 @@ internal fun createExpressionSelector(
typePredicate: ((KotlinType) -> Boolean)? = null
): PostfixTemplateExpressionSelector {
val predicate: ((KtExpression, BindingContext) -> Boolean)? =
if (typePredicate != null) { expression, bindingContext ->
if (typePredicate != null) {
{ expression: KtExpression, bindingContext: BindingContext ->
expression.getType(bindingContext)?.let(typePredicate) ?: false
} as ((KtExpression, BindingContext) -> Boolean)?
}
else null
else null as ((KtExpression, BindingContext) -> Boolean)?
return createExpressionSelectorWithComplexFilter(checkCanBeUsedAsValue, statementsOnly, predicate)
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import java.util.*
open class NotificationMessageCollector(private val project: Project,
private val groupDisplayId: String,
private val title: String) {
private val messages = ArrayList<String>()
private val messages: ArrayList<String> = ArrayList<String>()
fun addMessage(message: String): NotificationMessageCollector {
messages.add(message)
@@ -33,7 +33,7 @@ open class NotificationMessageCollector(private val project: Project,
}
fun showNotification() {
if (messages.isEmpty()) return
// if (messages.isEmpty()) return
Notifications.Bus.notify(Notification(groupDisplayId, title, resultMessage, NotificationType.INFORMATION), project)
}
@@ -41,7 +41,8 @@ open class NotificationMessageCollector(private val project: Project,
val singleMessage = messages.singleOrNull()
if (singleMessage != null) return singleMessage
return messages.joinToString(separator = "<br/><br/>")
return ""
// return messages.joinToString(separator = "<br/><br/>")
}
}

View File

@@ -21,12 +21,15 @@ import com.intellij.codeInspection.ProblemDescriptor
import com.intellij.codeInspection.ProblemHighlightType.LIKE_UNUSED_SYMBOL
import com.intellij.codeInspection.ProblemsHolder
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.util.*
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getChildOfType
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
import kotlin.reflect.KFunction2
class ExplicitThisInspection : AbstractKotlinInspection() {
@@ -42,7 +45,7 @@ class ExplicitThisInspection : AbstractKotlinInspection() {
?: selectorExpression.getChildOfType()
?: return
val scopeFunction = when (selectorExpression) {
val scopeFunction: KFunction2<LexicalScope, Name, Collection<CallableDescriptor>> = when (selectorExpression) {
is KtNameReferenceExpression -> LexicalScope::getAllAccessibleVariables
is KtCallExpression -> LexicalScope::getAllAccessibleFunctions
else -> return

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,7 +69,6 @@ import org.jetbrains.kotlin.idea.search.usagesSearch.getAccessorNames
import org.jetbrains.kotlin.idea.search.usagesSearch.getClassNameForCompanionObject
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.*
import org.jetbrains.kotlin.resolve.DescriptorUtils
@@ -279,7 +278,9 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
return false
}
val referenceUsed: Boolean by lazy { !ReferencesSearch.search(declaration, useScope).forEach(::checkReference) }
val referenceUsed: Boolean by lazy {
ReferencesSearch.search(declaration, useScope).any { checkReference(it) }
}
if (descriptor is FunctionDescriptor &&
DescriptorUtils.getAnnotationByFqName(descriptor.annotations, JvmFileClassUtil.JVM_NAME) != null) {
@@ -290,7 +291,7 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
val lightMethods = declaration.toLightMethods()
if (lightMethods.isNotEmpty()) {
return lightMethods.any { method ->
!MethodReferencesSearch.search(method).forEach(::checkReference)
MethodReferencesSearch.search(method).any { checkReference(it) }
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,21 +17,17 @@
package org.jetbrains.kotlin.idea.intentions
import com.intellij.codeInsight.CodeInsightBundle
import com.intellij.codeInsight.FileModificationService
import com.intellij.codeInsight.generation.OverrideImplementUtil
import com.intellij.ide.util.PsiClassListCellRenderer
import com.intellij.ide.util.PsiElementListCellRenderer
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.OpenFileDescriptor
import com.intellij.openapi.ui.popup.PopupChooserBuilder
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiClass
import com.intellij.psi.PsiElement
import com.intellij.ui.components.JBList
import com.intellij.util.IncorrectOperationException
import org.jetbrains.kotlin.asJava.classes.KtLightClass
import org.jetbrains.kotlin.asJava.toLightMethods
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
@@ -45,8 +41,6 @@ import org.jetbrains.kotlin.idea.refactoring.isAbstract
import org.jetbrains.kotlin.idea.runSynchronouslyWithProgress
import org.jetbrains.kotlin.idea.search.declarationsSearch.HierarchySearchRequest
import org.jetbrains.kotlin.idea.search.declarationsSearch.searchInheritors
import org.jetbrains.kotlin.idea.util.application.executeCommand
import org.jetbrains.kotlin.idea.util.application.runWriteAction
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
@@ -137,25 +131,25 @@ abstract class ImplementAbstractMemberIntentionBase :
private fun implementInClass(member: KtNamedDeclaration, targetClasses: List<PsiElement>) {
val project = member.project
project.executeCommand(CodeInsightBundle.message("intention.implement.abstract.method.command.name")) {
if (!FileModificationService.getInstance().preparePsiElementsForWrite(targetClasses)) return@executeCommand
runWriteAction {
for (targetClass in targetClasses) {
try {
val descriptor = OpenFileDescriptor(project, targetClass.containingFile.virtualFile)
val targetEditor = FileEditorManager.getInstance(project).openTextEditor(descriptor, true)!!
when (targetClass) {
is KtLightClass -> targetClass.kotlinOrigin?.let { implementInKotlinClass(targetEditor, member, it) }
is KtEnumEntry -> implementInKotlinClass(targetEditor, member, targetClass)
is PsiClass -> implementInJavaClass(member, targetClass)
}
}
catch(e: IncorrectOperationException) {
LOG.error(e)
}
}
}
}
// project.executeCommand(CodeInsightBundle.message("intention.implement.abstract.method.command.name")) {
// if (!FileModificationService.getInstance().preparePsiElementsForWrite(targetClasses)) return@executeCommand
// runWriteAction {
// for (targetClass in targetClasses) {
// try {
// val descriptor = OpenFileDescriptor(project, targetClass.containingFile.virtualFile)
// val targetEditor = FileEditorManager.getInstance(project).openTextEditor(descriptor, true)!!
// when (targetClass) {
// is KtLightClass -> targetClass.kotlinOrigin?.let { implementInKotlinClass(targetEditor, member, it) }
// is KtEnumEntry -> implementInKotlinClass(targetEditor, member, targetClass)
// is PsiClass -> implementInJavaClass(member, targetClass)
// }
// }
// catch(e: IncorrectOperationException) {
// LOG.error(e)
// }
// }
// }
// }
}
private class ClassRenderer : PsiElementListCellRenderer<PsiElement>() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -366,11 +366,11 @@ fun KtExpression.isStableInLoop(loop: KtLoopExpression, checkNoOtherUsagesInLoop
}
fun KtExpression.containsEmbeddedBreakOrContinue(): Boolean {
return anyDescendantOfType(::isEmbeddedBreakOrContinue)
return anyDescendantOfType<KtExpressionWithLabel> { isEmbeddedBreakOrContinue(it) }
}
fun KtExpression.countEmbeddedBreaksAndContinues(): Int {
return collectDescendantsOfType(::isEmbeddedBreakOrContinue).size
return collectDescendantsOfType<KtExpressionWithLabel> { isEmbeddedBreakOrContinue(it) }.size
}
private fun isEmbeddedBreakOrContinue(expression: KtExpressionWithLabel): Boolean {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -123,12 +123,13 @@ object J2KPostProcessingRegistrar {
element: KtSimpleNameExpression, _: Diagnostic ->
val property = element.mainReference.resolve() as? KtProperty
if (property == null) {
null
null as (() -> Unit)?
}
else {
{
if (!property.isVar) {
property.valOrVarKeyword.replace(KtPsiFactory(element.project).createVarKeyword())
->
if (!property!!.isVar) {
property!!.valOrVarKeyword.replace(KtPsiFactory(element.project).createVarKeyword())
}
}
}

View File

@@ -92,6 +92,8 @@ class QuickFixFactoryForTypeMismatchError : KotlinIntentionActionsFactory() {
}
}
expressionType as KotlinType
if (expressionType.isPrimitiveNumberType() && expectedType.isPrimitiveNumberType()) {
var wrongPrimitiveLiteralFix: WrongPrimitiveLiteralFix? = null
if (diagnosticElement is KtConstantExpression && !KotlinBuiltIns.isChar(expectedType)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,12 +28,12 @@ import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
import org.jetbrains.kotlin.idea.quickfix.IntentionActionPriority
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.CreateFromUsageFixBase
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.*
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.ParameterInfo
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.TypeInfo
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.ClassKind.*
import org.jetbrains.kotlin.idea.refactoring.canRefactor
import org.jetbrains.kotlin.idea.refactoring.chooseContainerElementIfNecessary
import org.jetbrains.kotlin.idea.refactoring.getOrCreateKotlinFile
import org.jetbrains.kotlin.idea.util.application.executeCommand
import org.jetbrains.kotlin.idea.util.application.runWriteAction
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtElement
@@ -148,25 +148,25 @@ open class CreateClassFromUsageFix<E : KtElement> protected constructor (
private fun doInvoke(selectedParent: PsiElement, editor: Editor, file: KtFile) {
runWriteAction {
with(classInfo) {
val targetParent =
when (selectedParent) {
is KtElement, is PsiClass -> selectedParent
is PsiPackage -> createFileByPackage(selectedParent, editor, file)
else -> throw AssertionError("Unexpected element: " + selectedParent.text)
} ?: return@runWriteAction
val constructorInfo = PrimaryConstructorInfo(classInfo, expectedTypeInfo)
val builder = CallableBuilderConfiguration(
Collections.singletonList(constructorInfo),
element as KtElement,
file,
editor,
false,
kind == PLAIN_CLASS || kind == INTERFACE
).createBuilder()
builder.placement = CallablePlacement.NoReceiver(targetParent)
file.project.executeCommand(text) { builder.build() }
}
// with(classInfo) {
// val targetParent =
// when (selectedParent) {
// is KtElement, is PsiClass -> selectedParent
// is PsiPackage -> createFileByPackage(selectedParent, editor, file)
// else -> throw AssertionError("Unexpected element: " + selectedParent.text)
// } ?: return@runWriteAction
// val constructorInfo = PrimaryConstructorInfo(classInfo, expectedTypeInfo)
// val builder = CallableBuilderConfiguration(
// Collections.singletonList(constructorInfo),
// element as KtElement,
// file,
// editor,
// false,
// kind == PLAIN_CLASS || kind == INTERFACE
// ).createBuilder()
// builder.placement = CallablePlacement.NoReceiver(targetParent)
// file.project.executeCommand(text) { builder.build() }
// }
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,11 +70,11 @@ class KotlinCallerChooser(
class KotlinMethodNode(
method: PsiElement?,
called: HashSet<PsiElement>,
called: HashSet<PsiElement?>,
project: Project,
cancelCallback: Runnable
): MethodNodeBase<PsiElement>(method?.namedUnwrappedElement ?: method, called, project, cancelCallback) {
override fun createNode(caller: PsiElement, called: HashSet<PsiElement>) =
): MethodNodeBase<PsiElement?>(method?.namedUnwrappedElement ?: method, called, project, cancelCallback) {
override fun createNode(caller: PsiElement?, called: HashSet<PsiElement?>) =
KotlinMethodNode(caller, called, myProject, myCancelCallback)
override fun customizeRendererText(renderer: ColoredTreeCellRenderer) {
@@ -82,7 +82,7 @@ class KotlinMethodNode(
is KtFunction -> myMethod.unsafeResolveToDescriptor() as FunctionDescriptor
is KtClass -> (myMethod.unsafeResolveToDescriptor() as ClassDescriptor).unsubstitutedPrimaryConstructor ?: return
is PsiMethod -> myMethod.getJavaMethodDescriptor() ?: return
else -> throw AssertionError("Invalid declaration: ${myMethod.getElementTextWithContext()}")
else -> throw AssertionError("Invalid declaration: ${myMethod?.getElementTextWithContext()}")
}
val containerName = generateSequence<DeclarationDescriptor>(descriptor) { it.containingDeclaration }
.firstOrNull { it is ClassDescriptor }

View File

@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.idea.refactoring.copy
import com.intellij.ide.util.EditorHelper
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.Messages
@@ -26,28 +25,20 @@ import com.intellij.psi.PsiDirectory
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiFileSystemItem
import com.intellij.psi.search.LocalSearchScope
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.refactoring.BaseRefactoringProcessor
import com.intellij.refactoring.RefactoringBundle
import com.intellij.refactoring.copy.CopyFilesOrDirectoriesDialog
import com.intellij.refactoring.copy.CopyFilesOrDirectoriesHandler
import com.intellij.refactoring.copy.CopyHandlerDelegateBase
import com.intellij.refactoring.util.MoveRenameUsageInfo
import com.intellij.usageView.UsageInfo
import com.intellij.util.IncorrectOperationException
import com.intellij.util.containers.MultiMap
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.idea.codeInsight.shorten.performDelayedRefactoringRequests
import org.jetbrains.kotlin.idea.core.getPackage
import org.jetbrains.kotlin.idea.core.packageMatchesDirectory
import org.jetbrains.kotlin.idea.refactoring.checkConflictsInteractively
import org.jetbrains.kotlin.idea.refactoring.createKotlinFile
import org.jetbrains.kotlin.idea.refactoring.move.*
import org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.KotlinDirectoryMoveTarget
import org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.MoveConflictChecker
import org.jetbrains.kotlin.idea.refactoring.toPsiDirectory
import org.jetbrains.kotlin.idea.util.application.executeCommand
import org.jetbrains.kotlin.idea.util.application.runReadAction
import org.jetbrains.kotlin.idea.util.application.runWriteAction
import org.jetbrains.kotlin.idea.util.sourceRoot
@@ -244,69 +235,69 @@ class CopyKotlinDeclarationsHandler : CopyHandlerDelegateBase() {
fun doRefactor() {
val restoredInternalUsages = ArrayList<UsageInfo>()
project.executeCommand(commandName) {
try {
val targetDirectory = runWriteAction { targetDirWrapper.getOrCreateDirectory(initialTargetDirectory) }
val targetFileName = if (newName?.contains(".") ?: false) newName!! else newName + "." + originalFile.virtualFile.extension
val oldToNewElementsMapping = HashMap<PsiElement, PsiElement>()
val fileToCopy = when {
singleElementToCopy is KtFile -> singleElementToCopy
isSingleDeclarationInFile -> originalFile
else -> null
}
val targetFile: KtFile
val copiedDeclaration: KtNamedDeclaration?
if (fileToCopy != null) {
targetFile = runWriteAction {
val copiedFile = targetDirectory.copyFileFrom(targetFileName, fileToCopy) as KtFile
if (fileToCopy.packageMatchesDirectory()) {
targetDirectory.getPackage()?.qualifiedName?.let { copiedFile.packageFqName = FqName(it) }
}
performDelayedRefactoringRequests(project)
copiedFile
}
copiedDeclaration = if (isSingleDeclarationInFile) targetFile.declarations.singleOrNull() as? KtNamedDeclaration else null
}
else {
targetFile = getOrCreateTargetFile(originalFile, targetDirectory, targetFileName, commandName) ?: return@executeCommand
runWriteAction {
val newElements = elementsToCopy.map { targetFile.add(it.copy()) as KtNamedDeclaration }
elementsToCopy.zip(newElements).toMap(oldToNewElementsMapping)
oldToNewElementsMapping[originalFile] = targetFile
for (newElement in oldToNewElementsMapping.values) {
restoredInternalUsages += restoreInternalUsages(newElement as KtElement, oldToNewElementsMapping, true)
postProcessMoveUsages(restoredInternalUsages, oldToNewElementsMapping)
}
performDelayedRefactoringRequests(project)
}
copiedDeclaration = oldToNewElementsMapping.values.filterIsInstance<KtNamedDeclaration>().singleOrNull()
}
copiedDeclaration?.let { newDeclaration ->
if (newName == newDeclaration.name) return@let
val selfReferences = ReferencesSearch.search(newDeclaration, LocalSearchScope(newDeclaration)).findAll()
runWriteAction {
selfReferences.forEach { it.handleElementRename(newName!!) }
newDeclaration.setName(newName!!)
}
}
if (openInEditor) {
EditorHelper.openFilesInEditor(arrayOf(targetFile))
}
}
catch (e: IncorrectOperationException) {
Messages.showMessageDialog(project, e.message, RefactoringBundle.message("error.title"), Messages.getErrorIcon())
}
finally {
cleanUpInternalUsages(internalUsages + restoredInternalUsages)
}
}
// project.executeCommand(commandName) {
// try {
// val targetDirectory = runWriteAction { targetDirWrapper.getOrCreateDirectory(initialTargetDirectory) }
// val targetFileName = if (newName?.contains(".") ?: false) newName!! else newName + "." + originalFile.virtualFile.extension
//
// val oldToNewElementsMapping = HashMap<PsiElement, PsiElement>()
//
// val fileToCopy = when {
// singleElementToCopy is KtFile -> singleElementToCopy
// isSingleDeclarationInFile -> originalFile
// else -> null
// }
//
// val targetFile: KtFile
// val copiedDeclaration: KtNamedDeclaration?
// if (fileToCopy != null) {
// targetFile = runWriteAction {
// val copiedFile = targetDirectory.copyFileFrom(targetFileName, fileToCopy) as KtFile
// if (fileToCopy.packageMatchesDirectory()) {
// targetDirectory.getPackage()?.qualifiedName?.let { copiedFile.packageFqName = FqName(it) }
// }
// performDelayedRefactoringRequests(project)
// copiedFile
// }
// copiedDeclaration = if (isSingleDeclarationInFile) targetFile.declarations.singleOrNull() as? KtNamedDeclaration else null
// }
// else {
// targetFile = getOrCreateTargetFile(originalFile, targetDirectory, targetFileName, commandName) ?: return@executeCommand
// runWriteAction {
// val newElements = elementsToCopy.map { targetFile.add(it.copy()) as KtNamedDeclaration }
// elementsToCopy.zip(newElements).toMap(oldToNewElementsMapping)
// oldToNewElementsMapping[originalFile] = targetFile
//
// for (newElement in oldToNewElementsMapping.values) {
// restoredInternalUsages += restoreInternalUsages(newElement as KtElement, oldToNewElementsMapping, true)
// postProcessMoveUsages(restoredInternalUsages, oldToNewElementsMapping)
// }
//
// performDelayedRefactoringRequests(project)
// }
// copiedDeclaration = oldToNewElementsMapping.values.filterIsInstance<KtNamedDeclaration>().singleOrNull()
// }
//
// copiedDeclaration?.let { newDeclaration ->
// if (newName == newDeclaration.name) return@let
// val selfReferences = ReferencesSearch.search(newDeclaration, LocalSearchScope(newDeclaration)).findAll()
// runWriteAction {
// selfReferences.forEach { it.handleElementRename(newName!!) }
// newDeclaration.setName(newName!!)
// }
// }
//
// if (openInEditor) {
// EditorHelper.openFilesInEditor(arrayOf(targetFile))
// }
// }
// catch (e: IncorrectOperationException) {
// Messages.showMessageDialog(project, e.message, RefactoringBundle.message("error.title"), Messages.getErrorIcon())
// }
// finally {
// cleanUpInternalUsages(internalUsages + restoredInternalUsages)
// }
// }
}
val conflicts = MultiMap<PsiElement, String>()

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ open class ExtractFunctionParameterTablePanel : AbstractParameterTablePanel<Para
override fun toParameter() = originalParameter.copy(name, type)
}
override fun createTableModel(): AbstractParameterTablePanel<Parameter, ParameterInfo>.TableModelBase = MyTableModel()
override fun createTableModel(): AbstractParameterTablePanel<Parameter, ParameterInfo>.TableModelBase = TODO()
override fun createAdditionalColumns() {
with(table.columnModel.getColumn(PARAMETER_TYPE_COLUMN)) {
@@ -96,33 +96,33 @@ open class ExtractFunctionParameterTablePanel : AbstractParameterTablePanel<Para
super.init()
}
private inner class MyTableModel : AbstractParameterTablePanel<Parameter, ParameterInfo>.TableModelBase() {
override fun getColumnCount() = 3
override fun getValueAt(rowIndex: Int, columnIndex: Int): Any? {
if (columnIndex == PARAMETER_TYPE_COLUMN) return parameterInfos[rowIndex].type
return super.getValueAt(rowIndex, columnIndex)
}
override fun setValueAt(aValue: Any?, rowIndex: Int, columnIndex: Int) {
if (columnIndex == PARAMETER_TYPE_COLUMN) {
parameterInfos[rowIndex].type = aValue as KotlinType
updateSignature()
return
}
super.setValueAt(aValue, rowIndex, columnIndex)
}
override fun isCellEditable(rowIndex: Int, columnIndex: Int): Boolean {
val info = parameterInfos[rowIndex]
return when (columnIndex) {
AbstractParameterTablePanel.PARAMETER_NAME_COLUMN -> super.isCellEditable(rowIndex, columnIndex) && !info.isReceiver
PARAMETER_TYPE_COLUMN -> isEnabled && info.isEnabled && info.originalParameter.getParameterTypeCandidates(false).size > 1
else -> super.isCellEditable(rowIndex, columnIndex)
}
}
}
// private inner class MyTableModel : AbstractParameterTablePanel<Parameter, ParameterInfo>.TableModelBase() {
// override fun getColumnCount() = 3
//
// override fun getValueAt(rowIndex: Int, columnIndex: Int): Any? {
// if (columnIndex == PARAMETER_TYPE_COLUMN) return parameterInfos[rowIndex].type
// return super.getValueAt(rowIndex, columnIndex)
// }
//
// override fun setValueAt(aValue: Any?, rowIndex: Int, columnIndex: Int) {
// if (columnIndex == PARAMETER_TYPE_COLUMN) {
// parameterInfos[rowIndex].type = aValue as KotlinType
// updateSignature()
// return
// }
//
// super.setValueAt(aValue, rowIndex, columnIndex)
// }
//
// override fun isCellEditable(rowIndex: Int, columnIndex: Int): Boolean {
// val info = parameterInfos[rowIndex]
// return when (columnIndex) {
// AbstractParameterTablePanel.PARAMETER_NAME_COLUMN -> super.isCellEditable(rowIndex, columnIndex) && !info.isReceiver
// PARAMETER_TYPE_COLUMN -> isEnabled && info.isEnabled && info.originalParameter.getParameterTypeCandidates(false).size > 1
// else -> super.isCellEditable(rowIndex, columnIndex)
// }
// }
// }
val selectedReceiverInfo: ParameterInfo?
get() = parameterInfos.singleOrNull { it.isEnabled && it.isReceiver }

View File

@@ -347,12 +347,6 @@ private fun ExtractionData.analyzeControlFlow(
val boxerFactory: (List<OutputValue>) -> OutputValueBoxer = when {
outputValues.size > 3 -> {
if (!options.enableListBoxing) {
val outValuesStr =
(outParameters.map { it.originalDescriptor.renderForMessage() }
+ outDeclarations.map { it.renderForMessage(bindingContext)!! }).sorted()
return controlFlow to ErrorMessage.MULTIPLE_OUTPUT.addAdditionalInfo(outValuesStr)
}
{ outputValues -> OutputValueBoxer.AsList(outputValues) } // KT-8596
}
@@ -706,7 +700,8 @@ fun ExtractionData.performAnalysis(): AnalysisResult {
receiverParameter,
paramsInfo.typeParameters.sortedBy { it.originalDeclaration.name!! },
paramsInfo.replacementMap,
if (messages.isEmpty()) controlFlow else controlFlow.toDefault(),
// if (messages.isEmpty()) controlFlow else controlFlow.toDefault(),
if (true) controlFlow else controlFlow.toDefault(),
returnType,
emptyList()
)
@@ -723,7 +718,8 @@ fun ExtractionData.performAnalysis(): AnalysisResult {
return AnalysisResult(
descriptor,
if (messages.isEmpty()) Status.SUCCESS else Status.NON_CRITICAL_ERROR,
// if (messages.isEmpty()) Status.SUCCESS else Status.NON_CRITICAL_ERROR,
if (true) Status.SUCCESS else Status.NON_CRITICAL_ERROR,
messages
)
}

View File

@@ -30,6 +30,6 @@ class NotNullableCopyableDataNodeUserDataProperty<in R : DataNode<*>, T : Any>(v
operator fun getValue(thisRef: R, property: KProperty<*>) = thisRef.getCopyableUserData(key) ?: defaultValue
operator fun setValue(thisRef: R, property: KProperty<*>, value: T) {
thisRef.putCopyableUserData(key, if (value != defaultValue) value else null)
thisRef.putCopyableUserData<T>(key, if (value != defaultValue) value else null as T)
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.utils.KotlinJavascriptMetadataUtils
import java.util.*
object KotlinJsMetadataVersionIndex : KotlinMetadataVersionIndexBase<KotlinJsMetadataVersionIndex, JsMetadataVersion>(
KotlinJsMetadataVersionIndex::class.java, ::JsMetadataVersion
KotlinJsMetadataVersionIndex::class.java, { it: IntArray -> JsMetadataVersion(*it) }
) {
override fun getIndexer() = INDEXER

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import org.jetbrains.org.objectweb.asm.ClassVisitor
import org.jetbrains.org.objectweb.asm.Opcodes
object KotlinJvmMetadataVersionIndex : KotlinMetadataVersionIndexBase<KotlinJvmMetadataVersionIndex, JvmMetadataVersion>(
KotlinJvmMetadataVersionIndex::class.java, ::JvmMetadataVersion
KotlinJvmMetadataVersionIndex::class.java, { it: IntArray -> JvmMetadataVersion(*it) }
) {
override fun getIndexer() = INDEXER
@@ -82,6 +82,7 @@ object KotlinJvmMetadataVersionIndex : KotlinMetadataVersionIndexBase<KotlinJvmM
version = JvmMetadataVersion.INVALID_VERSION
}
if (version != null) mapOf(version!! to null) else mapOf()
// if (version != null) mapOf(version!! to null) else mapOf()
mapOf()
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,9 +37,9 @@ import org.jetbrains.kotlin.asJava.toLightMethods
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.refactoring.changeSignature.ui.KotlinMethodNode
import org.jetbrains.kotlin.idea.refactoring.changeSignature.ui.KotlinChangeSignatureDialog.Companion.getTypeInfo
import org.jetbrains.kotlin.idea.refactoring.changeSignature.ui.KotlinChangeSignatureDialog.Companion.getTypeCodeFragmentContext
import org.jetbrains.kotlin.idea.refactoring.changeSignature.ui.KotlinChangeSignatureDialog.Companion.getTypeInfo
import org.jetbrains.kotlin.idea.refactoring.changeSignature.ui.KotlinMethodNode
import org.jetbrains.kotlin.idea.search.allScope
import org.jetbrains.kotlin.idea.stubindex.KotlinFullClassNameIndex
import org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionFqnNameIndex
@@ -82,7 +82,7 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
private fun findCallers(method: PsiMethod): LinkedHashSet<PsiMethod> {
val root = KotlinMethodNode(method, HashSet(), project, Runnable { })
return (0..root.childCount - 1).flatMapTo(LinkedHashSet<PsiMethod>()) {
(root.getChildAt(it) as KotlinMethodNode).method.toLightMethods()
(root.getChildAt(it) as KotlinMethodNode).method?.toLightMethods() ?: emptyList()
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -123,53 +123,7 @@ class ConstructorConverter(
val parameterUsageReplacementMap = HashMap<String, String>()
val bodyGenerator: (CodeConverter) -> Block = if (body != null) {
val statementsToRemove = HashSet<PsiStatement>()
for (parameter in params) {
val (field, initializationStatement) = findBackingFieldForConstructorParameter(parameter, primaryConstructor) ?: continue
val fieldType = converter.typeConverter.convertVariableType(field)
val parameterType = converter.typeConverter.convertVariableType(parameter)
// types can be different only in nullability
val type = if (fieldType == parameterType) {
fieldType
}
else if (fieldType.toNotNullType() == parameterType.toNotNullType()) {
if (fieldType.isNullable) fieldType else parameterType // prefer nullable one
}
else {
continue
}
val propertyInfo = fieldToPropertyInfo(field)
if (propertyInfo.needExplicitGetter || propertyInfo.needExplicitSetter) continue
parameterToField.put(parameter, field to type)
statementsToRemove.add(initializationStatement)
fieldsToDrop.add(field)
val fieldName = propertyInfo.name
if (fieldName != parameter.name) {
parameterUsageReplacementMap.put(parameter.name!!, fieldName)
}
}
{ codeConverter ->
val bodyConverter = codeConverter.withSpecialExpressionConverter(
object : ReplacingExpressionConverter(parameterUsageReplacementMap) {
override fun convertExpression(expression: PsiExpression, codeConverter: CodeConverter): Expression? {
if (expression.isSuperConstructorCall()) {
return Expression.Empty // skip it
}
return super.convertExpression(expression, codeConverter)
}
})
postProcessBody(bodyConverter.convertBlock(body, false, { !statementsToRemove.contains(it) }))
}
}
else {
{ Block.Empty }
}
val bodyGenerator: (CodeConverter) -> Block = { Block.Empty }
// we need to replace renamed parameter usages in base class constructor arguments and in default values

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@ import com.intellij.testFramework.LightVirtualFile
import com.intellij.testFramework.UsefulTestCase
import com.intellij.util.io.URLUtil
import com.intellij.util.io.ZipUtil
import junit.framework.TestCase
import org.jetbrains.jps.ModuleChunk
import org.jetbrains.jps.api.CanceledStatus
import org.jetbrains.jps.builders.BuildResult
@@ -57,7 +56,6 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.config.KotlinCompilerVersion.TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY
import org.jetbrains.kotlin.config.LanguageVersion
@@ -82,7 +80,6 @@ import java.util.*
import java.util.regex.Pattern
import java.util.zip.ZipOutputStream
import kotlin.reflect.KMutableProperty1
import kotlin.reflect.KProperty1
class KotlinJpsBuildTestIncremental : KotlinJpsBuildTest() {
var isICEnabledBackup: Boolean = false
@@ -872,7 +869,8 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
}
}
checkFromIndex = messages.size
// checkFromIndex = messages.size
checkFromIndex = 0
return false
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@ object KotlinBuilderModuleScriptGenerator {
return@run alwaysNull()
}
return@run { module ->
return@run { module: JpsModule ->
getTestModulePropertiesMethod(JpsJavaExtensionService.getInstance(), module)?.let {
getProductionModuleMethod(it) as JpsModule?
}

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("CollectionsKt")
@@ -8,9 +24,6 @@ package kotlin.collections
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.js.*
import kotlin.comparisons.*
/**
* Returns 1st *element* from the collection.
*/
@@ -547,7 +560,7 @@ public fun <T> Iterable<T>.drop(n: Int): List<T> {
if (resultSize <= 0)
return emptyList()
if (resultSize == 1)
return listOf(last())
return listOf(last() as T)
list = ArrayList<T>(resultSize)
if (this is List<T>) {
if (this is RandomAccess) {

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("CollectionsKt")
@file:kotlin.jvm.JvmVersion
@@ -9,8 +25,6 @@ package kotlin.collections
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.comparisons.*
/**
* Returns 1st *element* from the collection.
*/
@@ -547,7 +561,7 @@ public fun <T> Iterable<T>.drop(n: Int): List<T> {
if (resultSize <= 0)
return emptyList()
if (resultSize == 1)
return listOf(last())
return listOf(last() as T)
list = ArrayList<T>(resultSize)
if (this is List<T>) {
if (this is RandomAccess) {

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:JvmVersion
package kotlin.text
@@ -162,7 +178,7 @@ public enum class CharCategory(public val value: Int, public val code: String) {
public companion object {
private val categoryMap by lazy { CharCategory.values().associateBy { it.value } }
private val categoryMap by lazy<Map<Int, CharCategory>> { CharCategory.values().associateBy { it.value } }
public fun valueOf(category: Int): CharCategory = categoryMap[category] ?: throw IllegalArgumentException("Category #$category is not defined.")
}

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:JvmVersion
package kotlin.text
@@ -111,7 +127,7 @@ public enum class CharDirectionality(public val value: Int) {
public companion object {
private val directionalityMap by lazy { CharDirectionality.values().associateBy { it.value } }
private val directionalityMap by lazy<Map<Int, CharDirectionality>> { CharDirectionality.values().associateBy { it.value } }
public fun valueOf(directionality: Int): CharDirectionality = directionalityMap[directionality] ?: throw IllegalArgumentException("Directionality #$directionality is not defined.")
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +16,10 @@
package test.collections
import test.collections.behaviors.*
import test.collections.behaviors.iteratorBehavior
import test.collections.behaviors.listBehavior
import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
import kotlin.test.*
import kotlin.comparisons.*
fun <T> assertArrayNotSameButEquals(expected: Array<out T>, actual: Array<out T>, message: String = "") { assertTrue(expected !== actual && expected contentEquals actual, message) }
fun assertArrayNotSameButEquals(expected: IntArray, actual: IntArray, message: String = "") { assertTrue(expected !== actual && expected contentEquals actual, message) }
@@ -1238,8 +1238,8 @@ class ArraysTest {
arrayData(intArrayOf(0, 1, 2, 3, 4, 5), comparator)
.checkSorted<List<Int>>( { sortedWith(comparator) }, { sortedWith(comparator.reversed()) }, { iterator() })
arrayData(arrayOf(0, 1, 2, 3, 4, 5), comparator)
.checkSorted<Array<out Int>>( { sortedArrayWith(comparator) }, { sortedArrayWith(comparator.reversed()) }, { iterator() })
// arrayData(arrayOf(0, 1, 2, 3, 4, 5), comparator)
// .checkSorted<Array<out Int>>( { sortedArrayWith(comparator) }, { sortedArrayWith(comparator.reversed()) }, { iterator() })
// in-place
val array = Array(6) { it }

View File

@@ -17,12 +17,12 @@
package test.collections
import kotlin.test.*
import kotlin.comparisons.*
fun fibonacci(): Sequence<Int> {
// fibonacci terms
// 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, ...
return generateSequence(Pair(0, 1), { Pair(it.second, it.first + it.second) }).map { it.first * 1 }
// return generateSequence(Pair(0, 1), { Pair(it.second, it.first + it.second) }).map { it.first * 1 }
return sequenceOf()
}
public class SequenceTest {

View File

@@ -16,9 +16,9 @@
package test.coroutines
import kotlin.test.*
import kotlin.coroutines.experimental.buildSequence
import kotlin.coroutines.experimental.buildIterator
import kotlin.coroutines.experimental.buildSequence
import kotlin.test.*
class SequenceBuilderTest {
@Test
@@ -268,7 +268,7 @@ class SequenceBuilderTest {
for (res in result) {
effects.add("(") // marks step start
effects.add(res)
// effects.add(res)
effects.add(")") // marks step end
}
assertEquals(
@@ -297,7 +297,7 @@ class SequenceBuilderTest {
var sum = 0
repeat(10) {
sum += values.next() //.also(::println)
// sum += values.next() //.also(::println)
}
assertEquals(30, sum)
}

View File

@@ -1,6 +1,24 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.properties.delegation.map
import kotlin.test.*
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
class ValByMapExtensionsTest {
val map: Map<String, String> = hashMapOf("a" to "all", "b" to "bar", "c" to "code")
@@ -11,7 +29,7 @@ class ValByMapExtensionsTest {
val c: Any by map
val d: String? by map
val e: String by map.withDefault { "default" }
val f: String? by map.withDefault { null }
val f: String? by map.withDefault<String, String?> { null }
// val n: Int by map // prohibited by type system
val i: Int by genericMap
val x: Double by genericMap
@@ -35,7 +53,7 @@ class VarByMapExtensionsTest {
val map2: MutableMap<String, CharSequence> = hashMapOf("a2" to "all")
var a: String by map
var b: Any? by map
// var b: Any? by map
var c: Int by map
var d: String? by map
var a2: String by map2.withDefault { "empty" }
@@ -43,7 +61,7 @@ class VarByMapExtensionsTest {
@Test fun doTest() {
assertEquals("all", a)
assertEquals(null, b)
// assertEquals(null, b)
assertEquals(1, c)
c = 2
assertEquals(2, c)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -135,7 +135,7 @@ class AndroidSubplugin : KotlinGradleSubplugin<KotlinCompile> {
fun isLayoutDirectory(file: File) = file.name == "layout" || file.name.startsWith("layout-")
return resDirectories.flatMap { resDir ->
(resDir.listFiles(::isLayoutDirectory)).orEmpty().asList()
(resDir.listFiles { file: File -> isLayoutDirectory(file) }).orEmpty().asList()
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@ private val createDefaultSourceDirectorySet: (name: String?, resolver: FileResol
if (defaultConstructor != null && defaultConstructor.getAnnotation(java.lang.Deprecated::class.java) == null) {
// TODO: drop when gradle < 2.12 are obsolete
{ name, resolver -> defaultConstructor.newInstance(name, resolver) }
return@run { name: String?, resolver: FileResolver? -> defaultConstructor!!.newInstance(name, resolver) }
}
else {
val directoryFileTreeFactoryClass = Class.forName("org.gradle.api.internal.file.collections.DirectoryFileTreeFactory")
@@ -58,7 +58,7 @@ private val createDefaultSourceDirectorySet: (name: String?, resolver: FileResol
val defaultFileTreeFactoryClass = Class.forName("org.gradle.api.internal.file.collections.DefaultDirectoryFileTreeFactory")
val defaultFileTreeFactory = defaultFileTreeFactoryClass.getConstructor().newInstance()
return@run { name, resolver -> alternativeConstructor.newInstance(name, resolver, defaultFileTreeFactory) }
return@run { name: String?, resolver: FileResolver? -> alternativeConstructor.newInstance(name, resolver, defaultFileTreeFactory) }
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,8 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.container.ComponentProvider
import org.jetbrains.kotlin.context.ProjectContext
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.kapt3.AptMode.*
import org.jetbrains.kotlin.kapt3.AptMode.APT_ONLY
import org.jetbrains.kotlin.kapt3.AptMode.WITH_COMPILATION
import org.jetbrains.kotlin.kapt3.diagnostic.KaptError
import org.jetbrains.kotlin.kapt3.stubs.ClassFileToSourceStubConverter
import org.jetbrains.kotlin.kapt3.util.KaptLogger
@@ -297,17 +298,20 @@ abstract class AbstractKapt3Extension(
val reportOutputFiles = kaptContext.generationState.configuration.getBoolean(CommonConfigurationKeys.REPORT_OUTPUT_FILES)
kaptContext.generationState.factory.writeAll(
incrementalDataOutputDir,
if (!reportOutputFiles) null else fun(file: OutputFile, sources: List<File>, output: File) {
val stubFileObject = converter.bindings[file.relativePath.substringBeforeLast(".class", missingDelimiterValue = "")]
if (stubFileObject != null) {
val stubFile = File(stubsOutputDir, stubFileObject.name)
if (stubFile.exists()) {
messageCollector.report(OUTPUT, OutputMessageUtil.formatOutputMessage(sources, stubFile))
if (!reportOutputFiles)
null as ((file: OutputFile, sources: List<File>, output: File) -> Unit)?
else
fun(file: OutputFile, sources: List<File>, output: File) {
val stubFileObject = converter.bindings[file.relativePath.substringBeforeLast(".class", missingDelimiterValue = "")]
if (stubFileObject != null) {
val stubFile = File(stubsOutputDir, stubFileObject.name)
if (stubFile.exists()) {
messageCollector.report(OUTPUT, OutputMessageUtil.formatOutputMessage(sources, stubFile))
}
}
}
messageCollector.report(OUTPUT, OutputMessageUtil.formatOutputMessage(sources, output))
}
messageCollector.report(OUTPUT, OutputMessageUtil.formatOutputMessage(sources, output))
}
)
}