Skip to content

Commit ea24c55

Browse files
committed
Move typing of usecases to typedClassDef
1 parent 7a52440 commit ea24c55

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

dottydoc/test/UsecaseTest.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,13 @@ class UsecaseTest extends DottyTest {
141141
}
142142
}
143143

144-
@Test def checkIterator = {
145-
val sources =
146-
"./scala-scala/src/library/scala/collection/Iterator.scala" :: Nil
144+
@Test def checkIterator =
145+
checkFiles("./scala-scala/src/library/scala/collection/Iterator.scala" :: Nil) { _ =>
146+
// success if typer throws no errors! :)
147+
}
147148

148-
checkFiles(sources) { packages =>
149+
@Test def checkIterableLike =
150+
checkFiles("./scala-scala/src/library/scala/collection/IterableLike.scala" :: Nil) { _ =>
149151
// success if typer throws no errors! :)
150152
}
151-
}
152153
}

src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
12451245
val self1 = typed(self)(ctx.outer).asInstanceOf[ValDef] // outer context where class members are not visible
12461246
val dummy = localDummy(cls, impl)
12471247
val body1 = typedStats(impl.body, dummy)(inClassContext(self1.symbol))
1248+
1249+
typedUsecases(body1.map(_.symbol), self1.symbol)
1250+
12481251
checkNoDoubleDefs(cls)
12491252
val impl1 = cpy.Template(impl)(constr1, parents1, self1, body1)
12501253
.withType(dummy.nonMemberTermRef)
@@ -1520,9 +1523,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
15201523
buf += typed(stat)(ctx.exprContext(stat, exprOwner))
15211524
traverse(rest)
15221525
case nil =>
1523-
val tpdStats = buf.toList
1524-
typedUsecases(tpdStats.map(_.symbol), exprOwner)
1525-
tpdStats
1526+
buf.toList
15261527
}
15271528
traverse(stats)
15281529
}

0 commit comments

Comments
 (0)