Renamed Tuple0 to Unit, removed aliasing.

This commit is contained in:
Evgeny Gerashchenko
2013-03-19 16:40:09 +04:00
parent 20e5990f4e
commit 8a021abaa5
4 changed files with 12 additions and 23 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
package jet package jet
public class Tuple0 private () { public class Unit private () {
public class object { public class object {
public val VALUE: Tuple0 public val VALUE: Unit
} }
} }
@@ -45,7 +45,7 @@ import java.util.List;
import static org.jetbrains.jet.lang.resolve.lazy.ResolveSessionUtils.safeNameForLazyResolve; import static org.jetbrains.jet.lang.resolve.lazy.ResolveSessionUtils.safeNameForLazyResolve;
public class ResolveSession implements KotlinCodeAnalyzer { public class ResolveSession implements KotlinCodeAnalyzer {
private static final Function<FqName, Name> NO_ALIASES = new Function<FqName, Name>() { public static final Function<FqName, Name> NO_ALIASES = new Function<FqName, Name>() {
@Override @Override
public Name fun(FqName name) { public Name fun(FqName name) {
@@ -17,7 +17,6 @@
package org.jetbrains.jet.lang.types.lang; package org.jetbrains.jet.lang.types.lang;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@@ -26,7 +25,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiFileFactory; import com.intellij.psi.PsiFileFactory;
import com.intellij.util.Function;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.DefaultModuleConfiguration; import org.jetbrains.jet.lang.DefaultModuleConfiguration;
@@ -37,10 +35,10 @@ import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl; import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.*; import org.jetbrains.jet.lang.resolve.*;
import org.jetbrains.jet.lang.resolve.lazy.declarations.FileBasedDeclarationProviderFactory;
import org.jetbrains.jet.lang.resolve.lazy.KotlinCodeAnalyzer; import org.jetbrains.jet.lang.resolve.lazy.KotlinCodeAnalyzer;
import org.jetbrains.jet.lang.resolve.lazy.storage.LockBasedStorageManager;
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession; import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
import org.jetbrains.jet.lang.resolve.lazy.declarations.FileBasedDeclarationProviderFactory;
import org.jetbrains.jet.lang.resolve.lazy.storage.LockBasedStorageManager;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe; import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.name.Name;
@@ -81,10 +79,6 @@ public class KotlinBuiltIns {
BUILT_INS_DIR + "/Unit.jet" BUILT_INS_DIR + "/Unit.jet"
); );
private static final Map<FqName, Name> ALIASES = ImmutableMap.<FqName, Name>builder()
.put(new FqName("jet.Unit"), Name.identifier("Tuple0"))
.build();
private static final int FUNCTION_TRAIT_COUNT = 23; private static final int FUNCTION_TRAIT_COUNT = 23;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -202,7 +196,7 @@ public class KotlinBuiltIns {
nullableAnyType = TypeUtils.makeNullable(anyType); nullableAnyType = TypeUtils.makeNullable(anyType);
nothingType = getBuiltInTypeByClassName("Nothing"); nothingType = getBuiltInTypeByClassName("Nothing");
nullableNothingType = TypeUtils.makeNullable(nothingType); nullableNothingType = TypeUtils.makeNullable(nothingType);
unitType = getBuiltInTypeByClassName("Tuple0"); unitType = getBuiltInTypeByClassName("Unit");
stringType = getBuiltInTypeByClassName("String"); stringType = getBuiltInTypeByClassName("String");
annotationType = getBuiltInTypeByClassName("Annotation"); annotationType = getBuiltInTypeByClassName("Annotation");
@@ -227,12 +221,7 @@ public class KotlinBuiltIns {
builtInsModule, builtInsModule,
new SpecialModuleConfiguration(), new SpecialModuleConfiguration(),
new FileBasedDeclarationProviderFactory(storageManager, files), new FileBasedDeclarationProviderFactory(storageManager, files),
new Function<FqName, Name>() { ResolveSession.NO_ALIASES,
@Override
public Name fun(FqName name) {
return ALIASES.get(name);
}
},
Predicates.in(Sets.newHashSet(new FqNameUnsafe("jet.Any"), new FqNameUnsafe("jet.Nothing"))), Predicates.in(Sets.newHashSet(new FqNameUnsafe("jet.Any"), new FqNameUnsafe("jet.Nothing"))),
new BindingTraceContext()); new BindingTraceContext());
} }
@@ -428,7 +417,7 @@ public class KotlinBuiltIns {
@NotNull @NotNull
public ClassDescriptor getUnit() { public ClassDescriptor getUnit() {
return getBuiltInClassByName("Tuple0"); return getBuiltInClassByName("Unit");
} }
@NotNull @NotNull
+4 -4
View File
@@ -1265,11 +1265,11 @@ public open class Throwable {
public final fun printStackTrace() : Unit public final fun printStackTrace() : Unit
} }
public final class Tuple0 { public final class Unit {
private constructor Tuple0() private constructor Unit()
public class object <class-object-for-Tuple0> { public class object <class-object-for-Unit> {
private constructor <class-object-for-Tuple0>() private constructor <class-object-for-Unit>()
public final val VALUE : Unit public final val VALUE : Unit
} }
} }