Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check for right Tests traits in ScalaJS and Native (#2874)
## Motivation People get confused when they do things like: ```scala import mill._ import mill.scalalib._ import mill.scalajslib._ object root extends ScalaJSModule { def scalaVersion: T[String] = "3.3.1" def scalaJSVersion: T[String] = "1.14.0" object test extends ScalaTests with TestModule.Utest } ``` which doesn't work since we need to extend `ScalaJSTests` instead of `ScalaTests`. Now we crash with an exception: ``` [build.sc] [49/53] compile [info] compiling 1 Scala source to /Users/lorenzo/scala/repro/out/mill-build/compile.dest/classes ... [info] done compiling [build.sc] [53/53] methodCodeHashSignatures mill.api.MillException: root is a `ScalaJSModule`. root.test needs to extend `ScalaJSTests`. mill.scalalib.ScalaModule$ScalaTests.$init$(ScalaModule.scala:37) millbuild.build$root$test$.<init>(build.sc:8) millbuild.build$root$.test$lzycompute$1(build.sc:30) millbuild.build$root$.test(build.sc:30) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) mill.resolve.ResolveCore$.$anonfun$resolveDirectChildren0$10(ResolveCore.scala:272) ``` Pull Request: #2874 --------- Co-authored-by: Tobias Roeser <le.petit.fou@web.de>
- Loading branch information