summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-10-03 01:28:04 +0000
committerPaul Phillips <paulp@improving.org>2011-10-03 01:28:04 +0000
commitbeadafa2d83a539dae8f969b9789f896346484ec (patch)
tree90c69a49397cdb59120d59307b843c54c8f68908 /test/files/run
parent55109d0d253c7e89660f1b61d17408648c0c53a4 (diff)
downloadscala-beadafa2d83a539dae8f969b9789f896346484ec.tar.gz
scala-beadafa2d83a539dae8f969b9789f896346484ec.tar.bz2
scala-beadafa2d83a539dae8f969b9789f896346484ec.zip
Selective dealiasing when printing errors.
*** Important note for busy commit log skimmers *** Symbol method "fullName" has been trying to serve the dual role of "how to print a symbol" and "how to find a class file." It cannot serve both these roles simultaneously, primarily because of package objects but other little things as well. Since in the majority of situations we want the one which corresponds to the idealized scala world, not the grubby bytecode, I went with that for fullName. When you require the path to a class (e.g. you are calling Class.forName) you should use javaClassName. package foo { package object bar { class Bippy } } If sym is Bippy's symbol, then sym.fullName == foo.bar.Bippy sym.javaClassName == foo.bar.package.Bippy *** End important note *** There are many situations where we (until now) forewent revealing everything we knew about a type mismatch. For instance, this isn't very helpful of scalac (at least in those more common cases where you didn't define type X on the previous repl line.) scala> type X = Int defined type alias X scala> def f(x: X): Byte = x <console>:8: error: type mismatch; found : X required: Byte def f(x: X): Byte = x ^ Now it says: found : X (which expands to) Int required: Byte def f(x: X): Byte = x ^ In addition I rearchitected a number of methods involving: - finding a symbol's owner - calculating a symbol's name - determining whether to print a prefix No review.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/code.check4
-rw-r--r--test/files/run/constrained-types.check14
-rw-r--r--test/files/run/global-showdef.check4
-rw-r--r--test/files/run/repl-parens.check2
-rw-r--r--test/files/run/repl-paste-2.check2
-rw-r--r--test/files/run/t4172.check2
6 files changed, 14 insertions, 14 deletions
diff --git a/test/files/run/code.check b/test/files/run/code.check
index 4bc36424ee..23263600ea 100644
--- a/test/files/run/code.check
+++ b/test/files/run/code.check
@@ -5,7 +5,7 @@ testing: (() => {
e
})
result = (() => {
- val e: Element = new Element{Element}{(name: <?>)Element}("someName"{java.lang.String("someName")}){Element};
+ val e: Element = new Element{Element}{(name: <?>)Element}("someName"{String("someName")}){Element};
e{Element}
}{Element}){() => Element}
testing: (() => truc.elem = 6)
@@ -13,6 +13,6 @@ result = (() => truc.elem{Int} = 6{Int(6)}{Unit}){() => Unit}
testing: (() => truc.elem = truc.elem.$plus(6))
result = (() => truc.elem{Int} = truc.elem.+{(x: <?>)Int}(6{Int(6)}){Int}{Unit}){() => Unit}
testing: (() => new baz.BazElement("someName"))
-result = (() => new baz.BazElement{baz.BazElement}{(name: <?>)baz.BazElement}("someName"{java.lang.String("someName")}){baz.BazElement}){() => baz.BazElement}
+result = (() => new baz.BazElement{baz.BazElement}{(name: <?>)baz.BazElement}("someName"{String("someName")}){baz.BazElement}){() => baz.BazElement}
testing: ((x: Int) => x.$plus(ys.length))
result = ((x: Int) => x.+{(x: <?>)Int}(ys.length{Int}){Int}){Int => Int}
diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check
index 66580f063a..ac8817cb08 100644
--- a/test/files/run/constrained-types.check
+++ b/test/files/run/constrained-types.check
@@ -66,19 +66,19 @@ m: (x: String)String @Annot(x)
scala>
scala> val three = "three"
-three: java.lang.String = three
+three: String = three
scala> val three2 = m(three:three.type) // should change x to three
three2: String @Annot(three) = three
scala> var four = "four"
-four: java.lang.String = four
+four: String = four
scala> val four2 = m(four) // should have an existential bound
-four2: java.lang.String @Annot(x) forSome { val x: java.lang.String } = four
+four2: String @Annot(x) forSome { val x: String } = four
scala> val four3 = four2 // should have the same type as four2
-four3: java.lang.String @Annot(x) forSome { val x: java.lang.String } = four
+four3: String @Annot(x) forSome { val x: String } = four
scala> val stuff = m("stuff") // should not crash
stuff: String @Annot("stuff") = stuff
@@ -100,7 +100,7 @@ scala> def m = {
val y : String @Annot(x) = x
y
} // x should not escape the local scope with a narrow type
-m: java.lang.String @Annot(x) forSome { val x: java.lang.String }
+m: String @Annot(x) forSome { val x: String }
scala>
@@ -113,7 +113,7 @@ scala> def n(y: String) = {
}
m("stuff".stripMargin)
} // x should be existentially bound
-n: (y: String)java.lang.String @Annot(x) forSome { val x: String }
+n: (y: String)String @Annot(x) forSome { val x: String }
scala>
@@ -130,7 +130,7 @@ Companions must be defined together; you may wish to use :paste mode for this.
scala>
scala> val y = a.x // should drop the annotation
-y: java.lang.String = hello
+y: String = hello
scala>
diff --git a/test/files/run/global-showdef.check b/test/files/run/global-showdef.check
index 36d33f6fdf..4c2fd41a1a 100644
--- a/test/files/run/global-showdef.check
+++ b/test/files/run/global-showdef.check
@@ -9,6 +9,6 @@
<<-- class foo.bar.Bippy.Boppity.Boo after phase 'typer' -->>
def showdefTestMemberClass3: Int
<<-- object foo.bar.Bippy after phase 'typer' -->>
- def showdefTestMemberObject2: java.lang.String
+ def showdefTestMemberObject2: String
<<-- object foo.bar.Bippy.Boppity.Boo after phase 'typer' -->>
- def showdefTestMemberObject1: java.lang.String
+ def showdefTestMemberObject1: String
diff --git a/test/files/run/repl-parens.check b/test/files/run/repl-parens.check
index a3b0fd1939..54c04c4dc6 100644
--- a/test/files/run/repl-parens.check
+++ b/test/files/run/repl-parens.check
@@ -66,7 +66,7 @@ scala> 55 ; () => 5
res13: () => Int = <function0>
scala> () => { class X ; new X }
-res14: () => java.lang.Object with ScalaObject = <function0>
+res14: () => Object with ScalaObject = <function0>
scala>
diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check
index 18bd6d2434..4fdf080fd2 100644
--- a/test/files/run/repl-paste-2.check
+++ b/test/files/run/repl-paste-2.check
@@ -52,7 +52,7 @@ scala> val x = dingus
^
scala> val x = "dingus"
-x: java.lang.String = dingus
+x: String = dingus
scala> x.length
res2: Int = 6
diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check
index 4bb963baa9..95e3eb950d 100644
--- a/test/files/run/t4172.check
+++ b/test/files/run/t4172.check
@@ -4,7 +4,7 @@ Type :help for more information.
scala>
scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) }
-c: (C, C{def f: Int}) forSome { type C <: java.lang.Object with ScalaObject } = (C,C)
+c: (C, C{def f: Int}) forSome { type C <: Object with ScalaObject } = (C,C)
scala>