Removed interface LazyType.

This commit is contained in:
Stanislav Erokhin
2016-06-04 03:01:48 +03:00
parent 63b2f89356
commit fd40273a0d
6 changed files with 7 additions and 28 deletions
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.util.ReenteringLazyValueComputationException;
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>() {
@Override
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
import org.jetbrains.kotlin.storage.NullableLazyValue;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.LazyType;
public abstract class VariableDescriptorWithInitializerImpl extends VariableDescriptorImpl {
private final boolean isVar;
@@ -54,7 +53,7 @@ public abstract class VariableDescriptorWithInitializerImpl extends VariableDesc
@Override
public ConstantValue<?> getCompileTimeInitializer() {
// Force computation and setting of compileTimeInitializer, if needed
if (compileTimeInitializer == null && outType instanceof LazyType) {
if (compileTimeInitializer == null) {
outType.getConstructor();
}
@@ -136,8 +136,8 @@ internal class DescriptorRendererImpl(
}
private fun renderNormalizedTypeAsIs(type: KotlinType): String {
if (type is LazyType && debugMode) {
return type.toString()
if (type is WrappedType && debugMode && !type.isComputed()) {
return "<Not computed yet>"
}
val unwrappedType = type.unwrap()
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.types.ErrorUtils;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.LazyType;
import org.jetbrains.kotlin.types.TypeConstructor;
import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
import java.util.*;
@@ -450,7 +450,7 @@ public class DescriptorUtils {
public static boolean shouldRecordInitializerForProperty(@NotNull VariableDescriptor variable, @NotNull KotlinType type) {
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);
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
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 {
}