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/buildmanager/t2556_1/t2556_1.check | 6 +++--- test/files/buildmanager/t2556_2/t2556_2.check | 8 ++++---- test/files/buildmanager/t2556_3/t2556_3.check | 4 ++-- test/files/buildmanager/t2557/t2557.check | 6 +++--- test/files/buildmanager/t2562/t2562.check | 10 +++++----- test/files/buildmanager/t2650_2/t2650_2.check | 1 + test/files/buildmanager/t2650_3/t2650_3.check | 1 + test/files/buildmanager/t2650_4/t2650_4.check | 1 + test/files/buildmanager/t2655/t2655.check | 2 +- test/files/buildmanager/t2657/t2657.check | 4 ++-- test/files/buildmanager/t2790/t2790.check | 4 ++-- 11 files changed, 25 insertions(+), 22 deletions(-) (limited to 'test/files/buildmanager') diff --git a/test/files/buildmanager/t2556_1/t2556_1.check b/test/files/buildmanager/t2556_1/t2556_1.check index dc9437fa7e..2e501c8f6f 100644 --- a/test/files/buildmanager/t2556_1/t2556_1.check +++ b/test/files/buildmanager/t2556_1/t2556_1.check @@ -3,10 +3,10 @@ compiling Set(A.scala, B.scala) Changes: Map() builder > A.scala compiling Set(A.scala) -Changes: Map(class A -> List(Changed(Definition(A.x))[method x changed from (i: Int)java.lang.String to (i: java.lang.String)java.lang.String flags: ])) -invalidate B.scala because inherited method changed [Changed(Definition(A.x))[method x changed from (i: Int)java.lang.String to (i: java.lang.String)java.lang.String flags: ]] +Changes: Map(class A -> List(Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: ])) +invalidate B.scala because inherited method changed [Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: ]] compiling Set(B.scala) -B.scala:2: error: overriding method x in class A of type (i: String)java.lang.String; +B.scala:2: error: overriding method x in class A of type (i: String)String; method x needs `override' modifier def x(s: String) = s+"5" ^ diff --git a/test/files/buildmanager/t2556_2/t2556_2.check b/test/files/buildmanager/t2556_2/t2556_2.check index a4d6724b11..cae4f72212 100644 --- a/test/files/buildmanager/t2556_2/t2556_2.check +++ b/test/files/buildmanager/t2556_2/t2556_2.check @@ -3,11 +3,11 @@ compiling Set(A.scala, B.scala, C.scala) Changes: Map() builder > A.scala compiling Set(A.scala) -Changes: Map(class A -> List(Changed(Definition(A.x))[method x changed from (i: Int)java.lang.String to (i: java.lang.String)java.lang.String flags: ])) -invalidate B.scala because inherited method changed [Changed(Definition(A.x))[method x changed from (i: Int)java.lang.String to (i: java.lang.String)java.lang.String flags: ]] -invalidate C.scala because inherited method changed [Changed(Definition(A.x))[method x changed from (i: Int)java.lang.String to (i: java.lang.String)java.lang.String flags: ]] +Changes: Map(class A -> List(Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: ])) +invalidate B.scala because inherited method changed [Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: ]] +invalidate C.scala because inherited method changed [Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: ]] compiling Set(B.scala, C.scala) -C.scala:2: error: overriding method x in class A of type (i: String)java.lang.String; +C.scala:2: error: overriding method x in class A of type (i: String)String; method x needs `override' modifier def x(s: String) = s+"5" ^ diff --git a/test/files/buildmanager/t2556_3/t2556_3.check b/test/files/buildmanager/t2556_3/t2556_3.check index 01dfa79b12..bf26602494 100644 --- a/test/files/buildmanager/t2556_3/t2556_3.check +++ b/test/files/buildmanager/t2556_3/t2556_3.check @@ -3,8 +3,8 @@ compiling Set(A.scala, B.scala, C.scala) Changes: Map() builder > A.scala compiling Set(A.scala) -Changes: Map(class A -> List(), class B -> List(Changed(Class(B))[List((A,java.lang.Object), (ScalaObject,ScalaObject))])) -invalidate C.scala because parents have changed [Changed(Class(B))[List((A,java.lang.Object), (ScalaObject,ScalaObject))]] +Changes: Map(class A -> List(), class B -> List(Changed(Class(B))[List((A,Object), (ScalaObject,ScalaObject))])) +invalidate C.scala because parents have changed [Changed(Class(B))[List((A,Object), (ScalaObject,ScalaObject))]] invalidate B.scala because it references invalid (no longer inherited) definition [ParentChanged(Class(C))] compiling Set(B.scala, C.scala) B.scala:3: error: type mismatch; diff --git a/test/files/buildmanager/t2557/t2557.check b/test/files/buildmanager/t2557/t2557.check index f51e801017..736ef3645e 100644 --- a/test/files/buildmanager/t2557/t2557.check +++ b/test/files/buildmanager/t2557/t2557.check @@ -3,8 +3,8 @@ compiling Set(A.scala, B.scala, C.scala, D.scala, E.scala, F.scala) Changes: Map() builder > D.scala compiling Set(D.scala) -Changes: Map(trait D -> List(Changed(Class(D))[List((java.lang.Object,java.lang.Object), (C,B), (B,C))])) -invalidate E.scala because parents have changed [Changed(Class(D))[List((java.lang.Object,java.lang.Object), (C,B), (B,C))]] -invalidate F.scala because parents have changed [Changed(Class(D))[List((java.lang.Object,java.lang.Object), (C,B), (B,C))]] +Changes: Map(trait D -> List(Changed(Class(D))[List((Object,Object), (C,B), (B,C))])) +invalidate E.scala because parents have changed [Changed(Class(D))[List((Object,Object), (C,B), (B,C))]] +invalidate F.scala because parents have changed [Changed(Class(D))[List((Object,Object), (C,B), (B,C))]] compiling Set(E.scala, F.scala) Changes: Map(object F -> List(), trait E -> List()) diff --git a/test/files/buildmanager/t2562/t2562.check b/test/files/buildmanager/t2562/t2562.check index 813d2735e1..390bbb9986 100644 --- a/test/files/buildmanager/t2562/t2562.check +++ b/test/files/buildmanager/t2562/t2562.check @@ -3,10 +3,10 @@ compiling Set(A.scala, B.scala) Changes: Map() builder > A.scala compiling Set(A.scala) -Changes: Map(object A -> List(Changed(Definition(A.x3))[method x3 changed from ()Int to ()java.lang.String flags: ])) -invalidate B.scala because it references changed definition [Changed(Definition(A.x3))[method x3 changed from ()Int to ()java.lang.String flags: ]] +Changes: Map(object A -> List(Changed(Definition(A.x3))[method x3 changed from ()Int to ()String flags: ])) +invalidate B.scala because it references changed definition [Changed(Definition(A.x3))[method x3 changed from ()Int to ()String flags: ]] compiling Set(B.scala) -Changes: Map(object B -> List(Changed(Definition(B.x2))[method x2 changed from ()Int to ()java.lang.String flags: ])) -invalidate A.scala because it references changed definition [Changed(Definition(B.x2))[method x2 changed from ()Int to ()java.lang.String flags: ]] +Changes: Map(object B -> List(Changed(Definition(B.x2))[method x2 changed from ()Int to ()String flags: ])) +invalidate A.scala because it references changed definition [Changed(Definition(B.x2))[method x2 changed from ()Int to ()String flags: ]] compiling Set(A.scala, B.scala) -Changes: Map(object A -> List(Changed(Definition(A.x0))[method x0 changed from ()Int to ()java.lang.String flags: ], Changed(Definition(A.x1))[method x1 changed from ()Int to ()java.lang.String flags: ], Changed(Definition(A.x2))[method x2 changed from ()Int to ()java.lang.String flags: ]), object B -> List(Changed(Definition(B.x0))[method x0 changed from ()Int to ()java.lang.String flags: ], Changed(Definition(B.x1))[method x1 changed from ()Int to ()java.lang.String flags: ])) +Changes: Map(object A -> List(Changed(Definition(A.x0))[method x0 changed from ()Int to ()String flags: ], Changed(Definition(A.x1))[method x1 changed from ()Int to ()String flags: ], Changed(Definition(A.x2))[method x2 changed from ()Int to ()String flags: ]), object B -> List(Changed(Definition(B.x0))[method x0 changed from ()Int to ()String flags: ], Changed(Definition(B.x1))[method x1 changed from ()Int to ()String flags: ])) diff --git a/test/files/buildmanager/t2650_2/t2650_2.check b/test/files/buildmanager/t2650_2/t2650_2.check index 7ab72fb619..53a0287dfc 100644 --- a/test/files/buildmanager/t2650_2/t2650_2.check +++ b/test/files/buildmanager/t2650_2/t2650_2.check @@ -8,6 +8,7 @@ invalidate B.scala because inherited method changed [Changed(Definition(A.S))[ty compiling Set(B.scala) B.scala:3: error: type mismatch; found : B.this.S + (which expands to) Long required: Int def y: Int = x ^ diff --git a/test/files/buildmanager/t2650_3/t2650_3.check b/test/files/buildmanager/t2650_3/t2650_3.check index 27be2f5ae8..5c6326d59f 100644 --- a/test/files/buildmanager/t2650_3/t2650_3.check +++ b/test/files/buildmanager/t2650_3/t2650_3.check @@ -8,6 +8,7 @@ invalidate B.scala because it references changed definition [Changed(Definition( compiling Set(B.scala) B.scala:2: error: type mismatch; found : a.T + (which expands to) Long required: Int def x(a: A): Int = a.x ^ diff --git a/test/files/buildmanager/t2650_4/t2650_4.check b/test/files/buildmanager/t2650_4/t2650_4.check index ba092d013f..a4aeaddfbb 100644 --- a/test/files/buildmanager/t2650_4/t2650_4.check +++ b/test/files/buildmanager/t2650_4/t2650_4.check @@ -8,6 +8,7 @@ invalidate B.scala because it references changed definition [Changed(Definition( compiling Set(B.scala) B.scala:2: error: type mismatch; found : a.T2 + (which expands to) Long required: Int def x(a: A): Int = a.x ^ diff --git a/test/files/buildmanager/t2655/t2655.check b/test/files/buildmanager/t2655/t2655.check index a4a071ed70..c473e9fd6e 100644 --- a/test/files/buildmanager/t2655/t2655.check +++ b/test/files/buildmanager/t2655/t2655.check @@ -7,7 +7,7 @@ Changes: Map(object A -> List(Changed(Definition(A.x))[method x changed from (i: invalidate B.scala because it references changed definition [Changed(Definition(A.x))[method x changed from (i: Function0)Unit to (i: Function0)Unit flags: ]] compiling Set(B.scala) B.scala:2: error: type mismatch; - found : java.lang.String("3") + found : String("3") required: () => String val x = A.x("3") ^ diff --git a/test/files/buildmanager/t2657/t2657.check b/test/files/buildmanager/t2657/t2657.check index 9713f66024..3fd0e0666d 100644 --- a/test/files/buildmanager/t2657/t2657.check +++ b/test/files/buildmanager/t2657/t2657.check @@ -3,8 +3,8 @@ compiling Set(A.scala, B.scala) Changes: Map() builder > A.scala compiling Set(A.scala) -Changes: Map(class A -> List(Changed(Definition(A.y))[method y changed from (i: Int)java.lang.String to (i: Int)java.lang.String flags: implicit ])) -invalidate B.scala because inherited method changed [Changed(Definition(A.y))[method y changed from (i: Int)java.lang.String to (i: Int)java.lang.String flags: implicit ]] +Changes: Map(class A -> List(Changed(Definition(A.y))[method y changed from (i: Int)String to (i: Int)String flags: implicit ])) +invalidate B.scala because inherited method changed [Changed(Definition(A.y))[method y changed from (i: Int)String to (i: Int)String flags: implicit ]] compiling Set(B.scala) B.scala:2: error: type mismatch; found : Int(3) diff --git a/test/files/buildmanager/t2790/t2790.check b/test/files/buildmanager/t2790/t2790.check index 9d37ccea29..4e41db4e49 100644 --- a/test/files/buildmanager/t2790/t2790.check +++ b/test/files/buildmanager/t2790/t2790.check @@ -3,8 +3,8 @@ compiling Set(A.scala, B.scala) Changes: Map() builder > A.scala compiling Set(A.scala) -Changes: Map(object A -> List(Added(Definition(A.x)), Changed(Definition(A.x))[value x changed from (f: java.lang.String, g: Int)Int to (f: java.lang.String, g: Int)Int (f: Int, g: Int)Int flags: ])) -invalidate B.scala because it references changed definition [Changed(Definition(A.x))[value x changed from (f: java.lang.String, g: Int)Int to (f: java.lang.String, g: Int)Int (f: Int, g: Int)Int flags: ]] +Changes: Map(object A -> List(Added(Definition(A.x)), Changed(Definition(A.x))[value x changed from (f: String, g: Int)Int to (f: String, g: Int)Int (f: Int, g: Int)Int flags: ])) +invalidate B.scala because it references changed definition [Changed(Definition(A.x))[value x changed from (f: String, g: Int)Int to (f: String, g: Int)Int (f: Int, g: Int)Int flags: ]] compiling Set(B.scala) B.scala:2: error: type mismatch; found : Int(5) -- cgit v1.2.3