Skip to content

Commit

Permalink
Rename Void->Anything, Nothing->Null, Bottom->Nothing for
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Jan 6, 2013
1 parent 6ff039f commit 3a74afc
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion native_test.ceylon
@@ -1,5 +1,5 @@

shared Nothing nativejs() { return null; }
shared Null nativejs() { return null; }

shared nativejs interface Foo {
shared formal variable Integer num;
Expand Down
Expand Up @@ -969,7 +969,7 @@ private void methodDeclaration(TypeDeclaration outer, MethodDeclaration that) {
if (that.getSpecifierExpression() != null) {
// method(params) => expr
if (outer == null) {
// Not in a prototype definition. Nothing to do here if it's a
// Not in a prototype definition. Null to do here if it's a
// member in prototype style.
if (prototypeStyle && m.isMember()) { return; }
comment(that);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/redhat/ceylon/compiler/js/TypeUtils.java
Expand Up @@ -66,9 +66,9 @@ public static void printTypeArguments(Node node, List<ProducedType> targs, Gener

static void outputQualifiedTypename(Node node, ProducedType pt, GenerateJsVisitor gen) {
TypeDeclaration t = pt.getDeclaration();
if (t.getName().equals("Bottom")) {
if (t.getName().equals("Nothing")) {
//Hack in the model means hack here as well
gen.out(GenerateJsVisitor.getClAlias(), "Bottom");
gen.out(GenerateJsVisitor.getClAlias(), "Nothing");
} else {
if (t.isAlias()) {
t = t.getExtendedTypeDeclaration();
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/redhat/ceylon/compiler/loader/JsonPackage.java
Expand Up @@ -9,7 +9,7 @@

import com.redhat.ceylon.compiler.typechecker.analyzer.ModuleManager;
import com.redhat.ceylon.compiler.typechecker.model.Annotation;
import com.redhat.ceylon.compiler.typechecker.model.BottomType;
import com.redhat.ceylon.compiler.typechecker.model.NothingType;
import com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface;
import com.redhat.ceylon.compiler.typechecker.model.Declaration;
import com.redhat.ceylon.compiler.typechecker.model.FunctionalParameter;
Expand Down Expand Up @@ -43,7 +43,7 @@ public class JsonPackage extends com.redhat.ceylon.compiler.typechecker.model.Pa
private final Unit unit = new Unit();
private final String pkgname;
private boolean loaded = false;
private BottomType bottom;
private NothingType bottom;

static {
idobj.put(MetamodelGenerator.KEY_NAME, "IdentifiableObject");
Expand All @@ -52,7 +52,7 @@ public class JsonPackage extends com.redhat.ceylon.compiler.typechecker.model.Pa
objclass.put(MetamodelGenerator.KEY_NAME, "Object");
objclass.put(MetamodelGenerator.KEY_PACKAGE, "ceylon.language");
objclass.put(MetamodelGenerator.KEY_MODULE, "ceylon.language");
voidclass.put(MetamodelGenerator.KEY_NAME, "Void");
voidclass.put(MetamodelGenerator.KEY_NAME, "Anything");
voidclass.put(MetamodelGenerator.KEY_PACKAGE, "ceylon.language");
voidclass.put(MetamodelGenerator.KEY_MODULE, "ceylon.language");
}
Expand All @@ -73,8 +73,8 @@ void loadDeclarations() {
if (getModule().getLanguageModule() == getModule() && "ceylon.language".equals(pkgname)) {
//Mark the language module as immediately available to bypass certain validations
getModule().setAvailable(true);
//Ugly ass hack - add Bottom to the model
bottom = new BottomType(unit);
//Ugly ass hack - add Nothing to the model
bottom = new NothingType(unit);
bottom.setContainer(this);
bottom.setUnit(unit);
}
Expand Down Expand Up @@ -154,7 +154,7 @@ private com.redhat.ceylon.compiler.typechecker.model.Class loadClass(String name
}
}
//This is to avoid circularity
if (!(getModule().getLanguageModule()==getModule() && ("Bottom".equals(name) || "Void".equals(name)))) {
if (!(getModule().getLanguageModule()==getModule() && ("Nothing".equals(name) || "Anything".equals(name)))) {
if (m.containsKey("super")) {
cls.setExtendedType(getTypeFromJson((Map<String,Object>)m.get("super"), allparms));
} else {
Expand Down Expand Up @@ -676,7 +676,7 @@ Declaration load(String name, List<TypeParameter> existing) {
@SuppressWarnings("unchecked")
Map<String,Object> map = (Map<String,Object>)model.get(name);
if (map == null) {
if ("Bottom".equals(name) && "ceylon.language".equals(pkgname)) {
if ("Nothing".equals(name) && "ceylon.language".equals(pkgname)) {
return bottom;
}
throw new IllegalStateException("Cannot find " + name + " in " + model.keySet());
Expand Down
4 changes: 2 additions & 2 deletions src/test/ceylon/inheritance/selftypes.ceylon
Expand Up @@ -22,7 +22,7 @@ class Bar141() satisfies Comp141<Bar141> {
void testSelfTypes() {
Comp141<Bar141> testOf = Bar141();
Bar141 bar141 = testOf of Bar141;
Void v141 = testOf;
Object? o141 = v141 of Object|Nothing;
Anything v141 = testOf;
Object? o141 = v141 of Object|Null;
check(o141 is Bar141, "self types");
}
2 changes: 1 addition & 1 deletion src/test/ceylon/members/outer.ceylon
Expand Up @@ -11,7 +11,7 @@ void test_outer_inner_safety() {
fail("i1 should be null");
}
check(className(cons)=="ceylon.language::JsCallable", "cons is Callable, " className(cons) "");
Outer.Inner|Nothing i2 = cons();
Outer.Inner|Null i2 = cons();
if (exists i2) {
fail("i2 should not exist");
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ceylon/misc/aliases.ceylon
Expand Up @@ -75,7 +75,7 @@ void testAliasing() {
Object xxxxx1 = 6;
Object xxxxx2 = "XXXX";
check(xxxxx1 is String|Integer, "is String|Integer");
check(xxxxx2 is String&Sequence<Void>, "is String&Sequence");
check(xxxxx2 is String&Sequence<Anything>, "is String&Sequence");
function cualquiera(Boolean... bits) => any(bits...);
check(cualquiera(true,true,true), "seq arg method alias");
}
4 changes: 2 additions & 2 deletions src/test/ceylon/operators/operators.ceylon
Expand Up @@ -156,9 +156,9 @@ void testCollectionOperators() {
value seq1 = [ "one", "two" ];
String s1 = seq1[0]; //not optional anymore!
check(s1=="one", "lookup");
String|Nothing s2 = seq1[2]; //not optional anymore!
String|Null s2 = seq1[2]; //not optional anymore!
check(!s2 exists, "lookup");
String|Nothing s3 = seq1[-1]; //not optional anymore!
String|Null s3 = seq1[-1]; //not optional anymore!
check(!s3 exists, "lookup");
variable Sequence<String>? unsafe = seq1;
check(unsafe?[0] exists, "safe index");
Expand Down
2 changes: 1 addition & 1 deletion src/test/ceylon/switches/switches.ceylon
Expand Up @@ -52,7 +52,7 @@ shared void test() {
switch(e1)
case(is Integer) { fail("INTEGER? WTF?"); }
case(is Float) {}
else { fail("Nothing!!! WTF?"); }
else { fail("Null!!! WTF?"); }

//is+continue
for (e in enums) {
Expand Down
Expand Up @@ -42,7 +42,7 @@ public static Collection<Object[]> sources() {
m1.put("void", Arrays.asList("4:0-4:3", "31:0-31:3"));
m1.put("String", Arrays.asList("4:11-4:16", "9:0-9:5", "9:24-9:29", "17:16-17:21",
"22:0-22:5", "22:24-22:29", "27:11-27:16", "34:16-34:21"));
m1.put("Nothing", Collections.singletonList("4:17-4:17"));
m1.put("Null", Collections.singletonList("4:17-4:17"));
m1.put("print", Arrays.asList("6:4-6:8", "36:4-36:8"));
m1.put("smaller", Collections.singletonList("13:10-13:16"));
m1.put("larger", Collections.singletonList("14:10-14:15"));
Expand Down
Expand Up @@ -167,7 +167,7 @@ public void testParameterTypes4() {
Assert.assertEquals("ParmTypes4 should satisfy 1 interface", 1, ps.size());
ModelUtils.checkType(ps.get(0), "ceylon.language::Iterable<Element>");
Map<String,Map<String,Object>> m2 = (Map<String,Map<String,Object>>)cls.get(MetamodelGenerator.KEY_ATTRIBUTES);
ModelUtils.checkType(m2.get("primero"), "ceylon.language::Nothing|Element");
ModelUtils.checkType(m2.get("primero"), "ceylon.language::Null|Element");
}

@Test @SuppressWarnings("unchecked")
Expand All @@ -184,7 +184,7 @@ public void testNested() {
cls = ((Map<String,Map<String,Object>>)cls.get(MetamodelGenerator.KEY_METHODS)).get("innerMethod1");
ModelUtils.checkMap(cls, MetamodelGenerator.KEY_NAME, "innerMethod1",
MetamodelGenerator.KEY_METATYPE, MetamodelGenerator.METATYPE_METHOD);
ModelUtils.checkType(cls, "ceylon.language::Void");
ModelUtils.checkType(cls, "ceylon.language::Anything");
}

@Test @SuppressWarnings("unchecked")
Expand Down
Expand Up @@ -64,7 +64,7 @@ public void testSimpleMethods() {
Assert.assertNotNull(method);
ModelUtils.checkMap(method, MetamodelGenerator.KEY_NAME, "simple1",
MetamodelGenerator.KEY_METATYPE, MetamodelGenerator.METATYPE_METHOD);
ModelUtils.checkType(method, "ceylon.language::Void");
ModelUtils.checkType(method, "ceylon.language::Anything");

method = (Map<String, Object>)model.get("simple2");
ModelUtils.checkMap(method, MetamodelGenerator.KEY_NAME, "simple2",
Expand All @@ -75,7 +75,7 @@ public void testSimpleMethods() {
method = (Map<String, Object>)model.get("simple3");
ModelUtils.checkMap(method, MetamodelGenerator.KEY_NAME, "simple3",
MetamodelGenerator.KEY_METATYPE, MetamodelGenerator.METATYPE_METHOD);
ModelUtils.checkType(method, "ceylon.language::Void");
ModelUtils.checkType(method, "ceylon.language::Anything");
ModelUtils.checkParam(method, 0, "p1", "ceylon.language::Integer", false, false);
ModelUtils.checkParam(method, 1, "p2", "ceylon.language::String", false, false);
}
Expand Down
Expand Up @@ -197,13 +197,13 @@ public void tmptest() {
ProducedType seq0 = null, seq1 = null;
for (ProducedType pt : d0.getSatisfiedTypes()) {
System.out.println(d0 + " satisfies " + pt);
if (pt.getProducedTypeName().startsWith("Bottom[]")) {
if (pt.getProducedTypeName().startsWith("Nothing[]")) {
seq0 = pt;
break;
}
}
for (ProducedType pt : d1.getSatisfiedTypes()) {
if (pt.getProducedTypeName().startsWith("Bottom[]")) {
if (pt.getProducedTypeName().startsWith("Nothing[]")) {
seq1 = pt;
break;
}
Expand Down Expand Up @@ -248,7 +248,7 @@ public void compareTypes(ProducedType t0, ProducedType t1, ArrayList<String> sta
Assert.assertEquals(t0.isWellDefined(), t1.isWellDefined());
final String t0ptqn = t0.getProducedTypeQualifiedName();
stack.add(t0ptqn);
if ("ceylon.language::Void".equals(t0ptqn) || "ceylon.language::Bottom".equals(t0ptqn) || "ceylon.language::IdentifiableObject".equals(t0ptqn) || "ceylon.language::Nothing".equals(t0ptqn)) {
if ("ceylon.language::Anything".equals(t0ptqn) || "ceylon.language::Nothing".equals(t0ptqn) || "ceylon.language::IdentifiableObject".equals(t0ptqn) || "ceylon.language::Null".equals(t0ptqn)) {
return;
}
//Type arguments
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/modeltests/t1/MethodsAndAttributes.ceylon
Expand Up @@ -36,8 +36,8 @@ shared void parmtypes5<Value>(Value x)
given Value of Integer|Float {
}

void intersector1(Container<Void>&Category inters) {}
void intersector2(Iterable<Container<Void>>&Category beast){}
void intersector1(Container<Anything>&Category inters) {}
void intersector2(Iterable<Container<Anything>>&Category beast){}

//attributes
Integer i1 = 5;
Expand Down
6 changes: 3 additions & 3 deletions test/test.ceylon
Expand Up @@ -3,14 +3,14 @@ void printIf1(String? s) {
if (exists s) {
print(s);
} else {
print("Nothing to print.");
print("Null to print.");
}
}
String? s1 = null;
String? s2 = "I do exist";
printIf1(s1);
printIf1(s2);
print(s1 else "Nothing here...");
print(s2 else "Nothing here...");
print(s1 else "Null here...");
print(s2 else "Null here...");

}

0 comments on commit 3a74afc

Please sign in to comment.