suppress "scala." prefix in string representation of types (in error messages,..)

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@10754 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
moors 2007-04-19 17:17:01 +00:00
parent 763b124d96
commit fbc6cbd1b5
29 changed files with 70 additions and 67 deletions

View File

@ -212,7 +212,10 @@ trait Symbols {
final def isRootPackage = isPackage && name == nme.ROOTPKG
final def isEmptyPackage = isPackage && name == nme.EMPTY_PACKAGE_NAME
final def isEmptyPackageClass = isPackageClass && name == nme.EMPTY_PACKAGE_NAME.toTypeName
final def isPredefModule = isModule && name == nme.Predef
final def isPredefModule = isModule && name == nme.Predef // not printed as a prefix
final def isScalaPackage = isPackage && name == nme.scala_ // not printed as a prefix
final def isScalaPackageClass = isPackageClass && name == nme.scala_.toTypeName // not printed as a prefix
def isDeprecated =
attributes exists (attr => attr.atp.symbol == DeprecatedAttr)

View File

@ -623,7 +623,7 @@ trait Types {
override def singleDeref: Type = sym.typeOfThis
override def prefixString =
if (settings.debug.value) sym.nameString + ".this."
else if (sym.isRoot || sym.isEmptyPackageClass || sym.isInterpreterWrapper) ""
else if (sym.isRoot || sym.isEmptyPackageClass || sym.isInterpreterWrapper || sym.isScalaPackageClass) ""
else if (sym.isAnonymousClass || sym.isRefinementClass) "this."
else if (sym.isPackageClass) sym.fullNameString + "."
else sym.nameString + ".this."
@ -671,7 +671,7 @@ trait Types {
override def symbol = sym
override def prefix: Type = pre
override def prefixString: String =
if ((sym.isEmptyPackage || sym.isInterpreterWrapper || sym.isPredefModule) && !settings.debug.value) ""
if ((sym.isEmptyPackage || sym.isInterpreterWrapper || sym.isPredefModule || sym.isScalaPackage) && !settings.debug.value) ""
else pre.prefixString + sym.nameString + "."
}
@ -1213,7 +1213,7 @@ A type's symbol should never be inspected directly.
override def prefixString =
if (settings.debug.value) super.prefixString
else if (sym.isRoot || sym.isEmptyPackageClass || sym.isInterpreterWrapper ||
sym.isAnonymousClass || sym.isRefinementClass) ""
sym.isAnonymousClass || sym.isRefinementClass || sym.isScalaPackageClass) ""
else if (sym.isPackageClass) sym.fullNameString + "."
else super.prefixString
}

View File

@ -1,4 +1,4 @@
bug1024.scala:2: error: type _ escapes its defining scope as part of type (scala.List[_], scala.Int)
bug1024.scala:2: error: type _ escapes its defining scope as part of type (List[_], Int)
val (a: List[_], b) = (List(1 ,2 ,3 ), 4)
^
one error found

View File

@ -1,6 +1,6 @@
bug1041.scala:3: error: type mismatch;
found : scala.Int(1)
required: scala.List[scala.Int]
found : Int(1)
required: List[Int]
case 1 => 4
^
one error found

View File

@ -1,5 +1,5 @@
bug412.scala:9: error: type mismatch;
found : scala.Null(null)
found : Null(null)
required: A.this.CX with A.this.C2
val c: CX with C2 = null;
^

View File

@ -2,7 +2,7 @@ bug414.scala:5: error: stable identifier required, but Empty found.
case Empty =>
^
bug414.scala:7: error: type mismatch;
found : scala.Unit
found : Unit
required: a
case _ =>
^

View File

@ -1,7 +1,7 @@
bug550.scala:6: error: class List takes type parameters
def sum[a](xs: List)(implicit m: Monoid[a]): a =
^
bug550.scala:8: error: no implicit argument matching parameter type Monoid[scala.Nothing] was found.
bug550.scala:8: error: no implicit argument matching parameter type Monoid[Nothing] was found.
sum(List(1,2,3))
^
two errors found

View File

@ -1,4 +1,4 @@
bug562.scala:10: error: error overriding value y in trait YYY of type scala.Int;
bug562.scala:10: error: error overriding value y in trait YYY of type Int;
value y cannot override a value or variable definition in a trait
(this is an implementation restriction)
override val y = super.y;

