From b7559e35c741e6632c286d93de6a7ec8f2086042 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 18 Jul 2024 15:07:51 +0800 Subject: [PATCH 1/3] . --- main/define/src/mill/define/Reflect.scala | 1 - .../test/src/mill/main/ResolveTests.scala | 7 +++++++ main/test/src/mill/util/TestGraphs.scala | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/main/define/src/mill/define/Reflect.scala b/main/define/src/mill/define/Reflect.scala index 5b6b7e438a2..beb743274e3 100644 --- a/main/define/src/mill/define/Reflect.scala +++ b/main/define/src/mill/define/Reflect.scala @@ -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 diff --git a/main/resolve/test/src/mill/main/ResolveTests.scala b/main/resolve/test/src/mill/main/ResolveTests.scala index 6c8218db9fd..e7e460a2e80 100644 --- a/main/resolve/test/src/mill/main/ResolveTests.scala +++ b/main/resolve/test/src/mill/main/ResolveTests.scala @@ -1099,5 +1099,12 @@ object ResolveTests extends TestSuite { ) } } + test("abstractModule") { + val check = new Checker(TestGraphs.AbstractModule) + test - check( + "concrete.tests.inner.foo", + Right(Set(_.concrete.tests.inner.foo)) + ) + } } } diff --git a/main/test/src/mill/util/TestGraphs.scala b/main/test/src/mill/util/TestGraphs.scala index 3482f6e0636..d716f5bd857 100644 --- a/main/test/src/mill/util/TestGraphs.scala +++ b/main/test/src/mill/util/TestGraphs.scala @@ -608,4 +608,20 @@ 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" } + } + } + } + } + } From aceebe407027b19e5eabb1b3bca590ef2b9d4ecf Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 18 Jul 2024 15:16:16 +0800 Subject: [PATCH 2/3] . --- main/resolve/test/src/mill/main/ResolveTests.scala | 4 ++-- main/test/src/mill/util/TestGraphs.scala | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/main/resolve/test/src/mill/main/ResolveTests.scala b/main/resolve/test/src/mill/main/ResolveTests.scala index e7e460a2e80..45d65bde8fd 100644 --- a/main/resolve/test/src/mill/main/ResolveTests.scala +++ b/main/resolve/test/src/mill/main/ResolveTests.scala @@ -1102,8 +1102,8 @@ object ResolveTests extends TestSuite { test("abstractModule") { val check = new Checker(TestGraphs.AbstractModule) test - check( - "concrete.tests.inner.foo", - Right(Set(_.concrete.tests.inner.foo)) + "__", + Right(Set(_.concrete.tests.inner.foo, _.concrete.tests.inner.innerer.bar)) ) } } diff --git a/main/test/src/mill/util/TestGraphs.scala b/main/test/src/mill/util/TestGraphs.scala index d716f5bd857..93893989e05 100644 --- a/main/test/src/mill/util/TestGraphs.scala +++ b/main/test/src/mill/util/TestGraphs.scala @@ -619,6 +619,9 @@ object TestGraphs { trait ConcreteTests extends Tests { object inner extends Module{ def foo = T { "foo" } + object innerer extends Module{ + def bar = T { "bar" } + } } } } From 1397a5d24830ea0714d072f0c68602c3e2336d33 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 18 Jul 2024 15:25:17 +0800 Subject: [PATCH 3/3] . --- main/test/src/mill/util/TestGraphs.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main/test/src/mill/util/TestGraphs.scala b/main/test/src/mill/util/TestGraphs.scala index 93893989e05..dd92bd3d9b3 100644 --- a/main/test/src/mill/util/TestGraphs.scala +++ b/main/test/src/mill/util/TestGraphs.scala @@ -610,16 +610,16 @@ object TestGraphs { object AbstractModule extends TestUtil.BaseModule { trait Abstract extends Module { - lazy val tests: Tests = new Tests{} - trait Tests extends Module{} + lazy val tests: Tests = new Tests {} + trait Tests extends Module {} } - object concrete extends Abstract{ - override lazy val tests: ConcreteTests = new ConcreteTests{} + object concrete extends Abstract { + override lazy val tests: ConcreteTests = new ConcreteTests {} trait ConcreteTests extends Tests { - object inner extends Module{ + object inner extends Module { def foo = T { "foo" } - object innerer extends Module{ + object innerer extends Module { def bar = T { "bar" } } }