File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,7 @@ object Errors:
2121 def issue (using Context ): Unit =
2222 report.warning(show + stacktrace, this .pos)
2323
24- private def isTraceInformative (using Context ): Boolean =
25- trace.size > 1 || trace.size == 1 && trace.head.sourcePos.ne(pos)
26-
27- def stacktrace (using Context ): String = if ! isTraceInformative then " " else " Calling trace:\n " + {
24+ def stacktrace (using Context ): String = if trace.isEmpty then " " else " Calling trace:\n " + {
2825 var lastLineNum = - 1
2926 var lines : mutable.ArrayBuffer [String ] = new mutable.ArrayBuffer
3027 trace.foreach { tree =>
@@ -107,10 +104,8 @@ object Errors:
107104 override def issue (using Context ): Unit =
108105 report.warning(show, this .pos)
109106
110- def show (using Context ): String = {
111- var index = 0
107+ def show (using Context ): String =
112108 msg + stacktrace + " \n " +
113109 " Promoting the value to fully initialized failed due to the following problem:\n " +
114110 error.show + error.stacktrace
115- }
116111 }
Original file line number Diff line number Diff line change @@ -1145,7 +1145,7 @@ object Semantic {
11451145
11461146 case id @ Ident (name) if ! id.symbol.is(Flags .Method ) =>
11471147 assert(name.isTermName, " type trees should not reach here" )
1148- cases(expr.tpe, thisV, klass)
1148+ withTrace(trace2) { cases(expr.tpe, thisV, klass) }
11491149
11501150 case NewExpr (tref, New (tpt), ctor, argss) =>
11511151 // check args
Original file line number Diff line number Diff line change 88 | ^^^^^^^^^^^^^^^
99 |
1010 | Promoting the value to fully initialized failed due to the following problem:
11- | Access non-initialized value num1.
11+ | Access non-initialized value num1. Calling trace:
12+ | -> val num1: LazyList[Int] = 1 #:: num1.map(_ + 1) // error [ t3273.scala:4 ]
13+ | ^^^^
1214-- Error: tests/init/neg/t3273.scala:5:61 ------------------------------------------------------------------------------
13155 | val num2: LazyList[Int] = 1 #:: num2.iterator.map(_ + 1).to(LazyList) // error
1416 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1921 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2022 |
2123 | Promoting the value to fully initialized failed due to the following problem:
22- | Access non-initialized value num2.
24+ | Access non-initialized value num2. Calling trace:
25+ | -> val num2: LazyList[Int] = 1 #:: num2.iterator.map(_ + 1).to(LazyList) // error [ t3273.scala:5 ]
26+ | ^^^^
You can’t perform that action at this time.
0 commit comments