Add diagnostics tests. Forbid callable reference to coroutineContext
#KT-16908: Fixed
This commit is contained in:
+4
-15
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.calls.components
|
||||
@@ -327,7 +316,7 @@ class CallableReferencesCandidateFactory(
|
||||
|
||||
return callComponents.reflectionTypes.getKFunctionType(
|
||||
Annotations.EMPTY, null, argumentsAndReceivers, null,
|
||||
returnType, descriptor.builtIns
|
||||
returnType, descriptor.builtIns, isSuspend = false
|
||||
) to defaults
|
||||
}
|
||||
else -> error("Unsupported descriptor type: $descriptor")
|
||||
@@ -358,7 +347,7 @@ fun getFunctionTypeFromCallableReferenceExpectedType(expectedType: UnwrappedType
|
||||
|
||||
return if (expectedType.isFunctionType) {
|
||||
expectedType
|
||||
} else if (ReflectionTypes.isNumberedKFunction(expectedType)) {
|
||||
} else if (ReflectionTypes.isNumberedKFunctionOrKSuspendFunction(expectedType)) {
|
||||
expectedType.immediateSupertypes().first { it.isFunctionType }.unwrap()
|
||||
} else {
|
||||
null
|
||||
|
||||
Reference in New Issue
Block a user