From beadafa2d83a539dae8f969b9789f896346484ec Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 3 Oct 2011 01:28:04 +0000 Subject: 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 :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. --- test/files/presentation/ping-pong.check | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test/files/presentation/ping-pong.check') diff --git a/test/files/presentation/ping-pong.check b/test/files/presentation/ping-pong.check index ed419f5a13..44e1a04732 100644 --- a/test/files/presentation/ping-pong.check +++ b/test/files/presentation/ping-pong.check @@ -7,12 +7,12 @@ retrieved 38 members `method !=(x$1: Any)Boolean` `method !=(x$1: AnyRef)Boolean` `method ##()Int` -`method +(other: String)java.lang.String` +`method +(other: String)String` `method ->[B](y: B)(Pong, B)` `method ==(x$1: Any)Boolean` `method ==(x$1: AnyRef)Boolean` `method asInstanceOf[T0]=> T0` -`method clone()java.lang.Object` +`method clone()Object` `method ensuring(cond: Boolean)Pong` `method ensuring(cond: Boolean, msg: => Any)Pong` `method ensuring(cond: Pong => Boolean)Pong` @@ -28,12 +28,12 @@ retrieved 38 members `method notifyAll()Unit` `method poke()Unit` `method synchronized[T0](x$1: T0)T0` -`method toString()java.lang.String` +`method toString()String` `method wait()Unit` `method wait(x$1: Long)Unit` `method wait(x$1: Long, x$2: Int)Unit` `method →[B](y: B)(Pong, B)` -`value namejava.lang.String` +`value nameString` `value pingPing` `value selfAny` `value xPong` @@ -46,12 +46,12 @@ retrieved 38 members `method !=(x$1: Any)Boolean` `method !=(x$1: AnyRef)Boolean` `method ##()Int` -`method +(other: String)java.lang.String` +`method +(other: String)String` `method ->[B](y: B)(Ping, B)` `method ==(x$1: Any)Boolean` `method ==(x$1: AnyRef)Boolean` `method asInstanceOf[T0]=> T0` -`method clone()java.lang.Object` +`method clone()Object` `method ensuring(cond: Boolean)Ping` `method ensuring(cond: Boolean, msg: => Any)Ping` `method ensuring(cond: Ping => Boolean)Ping` @@ -63,13 +63,13 @@ retrieved 38 members `method hashCode()Int` `method isInstanceOf[T0]=> Boolean` `method loop=> Unit` -`method name=> java.lang.String` +`method name=> String` `method ne(x$1: AnyRef)Boolean` `method notify()Unit` `method notifyAll()Unit` `method poke=> Unit` `method synchronized[T0](x$1: T0)T0` -`method toString()java.lang.String` +`method toString()String` `method wait()Unit` `method wait(x$1: Long)Unit` `method wait(x$1: Long, x$2: Int)Unit` @@ -94,5 +94,5 @@ def poke: Unit = Ping.this.pong.poke() askType at PingPong.scala(17,10) ================================================================================ [response] askTypeAt at (17,10) -private[this] val name: java.lang.String = "pong" +private[this] val name: String = "pong" ================================================================================ -- cgit v1.2.3