mirror of https://github.com/sbt/sbt.git
Co-authored-by: kenji yoshida <6b656e6a69@gmail.com>
This commit is contained in:
parent
22450b947c
commit
1d6ec91dbc
|
|
@ -19,6 +19,7 @@ import java.nio.file.{ Files, Path, Paths, StandardOpenOption }
|
|||
import java.security.MessageDigest
|
||||
import scala.jdk.CollectionConverters.*
|
||||
import scala.quoted.*
|
||||
import scala.reflect.NameTransformer
|
||||
import sbt.io.{ Hash, IO }
|
||||
|
||||
/**
|
||||
|
|
@ -429,8 +430,9 @@ object Eval:
|
|||
vals ::= name.mangledString
|
||||
case tpd.ValDef(name, tpt, _) if name.is(NameKinds.LazyLocalName) =>
|
||||
val str = name.mangledString
|
||||
val methodName = str.take(str.indexOf("$lzy"))
|
||||
val m = tree.symbol.owner.requiredMethod(methodName.replace("$minus", "-"))
|
||||
val methodName = str.take(str.indexOf(NameTransformer.LAZY_LOCAL_SUFFIX_STRING))
|
||||
val decodedName = NameTransformer.decode(methodName)
|
||||
val m = tree.symbol.owner.requiredMethod(decodedName)
|
||||
if isAcceptableType(m.info) then vals ::= methodName
|
||||
case t: tpd.Template => this((), t.body)
|
||||
case t: tpd.PackageDef => this((), t.stats)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
lazy val `a + b` = "2.13.18"
|
||||
|
||||
// https://github.com/scala/scala3/blob/3.8.2/library/src/scala/reflect/NameTransformer.scala#L47-L64
|
||||
lazy val ~=<>!#%^&|*/+-:\\?@ = "my-name"
|
||||
|
||||
scalaVersion := `a + b`
|
||||
|
||||
name := ~=<>!#%^&|*/+-:\\?@
|
||||
|
||||
InputKey[Unit]("check") := {
|
||||
assert(scalaVersion.value == "2.13.18")
|
||||
assert(name.value == "my-name")
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
> compile
|
||||
> check
|
||||
Loading…
Reference in New Issue