Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix resolution of children of override lazy val modules #3270

Merged
merged 3 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion main/define/src/mill/define/Reflect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private[mill] object Reflect {
isLegalIdentifier(n) &&
(!noParams || m.getParameterCount == 0) &&
(m.getModifiers & Modifier.STATIC) == 0 &&
(m.getModifiers & Modifier.ABSTRACT) == 0 &&
inner.isAssignableFrom(m.getReturnType)
} yield m

Expand Down
7 changes: 7 additions & 0 deletions main/resolve/test/src/mill/main/ResolveTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1099,5 +1099,12 @@ object ResolveTests extends TestSuite {
)
}
}
test("abstractModule") {
val check = new Checker(TestGraphs.AbstractModule)
test - check(
"__",
Right(Set(_.concrete.tests.inner.foo, _.concrete.tests.inner.innerer.bar))
)
}
}
}
19 changes: 19 additions & 0 deletions main/test/src/mill/util/TestGraphs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -608,4 +608,23 @@ object TestGraphs {
}
}

object AbstractModule extends TestUtil.BaseModule {
trait Abstract extends Module {
lazy val tests: Tests = new Tests {}
trait Tests extends Module {}
}

object concrete extends Abstract {
override lazy val tests: ConcreteTests = new ConcreteTests {}
trait ConcreteTests extends Tests {
object inner extends Module {
def foo = T { "foo" }
object innerer extends Module {
def bar = T { "bar" }
}
}
}
}
}

}