Open nadako opened 3 years ago
I have removed some distractions so that we can look at the actual issue:
enum ExprData<T> {
EBinOp<A>(op : BinOp<A>, a : Expr<A>);
}
enum BinOp<A> {
Like<T:String>:BinOp<T>;
}
abstract Expr<T>(ExprData<T>) {
@:from
static inline function ofData<T>(d:ExprData<T>):Expr<T> {
return null;
}
public function like():Expr<Bool> {
return EBinOp(Like, this);
}
}
This seems to be mostly about the @:from
cast because it fails properly if we use from ExprData<T>
instead.
I extracted this from
tink_sql
:My first question is whether the
like
method should compile? Because within that functionthis
isExprData<T>
, whereT
is supposed to be an unconstrained type parameter and it doesn't sound like it should pass theT:String
constraint check ofLike
.Secondly, if we add
inline
to theofData
method, we actually get an error talking about this:And thirdly, looks like
have
andwant
are swapped in this error message?