Skip to content

Commit 8af1b29

Browse files
committed
Reformat the output when printing a function to console in init checker
1 parent 603822e commit 8af1b29

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/transform/init/Semantic.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ object Semantic:
6969
val argsText = if args.nonEmpty then ", args = " + args.map(_.show).mkString("(", ", ", ")") else ""
7070
"a non-transitively initialized (Warm) object of type (" + klass.show + ") { outer = " + outer.show + argsText + " }"
7171
case Fun(expr, thisV, klass) =>
72-
"a function where \"this\" is (" + thisV.show + ") and the function owner is an object of type (" + klass.show + ")"
72+
"a function where \"this\" is (" + thisV.show + ")"
7373
case RefSet(values) =>
7474
values.map(_.show).mkString("Set { ", ", ", " }")
7575
case Hot =>

tests/init/neg/closureLeak.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- Error: tests/init/neg/closureLeak.scala:11:14 -----------------------------------------------------------------------
22
11 | l.foreach(a => a.addX(this)) // error
33
| ^^^^^^^^^^^^^^^^^
4-
|Could not verify that the method argument is transitively initialized (Hot). It was found to be a function where "this" is (the original object of type (class Outer) where initialization checking started) and the function owner is an object of type (class Outer). Only transitively initialized arguments may be passed to methods (except constructors). Calling trace:
4+
|Could not verify that the method argument is transitively initialized (Hot). It was found to be a function where "this" is (the original object of type (class Outer) where initialization checking started). Only transitively initialized arguments may be passed to methods (except constructors). Calling trace:
55
|-> class Outer { [ closureLeak.scala:1 ]
66
| ^
77
|-> l.foreach(a => a.addX(this)) // error [ closureLeak.scala:11 ]

tests/init/neg/t3273.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- Error: tests/init/neg/t3273.scala:4:42 ------------------------------------------------------------------------------
22
4 | val num1: LazyList[Int] = 1 #:: num1.map(_ + 1) // error
33
| ^^^^^^^^^^^^^^^
4-
|Could not verify that the method argument is transitively initialized (Hot). It was found to be a function where "this" is (the original object of type (object Test) where initialization checking started) and the function owner is an object of type (object Test). Only transitively initialized arguments may be passed to methods (except constructors). Calling trace:
4+
|Could not verify that the method argument is transitively initialized (Hot). It was found to be a function where "this" is (the original object of type (object Test) where initialization checking started). Only transitively initialized arguments may be passed to methods (except constructors). Calling trace:
55
|-> object Test { [ t3273.scala:3 ]
66
| ^
77
|-> val num1: LazyList[Int] = 1 #:: num1.map(_ + 1) // error [ t3273.scala:4 ]
@@ -14,7 +14,7 @@
1414
-- Error: tests/init/neg/t3273.scala:5:61 ------------------------------------------------------------------------------
1515
5 | val num2: LazyList[Int] = 1 #:: num2.iterator.map(_ + 1).to(LazyList) // error
1616
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17-
|Could not verify that the method argument is transitively initialized (Hot). It was found to be a function where "this" is (the original object of type (object Test) where initialization checking started) and the function owner is an object of type (object Test). Only transitively initialized arguments may be passed to methods (except constructors). Calling trace:
17+
|Could not verify that the method argument is transitively initialized (Hot). It was found to be a function where "this" is (the original object of type (object Test) where initialization checking started). Only transitively initialized arguments may be passed to methods (except constructors). Calling trace:
1818
|-> object Test { [ t3273.scala:3 ]
1919
| ^
2020
|-> val num2: LazyList[Int] = 1 #:: num2.iterator.map(_ + 1).to(LazyList) // error [ t3273.scala:5 ]

0 commit comments

Comments
 (0)