Skip to content

Commit 4e186a5

Browse files
committed
Improve error message
1 parent dc5a68f commit 4e186a5

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

compiler/src/dotty/tools/dotc/config/Config.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ object Config {
167167
final val showCompletions = false
168168

169169
/** If set, enables tracing */
170-
final val tracingEnabled = false
170+
final val tracingEnabled = true
171171

172172
/** Initial capacity of uniques HashMap.
173173
* Note: This MUST BE a power of two to work with util.HashSet

compiler/src/dotty/tools/dotc/config/Printers.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ object Printers {
4141
val subtyping: Printer = noPrinter
4242
val tailrec: Printer = noPrinter
4343
val transforms: Printer = noPrinter
44-
val typr: Printer = noPrinter
44+
val typr: Printer = new Printer
4545
val unapp: Printer = noPrinter
4646
val variances: Printer = noPrinter
4747
}

compiler/src/dotty/tools/dotc/core/Flags.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ object Flags {
134134
}
135135

136136
/** The list of non-empty names of flags that are set in the given flag set */
137-
def flagStrings(privateWithin: String): Seq[String] = {
137+
def flagStrings(privateWithin: String = ""): Seq[String] = {
138138
var rawStrings = (2 to MaxFlag).flatMap(x.flagString(_)) // DOTTY problem: cannot drop with (_)
139139
if (!privateWithin.isEmpty && !x.is(Protected))
140140
rawStrings = rawStrings :+ "private"

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -3847,7 +3847,7 @@ object Parsers {
38473847
def checkLegal(tree: Tree): List[Tree] =
38483848
val problem = tree match
38493849
case tree: MemberDef if !(tree.mods.flags & ModifierFlags).isEmpty =>
3850-
i"refinement cannot be ${(tree.mods.flags & ModifierFlags).flagsString}"
3850+
i"refinement cannot be ${(tree.mods.flags & ModifierFlags).flagStrings().mkString("`", "`, `", "`")}"
38513851
case tree: ValOrDefDef =>
38523852
if tree.rhs.isEmpty then ""
38533853
else "refinement in cannot have a right-hand side"

tests/neg/i8150.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
trait A
22
trait B
3-
type T = {given(given a: A) as B}
3+
type T = {given(given a: A) as B} // error: refinement cannot be `given`

0 commit comments

Comments
 (0)