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:
21
21
def issue (using Context ): Unit =
22
22
report.warning(show + stacktrace, this .pos)
23
23
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 " + {
28
25
var lastLineNum = - 1
29
26
var lines : mutable.ArrayBuffer [String ] = new mutable.ArrayBuffer
30
27
trace.foreach { tree =>
@@ -107,10 +104,8 @@ object Errors:
107
104
override def issue (using Context ): Unit =
108
105
report.warning(show, this .pos)
109
106
110
- def show (using Context ): String = {
111
- var index = 0
107
+ def show (using Context ): String =
112
108
msg + stacktrace + " \n " +
113
109
" Promoting the value to fully initialized failed due to the following problem:\n " +
114
110
error.show + error.stacktrace
115
- }
116
111
}
Original file line number Diff line number Diff line change @@ -1145,7 +1145,7 @@ object Semantic {
1145
1145
1146
1146
case id @ Ident (name) if ! id.symbol.is(Flags .Method ) =>
1147
1147
assert(name.isTermName, " type trees should not reach here" )
1148
- cases(expr.tpe, thisV, klass)
1148
+ withTrace(trace2) { cases(expr.tpe, thisV, klass) }
1149
1149
1150
1150
case NewExpr (tref, New (tpt), ctor, argss) =>
1151
1151
// check args
Original file line number Diff line number Diff line change 8
8
| ^^^^^^^^^^^^^^^
9
9
|
10
10
| 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
+ | ^^^^
12
14
-- Error: tests/init/neg/t3273.scala:5:61 ------------------------------------------------------------------------------
13
15
5 | val num2: LazyList[Int] = 1 #:: num2.iterator.map(_ + 1).to(LazyList) // error
14
16
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
21
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20
22
|
21
23
| 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