Skip to content

Commit 7d5bd7c

Browse files
committed
Move typing of usecases to typedClassDef
1 parent c8b3504 commit 7d5bd7c

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
@@ -1183,6 +1183,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
11831183
val self1 = typed(self)(ctx.outer).asInstanceOf[ValDef] // outer context where class members are not visible
11841184
val dummy = localDummy(cls, impl)
11851185
val body1 = typedStats(impl.body, dummy)(inClassContext(self1.symbol))
1186+
1187+
typedUsecases(body1.map(_.symbol), self1.symbol)
1188+
11861189
checkNoDoubleDefs(cls)
11871190
val impl1 = cpy.Template(impl)(constr1, parents1, self1, body1)
11881191
.withType(dummy.nonMemberTermRef)
@@ -1444,9 +1447,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
14441447
buf += typed(stat)(ctx.exprContext(stat, exprOwner))
14451448
traverse(rest)
14461449
case nil =>
1447-
val tpdStats = buf.toList
1448-
typedUsecases(tpdStats.map(_.symbol), exprOwner)
1449-
tpdStats
1450+
buf.toList
14501451
}
14511452
traverse(stats)
14521453
}

0 commit comments

Comments
 (0)