View File

@ -1,13 +1,13 @@
bug588.scala:3: error: double definition:
method visit:((int) => String)boolean and
method visit:((int) => unit)boolean at line 2
have same type after erasure: (scala.Function1)scala.Boolean
have same type after erasure: (Function1)Boolean
def visit(f: int => String): boolean
^
bug588.scala:10: error: double definition:
method f:(Test.this.TypeB)scala.Unit and
method f:(Test.this.TypeA)scala.Unit at line 9
have same type after erasure: (Test#TraitA)scala.Unit
method f:(Test.this.TypeB)Unit and
method f:(Test.this.TypeA)Unit at line 9
have same type after erasure: (Test#TraitA)Unit
def f(brac : TypeB) : Unit;
^
two errors found

View File

@ -1,6 +1,6 @@
bug663.scala:11: error: name clash between defined and inherited member:
method asMatch:(Test.this.Node)scala.Any and
method asMatch:(Test.this.Matchable)scala.Any in trait MatchableImpl
method asMatch:(Test.this.Node)Any and
method asMatch:(Test.this.Matchable)Any in trait MatchableImpl
have same type after erasure: (test.Test#NodeImpl)java.lang.Object
def asMatch(m : Node) : Any = {
^

View File

@ -1,7 +1,7 @@
bug664.scala:4: error: type Foo is not a member of test.Test with scala.ScalaObject
bug664.scala:4: error: type Foo is not a member of test.Test with ScalaObject
trait Foo extends super.Foo {
^
bug664.scala:5: error: type Bar is not a member of scala.AnyRef with scala.ScalaObject
bug664.scala:5: error: type Bar is not a member of AnyRef with ScalaObject
trait Bar extends super.Bar;
^
two errors found

View File

@ -1,6 +1,6 @@
bug677.scala:2: error: type mismatch;
found : () => scala.Int
required: scala.Nothing
found : () => Int
required: Nothing
val zx: Nothing = {() => 4}
^
one error found

View File

@ -3,7 +3,7 @@ bug696.scala:3: error: implicit method WithType is not contractive,
is not strictly contained in the signature TypeUtil0.this.Type[S with T]
implicit def WithType[S,T](implicit tpeS : Type[S], tpeT : Type[T]) : Type[S with T] = null
^
bug696.scala:4: error: no implicit argument matching parameter type TypeUtil0.this.Type[scala.Any] was found.
bug696.scala:4: error: no implicit argument matching parameter type TypeUtil0.this.Type[Any] was found.
as[Any](null);
^
two errors found

View File

@ -1,5 +1,5 @@
bug708.scala:8: error: error overriding type S in trait X with bounds >: scala.Nothing <: A.this.T;
type S has incompatible type scala.Any
bug708.scala:8: error: error overriding type S in trait X with bounds >: Nothing <: A.this.T;
type S has incompatible type Any
override private[A] type S = Any;
^
one error found

View File

@ -1,6 +1,6 @@
bug752.scala:6: error: type mismatch;
found : (String) => scala.Unit
required: (scala.Int) => scala.Unit
found : (String) => Unit
required: (Int) => Unit
f(&g)
^
one error found

View File

@ -1,5 +1,5 @@
bug839.scala:25: error: method set cannot be accessed in object Test.this.FileImpl#treeBuilder
because its instance type (Test.this.Global#Tree)scala.Unit contains a malformed type: Test.this.Global#Tree
because its instance type (Test.this.Global#Tree)Unit contains a malformed type: Test.this.Global#Tree
file.treeBuilder.set(nsc.get);
^
one error found

View File

@ -1,5 +1,5 @@
bug846.scala:9: error: type mismatch;
found : scala.Null(null)
found : Null(null)
required: B
if (a != null) f(a) else null
^

View File

@ -1,10 +1,10 @@
bug900.scala:4: error: type mismatch;
found : Foo.this.x.type (with underlying type Foo.this.bar)
required: scala.AnyRef
required: AnyRef
Note that implicit conversions are not applicable because they are ambiguous:
both method any2stringadd in object Predef of type (scala.Any)scala.runtime.StringAdd
both method any2stringadd in object Predef of type (Any)scala.runtime.StringAdd
and method any2ArrowAssoc in object Predef of type [a](a)ArrowAssoc[a]
are possible conversion functions from Foo.this.x.type to scala.AnyRef
are possible conversion functions from Foo.this.x.type to AnyRef
def break(): x.type
^
one error found

View File

@ -1,6 +1,6 @@
bug909.scala:6: error: type mismatch;
found : java.lang.String("Hello")
required: scala.Int
required: Int
case Foo("Hello") =>
^
one error found

View File

@ -1,6 +1,6 @@
bug910.scala:4: error: type mismatch;
found : scala.Seq[scala.Char]
required: scala.Seq[int]
found : Seq[Char]
required: Seq[int]
val y: Seq[int] = rest
^
one error found

View File

@ -1,19 +1,19 @@
checksensible.scala:1: error: class Test needs to be abstract, since method isabstract is not defined
class Test {
^
checksensible.scala:3: warning: comparing values of types scala.Ordered[scala.Unit] and scala.Unit using `>' will always yield false
checksensible.scala:3: warning: comparing values of types Ordered[Unit] and Unit using `>' will always yield false
println((c = 1) > 0)
^
checksensible.scala:4: warning: comparing values of types scala.Ordered[scala.Unit] and scala.Unit using `<=' will always yield true
checksensible.scala:4: warning: comparing values of types Ordered[Unit] and Unit using `<=' will always yield true
println((c = 1) <= 0)
^
checksensible.scala:5: warning: comparing values of types scala.Unit and scala.Int using `==' will always yield false
checksensible.scala:5: warning: comparing values of types Unit and Int using `==' will always yield false
println((c = 1) == 0)
^
checksensible.scala:7: warning: comparing values of types scala.Int and java.lang.String using `==' will always yield false
checksensible.scala:7: warning: comparing values of types Int and java.lang.String using `==' will always yield false
println(1 == "abc")
^
checksensible.scala:8: warning: comparing values of types scala.Int and scala.Boolean using `!=' will always yield true
checksensible.scala:8: warning: comparing values of types Int and Boolean using `!=' will always yield true
println(1 != true)
^
checksensible.scala:10: warning: comparing a fresh object using `==' will always yield false
@ -25,25 +25,25 @@ checksensible.scala:11: warning: comparing a fresh object using `==' will always
checksensible.scala:12: warning: comparing a fresh object using `!=' will always yield true
println(new Array(1) != new Array(1))
^
checksensible.scala:15: warning: comparing values of types scala.Int and scala.Null using `==' will always yield false
checksensible.scala:15: warning: comparing values of types Int and Null using `==' will always yield false
if (foo.length == null) // == 0 makes more sense, but still
^
checksensible.scala:24: warning: comparing values of types scala.Unit and scala.Int using `!=' will always yield true
checksensible.scala:24: warning: comparing values of types Unit and Int using `!=' will always yield true
while ((c = in.read) != -1)
^
checksensible.scala:30: warning: comparing values of types scala.Unit and scala.Boolean using `==' will always yield false
checksensible.scala:30: warning: comparing values of types Unit and Boolean using `==' will always yield false
println({} == true)
^
checksensible.scala:32: warning: comparing a fresh object using `==' will always yield false
println(new Object == 1)
^
checksensible.scala:33: warning: comparing values of types scala.Int and java.lang.Object using `==' will always yield false
checksensible.scala:33: warning: comparing values of types Int and java.lang.Object using `==' will always yield false
println(1 == (new Object))
^
checksensible.scala:37: warning: comparing values of types scala.Int and scala.Unit using `!=' will always yield true
checksensible.scala:37: warning: comparing values of types Int and Unit using `!=' will always yield true
println(1 != println)
^
checksensible.scala:38: warning: comparing values of types scala.Int and scala.Symbol using `!=' will always yield true
checksensible.scala:38: warning: comparing values of types Int and Symbol using `!=' will always yield true
println(1 != 'sym)
^
15 warnings found

View File

@ -11,7 +11,7 @@ constrs.scala:12: error: called constructor's definition must precede calling co
def this(x: boolean) = this(x)
^
constrs.scala:16: error: type mismatch;
found : scala.Int(1)
found : Int(1)
required: a
def this() = this(1)
^

View File

@ -3,7 +3,7 @@ implicits.scala:21: error: type mismatch;
required: ?{val +: ?}
Note that implicit conversions are not applicable because they are ambiguous:
most specific definition is: method pos2int in object Super of type (Pos)int
yet alternative definition method any2plus in object Sub of type (scala.Any)Sub.Plus
yet alternative definition method any2plus in object Sub of type (Any)Sub.Plus
is defined in a subclass.
Both definitions are possible conversion functions from Pos to ?{val +: ?}
f(p+1)

View File

@ -1,16 +1,16 @@
lubs.scala:11: error: type mismatch;
found : test1.this.A[test1.this.A[test1.this.A[scala.Any]]]
required: test1.this.A[test1.this.A[test1.this.A[test1.this.A[scala.Any]]]]
found : test1.this.A[test1.this.A[test1.this.A[Any]]]
required: test1.this.A[test1.this.A[test1.this.A[test1.this.A[Any]]]]
val x4: A[A[A[A[Any]]]] = f
^
lubs.scala:24: error: type mismatch;
found : test2.this.A{type T >: test2.this.C with test2.this.D <: test2.this.A}
required: test2.this.A{type T >: scala.Null <: test2.this.A{type T >: scala.Null <: test2.this.A}}
required: test2.this.A{type T >: Null <: test2.this.A{type T >: Null <: test2.this.A}}
val x3: A { type T >: Null <: A { type T >: Null <: A } } = f
^
lubs.scala:25: error: type mismatch;
found : test2.this.A{type T >: test2.this.C with test2.this.D <: test2.this.A}
required: test2.this.A{type T >: scala.Null <: test2.this.A{type T >: scala.Null <: test2.this.A{type T >: scala.Null <: test2.this.A}}}
required: test2.this.A{type T >: Null <: test2.this.A{type T >: Null <: test2.this.A{type T >: Null <: test2.this.A}}}
val x4: A { type T >: Null <: A { type T >: Null <: A { type T >: Null <: A } } } = f
^
three errors found

View File

@ -1,6 +1,6 @@
overload.scala:10: error: erroneous reference to overloaded definition,
most specific definition is: method f in class C of type (int)scala.Unit,
yet alternative definition method f in class D of type (scala.Any)scala.Unit
most specific definition is: method f in class C of type (int)Unit,
yet alternative definition method f in class D of type (Any)Unit
is defined in a subclass
(new D).f(1)
^

View File

@ -1,4 +1,4 @@
tcpoly_bounds.scala:3: error: type arguments [scala.List] do not conform to class A's type parameter bounds [m<: [x]>: scala.Nothing <: scala.Option[x]]
tcpoly_bounds.scala:3: error: type arguments [List] do not conform to class A's type parameter bounds [m<: [x]>: Nothing <: Option[x]]
object b extends A[List]
^
one error found

View File

@ -1,13 +1,13 @@
tcpoly_typealias.scala:37: error: The kind of type m does not conform to the expected kind of type m<: [+x]>: scala.Nothing <: scala.Any in trait A.
tcpoly_typealias.scala:37: error: The kind of type m does not conform to the expected kind of type m<: [+x]>: Nothing <: Any in trait A.
BInv.this.m's type parameters do not match type m's expected parameters: type x (in trait BInv) is invariant, but type x (in trait A) is declared covariant
type m[x] = FooCov[x] // error: invariant x in alias def
^
tcpoly_typealias.scala:41: error: The kind of type m does not conform to the expected kind of type m<: [+x]>: scala.Nothing <: scala.Any in trait A.
tcpoly_typealias.scala:41: error: The kind of type m does not conform to the expected kind of type m<: [+x]>: Nothing <: Any in trait A.
BCon.this.m's type parameters do not match type m's expected parameters: type x (in trait BCon) is contravariant, but type x (in trait A) is declared covariant
type m[-x] = FooCon[x] // error: contravariant x
^
tcpoly_typealias.scala:45: error: The kind of type m does not conform to the expected kind of type m<: [+x]>: scala.Nothing <: scala.Any in trait A.
BBound.this.m's type parameters do not match type m's expected parameters: type x (in trait BBound)'s bounds >: scala.Nothing <: String are stricter than type x (in trait A)'s declared bounds >: scala.Nothing <: scala.Any
tcpoly_typealias.scala:45: error: The kind of type m does not conform to the expected kind of type m<: [+x]>: Nothing <: Any in trait A.
BBound.this.m's type parameters do not match type m's expected parameters: type x (in trait BBound)'s bounds >: Nothing <: String are stricter than type x (in trait A)'s declared bounds >: Nothing <: Any
type m[+x <: String] = FooBound[x] // error: x with stricter bound
^
three errors found

View File

@ -7,7 +7,7 @@ FooContra's type parameters do not match type m's expected parameters: type x (i
object fcollcon extends coll[FooContra] // error
^
tcpoly_variance_enforce.scala:17: error: the kinds of the type arguments (FooString) do not conform to the expected kinds of the type parameters (type m) in trait coll.
FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: scala.Nothing <: String are stricter than type x's declared bounds >: scala.Nothing <: scala.Any
FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: Any
object fcollwb extends coll[FooString] // error
^
tcpoly_variance_enforce.scala:19: error: the kinds of the type arguments (FooCov) do not conform to the expected kinds of the type parameters (type m) in trait coll2.
@ -19,19 +19,19 @@ FooInvar's type parameters do not match type m's expected parameters: type x (in
object fcoll2inv extends coll2[FooInvar] // error
^
tcpoly_variance_enforce.scala:22: error: the kinds of the type arguments (FooString) do not conform to the expected kinds of the type parameters (type m) in trait coll2.
FooString's type parameters do not match type m's expected parameters: type x (in class FooString) is covariant, but type x is declared contravarianttype x (in class FooString)'s bounds >: scala.Nothing <: String are stricter than type x's declared bounds >: scala.Nothing <: scala.Any
FooString's type parameters do not match type m's expected parameters: type x (in class FooString) is covariant, but type x is declared contravarianttype x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: Any
object fcoll2wb extends coll2[FooString] // error
^
tcpoly_variance_enforce.scala:27: error: the kinds of the type arguments (FooString) do not conform to the expected kinds of the type parameters (type m) in trait coll3.
FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: scala.Nothing <: String are stricter than type x's declared bounds >: scala.Nothing <: scala.Any
FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: Any
object fcoll3wb extends coll3[FooString] // error
^
tcpoly_variance_enforce.scala:30: error: the kinds of the type arguments (FooString,scala.Int) do not conform to the expected kinds of the type parameters (type m,type y) in trait coll4.
FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: scala.Nothing <: String are stricter than type x's declared bounds >: scala.Nothing <: y
tcpoly_variance_enforce.scala:30: error: the kinds of the type arguments (FooString,Int) do not conform to the expected kinds of the type parameters (type m,type y) in trait coll4.
FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: y
object fcoll4_1 extends coll4[FooString, Int] // error
^
tcpoly_variance_enforce.scala:31: error: the kinds of the type arguments (FooString,scala.Any) do not conform to the expected kinds of the type parameters (type m,type y) in trait coll4.
FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: scala.Nothing <: String are stricter than type x's declared bounds >: scala.Nothing <: y
tcpoly_variance_enforce.scala:31: error: the kinds of the type arguments (FooString,Any) do not conform to the expected kinds of the type parameters (type m,type y) in trait coll4.
FooString's type parameters do not match type m's expected parameters: type x (in class FooString)'s bounds >: Nothing <: String are stricter than type x's declared bounds >: Nothing <: y
object fcoll4_2 extends coll4[FooString, Any] // error
^
tcpoly_variance_enforce.scala:37: error: the kinds of the type arguments (FooInvar) do not conform to the expected kinds of the type parameters (type m) in trait coll.

View File

@ -1,6 +1,6 @@
viewtest.scala:43: error: type mismatch;
found : scala.List[a(in method compareTo)]
required: scala.List[a(in method view3)]
found : List[a(in method compareTo)]
required: List[a(in method view3)]
case y1: List[a] => compareLists(x, y1)
^
viewtest.scala:104: error: ambiguous implicit values: