File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ package init
4
4
5
5
import core ._
6
6
import Contexts .Context
7
- import ast .tpd ._
8
7
import Decorators ._
8
+ import StdNames ._
9
9
import Symbols ._
10
10
import Constants .Constant
11
11
import Types ._
12
+
13
+ import ast .tpd ._
12
14
import config .Printers .init
13
15
import reporting .trace
14
16
@@ -26,6 +28,10 @@ object Summarization {
26
28
def analyze (expr : Tree )(implicit env : Env ): Summary =
27
29
trace(" summarizing " + expr.show, init, s => Summary .show(s.asInstanceOf [Summary ])) {
28
30
val summary : Summary = expr match {
31
+ case Ident (nme.WILDCARD ) =>
32
+ // TODO: disallow `var x: T = _`
33
+ Summary .empty
34
+
29
35
case Ident (name) =>
30
36
assert(name.isTermName, " type trees should not reach here" )
31
37
analyze(expr.tpe, expr)
@@ -229,7 +235,10 @@ object Summarization {
229
235
val thisRef = ThisRef (thisTp.classSymbol.asClass)(source)
230
236
val pot = SuperRef (thisRef, superTp.classSymbol.asClass)(source)
231
237
Summary .empty + pot
232
- }
238
+
239
+ case _ =>
240
+ throw new Exception (" unexpected type: " + tp.show)
241
+ }
233
242
234
243
if (env.isAlwaysInitialized(tp)) (Potentials .empty, summary._2)
235
244
else summary
Original file line number Diff line number Diff line change @@ -285,10 +285,7 @@ class CompilationTests extends ParallelTesting {
285
285
@ Test def checkInitNeg : Unit = {
286
286
implicit val testGroup : TestGroup = TestGroup (" checkInit" )
287
287
val options = defaultOptions.and(" -Ycheck-init" , " -Xfatal-warnings" )
288
- aggregateTests(
289
- compileFilesInDir(" tests/init/neg/" , options),
290
- compileFilesInDir(" tests/init/crash" , options),
291
- )
288
+ compileFilesInDir(" tests/init/neg/" , options)
292
289
}.checkExpectedErrors()
293
290
294
291
@ Test def checkInitCrash : Unit = {
You can’t perform that action at this time.
0 commit comments