Removed interface LazyType.
This commit is contained in:
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.util.ReenteringLazyValueComputationException;
|
|||||||
|
|
||||||
import static org.jetbrains.kotlin.resolve.BindingContext.DEFERRED_TYPE;
|
import static org.jetbrains.kotlin.resolve.BindingContext.DEFERRED_TYPE;
|
||||||
|
|
||||||
public class DeferredType extends WrappedType implements LazyType {
|
public class DeferredType extends WrappedType {
|
||||||
|
|
||||||
private static final Function1 EMPTY_CONSUMER = new Function1<Object, Void>() {
|
private static final Function1 EMPTY_CONSUMER = new Function1<Object, Void>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-2
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.name.Name;
|
|||||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||||
import org.jetbrains.kotlin.storage.NullableLazyValue;
|
import org.jetbrains.kotlin.storage.NullableLazyValue;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
import org.jetbrains.kotlin.types.KotlinType;
|
||||||
import org.jetbrains.kotlin.types.LazyType;
|
|
||||||
|
|
||||||
public abstract class VariableDescriptorWithInitializerImpl extends VariableDescriptorImpl {
|
public abstract class VariableDescriptorWithInitializerImpl extends VariableDescriptorImpl {
|
||||||
private final boolean isVar;
|
private final boolean isVar;
|
||||||
@@ -54,7 +53,7 @@ public abstract class VariableDescriptorWithInitializerImpl extends VariableDesc
|
|||||||
@Override
|
@Override
|
||||||
public ConstantValue<?> getCompileTimeInitializer() {
|
public ConstantValue<?> getCompileTimeInitializer() {
|
||||||
// Force computation and setting of compileTimeInitializer, if needed
|
// Force computation and setting of compileTimeInitializer, if needed
|
||||||
if (compileTimeInitializer == null && outType instanceof LazyType) {
|
if (compileTimeInitializer == null) {
|
||||||
outType.getConstructor();
|
outType.getConstructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ internal class DescriptorRendererImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun renderNormalizedTypeAsIs(type: KotlinType): String {
|
private fun renderNormalizedTypeAsIs(type: KotlinType): String {
|
||||||
if (type is LazyType && debugMode) {
|
if (type is WrappedType && debugMode && !type.isComputed()) {
|
||||||
return type.toString()
|
return "<Not computed yet>"
|
||||||
}
|
}
|
||||||
val unwrappedType = type.unwrap()
|
val unwrappedType = type.unwrap()
|
||||||
return when (unwrappedType) {
|
return when (unwrappedType) {
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter;
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||||
import org.jetbrains.kotlin.types.ErrorUtils;
|
import org.jetbrains.kotlin.types.ErrorUtils;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
import org.jetbrains.kotlin.types.KotlinType;
|
||||||
import org.jetbrains.kotlin.types.LazyType;
|
|
||||||
import org.jetbrains.kotlin.types.TypeConstructor;
|
import org.jetbrains.kotlin.types.TypeConstructor;
|
||||||
|
import org.jetbrains.kotlin.types.TypeUtils;
|
||||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
|
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -450,7 +450,7 @@ public class DescriptorUtils {
|
|||||||
public static boolean shouldRecordInitializerForProperty(@NotNull VariableDescriptor variable, @NotNull KotlinType type) {
|
public static boolean shouldRecordInitializerForProperty(@NotNull VariableDescriptor variable, @NotNull KotlinType type) {
|
||||||
if (variable.isVar() || type.isError()) return false;
|
if (variable.isVar() || type.isError()) return false;
|
||||||
|
|
||||||
if (type instanceof LazyType || type.isMarkedNullable()) return true;
|
if (TypeUtils.acceptsNullable(type)) return true;
|
||||||
|
|
||||||
KotlinBuiltIns builtIns = getBuiltIns(variable);
|
KotlinBuiltIns builtIns = getBuiltIns(variable);
|
||||||
return KotlinBuiltIns.isPrimitiveType(type) ||
|
return KotlinBuiltIns.isPrimitiveType(type) ||
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ sealed class KotlinType : Annotated {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class WrappedType() : KotlinType(), LazyType {
|
abstract class WrappedType() : KotlinType() {
|
||||||
open fun isComputed(): Boolean = true
|
open fun isComputed(): Boolean = true
|
||||||
protected abstract val delegate: KotlinType
|
protected abstract val delegate: KotlinType
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2016 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 org.jetbrains.kotlin.types;
|
|
||||||
|
|
||||||
public interface LazyType {
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user