mirror of https://github.com/sbt/sbt.git
Support more Trees in build.sbt
This commit is contained in:
parent
2d2d5136ef
commit
32d7caf7af
|
|
@ -22,7 +22,7 @@ import scala.jdk.CollectionConverters.*
|
|||
import xsbti.PathBasedFile
|
||||
import xsbti.VirtualFile
|
||||
import xsbti.VirtualFileRef
|
||||
import dotty.tools.dotc.ast.untpd.{ Annotated, ValOrDefDef, Tree }
|
||||
import dotty.tools.dotc.ast.untpd.{ Annotated, ExtMethods, ModuleDef, ValOrDefDef, Tree, TypeDef }
|
||||
|
||||
/**
|
||||
* This file is responsible for compiling the .sbt files used to configure sbt builds.
|
||||
|
|
@ -312,6 +312,9 @@ private[sbt] object EvaluateConfigurations {
|
|||
tree match {
|
||||
case Annotated(arg, annot) => isDefinition(arg)
|
||||
case _: ValOrDefDef => true
|
||||
case _: ExtMethods => true
|
||||
case _: TypeDef => true
|
||||
case _: ModuleDef => true
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
extension (a: Int) {
|
||||
infix def x1(b: Int): Int = a + b
|
||||
}
|
||||
|
||||
class A(x: Int) extends B {
|
||||
def y: Int = x + 1
|
||||
}
|
||||
|
||||
trait B
|
||||
|
||||
type MyId[A] = A
|
||||
|
||||
type MatchTypeExample[A] = A match {
|
||||
case Int => String
|
||||
case _ => Int
|
||||
}
|
||||
|
||||
enum Enum1 {
|
||||
case A1, A2
|
||||
}
|
||||
|
||||
object C {
|
||||
val x = 2
|
||||
}
|
||||
|
||||
InputKey[Unit]("check") := {
|
||||
val f: MyId[Int] = 8
|
||||
val a = new A(2)
|
||||
assert(a.y == 3)
|
||||
assert(C.x == 2)
|
||||
assert(Enum1.A2.ordinal == 1)
|
||||
assert((2 x1 3) == 5)
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
> check
|
||||
Loading…
Reference in New Issue