Skip to content
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
6 changes: 6 additions & 0 deletions tests/pos-macros/i13021/DFBits.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
object DFBits:
opaque type Token[W <: Int] <: DFToken.Of[Int] = DFToken.Of[Int]
extension [W <: Int](token: Token[W])
def data: Int =
token.asIR
1
14 changes: 14 additions & 0 deletions tests/pos-macros/i13021/DFToken.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
trait Token:
val data: Any

opaque type DFToken = Token
object DFToken:
extension (of: DFToken) def asIR: Token = ???

opaque type Of[D] <: DFToken = DFToken
object Of:
extension [D](token: Of[D]) def width(using w: Width[?]): Int = ???

def getWidth[W <: Int](token: DFBits.Token[W]): Int = token.width
def getData[W <: Int](token: DFBits.Token[W]): Int =
token.data //error here
12 changes: 12 additions & 0 deletions tests/pos-macros/i13021/Width.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import scala.quoted.*

trait Width[T]:
type Out <: Int
object Width:
transparent inline given [T]: Width[T] = ${ getWidthMacro[T] }
def getWidthMacro[T](using Quotes, Type[T]): Expr[Width[T]] =
'{
new Width[T] {
type Out = Int
}
}