Check that integer literals are primitive types in patterns
This commit is contained in:
committed by
Chris Fallin
parent
ce207ee953
commit
d2bd07c246
@@ -1034,6 +1034,16 @@ impl TermEnv {
|
||||
return None;
|
||||
}
|
||||
};
|
||||
if !tyenv.types[ty.index()].is_prim() {
|
||||
tyenv.report_error(
|
||||
pos,
|
||||
format!(
|
||||
"expected non-primitive type {}, but found integer literal '{}'",
|
||||
tyenv.types[ty.index()].name(tyenv),
|
||||
val,
|
||||
),
|
||||
);
|
||||
}
|
||||
Some((Pattern::ConstInt(ty, val), ty))
|
||||
}
|
||||
&ast::Pattern::ConstPrim { ref val, pos } => {
|
||||
|
||||
Reference in New Issue
Block a user