You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
Jacoby6000
changed the title
GADTs with a covariant phantom type are not properly constructed
GADTs with a co(ntra)variant phantom type are not properly constructed
Aug 15, 2017
Jacoby6000
changed the title
GADTs with a co(ntra)variant phantom type are not properly constructed
GADTs with a co(ntra)variant phantom type are not properly constructed in a pattern match
Aug 15, 2017
Our current implementation of GADTs is limited to invariant type parameters, which is hopefully a limitation we can lift (though this has to be done carefully to avoid issues like in section 3 of http://lampwww.epfl.ch/%7Ehmiller/scala2013/resources/pdfs/paper5.pdf), from Typer.scala:
/** gadtSyms = "all type parameters of enclosing methods that appear * non-variantly in the selector type" todo: should typevars * which appear with variances +1 and -1 (in different * places) be considered as well?*/valgadtSyms:Set[Symbol] = ctx.traceIndented(i"GADT syms of $selType", gadts) {
valaccu=newTypeAccumulator[Set[Symbol]] {
defapply(tsyms: Set[Symbol], t: Type):Set[Symbol] = {
valtsyms1= t match {
casetr: TypeRefif (tr.symbol is TypeParam) && tr.symbol.owner.isTerm && variance ==0=>
tsyms + tr.symbol
case _ =>
tsyms
}
foldOver(tsyms1, t)
}
}
accu(Set.empty, selType)
}
smarter
changed the title
GADTs with a co(ntra)variant phantom type are not properly constructed in a pattern match
GADT matching with variant type parameters is not supported
Aug 15, 2017
Uh oh!
There was an error while loading. Please reload this page.
This works fine if you make
Expr
invariant. It will not work with Covariance or Invariance. They both fail with the same error.Error:
The text was updated successfully, but these errors were encountered: