-
Notifications
You must be signed in to change notification settings - Fork 1.1k
boundsViolation of lower bound 'Nothing' when constructing a partial function from tasty. #9254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
dotty-cps-minimized-break-lo.tar.gz attached a full archive with sbt files, which shows this error when run 'test:compile'. |
btw, in TypeComparison we compare tp1 with TypeNothing via eq. Not sure, that we systematically normalize all possible TypeNothing entries in constructors.
and what NothingType:
|
Partial minimization and workaround. package cps
import scala.quoted._
trait CpsMonad[F[_]]
trait ComputationBound[T]
implicit object ComputationBoundMonad extends CpsMonad[ComputationBound]
inline def async[F[_]](using am:CpsMonad[F]): Async.InferAsyncArg[F] =
new Async.InferAsyncArg[F]
object PFHelper {
def create[Y]:PartialFunction[Any,Y] = ???
}
object Async {
class InferAsyncArg[F[_]](using am:CpsMonad[F]) {
inline def apply[T](inline expr: T):Any = ${ Async.transformImpl[F,T]('expr) }
}
def transformImpl[F[_]:Type,T:Type](f: Expr[T])(using qctx: QuoteContext): Expr[Any] =
import qctx.tasty._
f.unseal match
case Inlined(_,_,Block(_,Apply(TypeApply(Select(q,n),tparams),List(param)))) =>
param.tpe match
case AppliedType(tp,tparams1) =>
val toWrapped = AppliedType(summon[quoted.Type[F]].unseal.tpe, List(tparams1.tail.head)) // issue seems to be here
// val toWrapped = // workaround
// tparams1.tail.head.asInstanceOf[Type].seal match
// case '[$t] => '[F[$t]].unseal.tpe.asInstanceOf[Type]
toWrapped.seal match
case '[$wrappedTp] =>
println(wrappedTp.show)
'{ cps.PFHelper.create[$wrappedTp] }
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Minimized code
file 1:
file2:
Output
Note, that error is about lower-bound Nothing, but type trace shows the opposite.
If we will print an expression in TypeOps:
'compiler/src/dotty/tools/dotc/core/TypeOps.scala'
near line 585 we will see, that violation is created, when
where
which is quite strange.
(will think, how to pass debug flag into <:< )
Expectation
should be compiled.
The text was updated successfully, but these errors were encountered: