Skip to content

Commit b0564ae

Browse files
committed
Improve type mismatch errors with fully qualified names for types within the scala package
1 parent c88c0fe commit b0564ae

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@ class PlainPrinter(_ctx: Context) extends Printer {
192192
case tp: TermRef if tp.denot.isOverloaded =>
193193
"<overloaded " ~ toTextRef(tp) ~ ">"
194194
case tp: TypeRef =>
195-
if (printWithoutPrefix.contains(tp.symbol))
196-
toText(tp.name)
197-
else
198195
toTextPrefixOf(tp) ~ selectionString(tp)
199196
case tp: TermParamRef =>
200197
ParamRefNameString(tp) ~ lambdaHash(tp.binder) ~ ".type"

tests/neg/i18678b.check

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- [E007] Type Mismatch Error: tests/neg/i18678b.scala:3:16 --------------------
2+
3 |def s: String = "" // error
3+
| ^^
4+
| Found: ("" : String)
5+
| Required: String²
6+
|
7+
| where: String is a class in package java.lang
8+
| String² is a class in the empty package
9+
|
10+
| longer explanation available when compiling with `-explain`

tests/neg/i18678b.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class String
2+
3+
def s: String = "" // error

0 commit comments

Comments
 (0)