Skip to content

Commit

Permalink
Merge pull request scala#11147 from dotty-staging/fix-#11141
Browse files Browse the repository at this point in the history
Force less when computing the type of a module val
  • Loading branch information
odersky committed Jan 19, 2021
2 parents 4532c71 + a437a82 commit b4d0cd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1328,8 +1328,9 @@ class Namer { typer: Typer =>
*/
def moduleValSig(sym: Symbol)(using Context): Type = {
val clsName = sym.name.moduleClassName
val cls = ctx.denotNamed(clsName).suchThat(_.is(ModuleClass))
.orElse(newStubSymbol(ctx.owner, clsName).assertingErrorsReported)
val cls = ctx.effectiveScope.lookupAll(clsName)
.find(_.is(ModuleClass))
.getOrElse(newStubSymbol(ctx.owner, clsName).assertingErrorsReported)
ctx.owner.thisType.select(clsName, cls)
}

Expand Down
5 changes: 5 additions & 0 deletions tests/pos/i11141.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package p
export X._

object X:
val A = 42

0 comments on commit b4d0cd4

Please sign in to comment.