mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Initial support for where expressions. (#1310)
Build constraint types from `where` expressions. This is very bare-bones; there's no support for constraining `.Self` or associated types yet, but degenerate cases not involving self-reference work. `==` constraints are syntactically supported but not semantically verified yet, and they aren't used for anything.
This commit is contained in:
@@ -412,6 +412,7 @@ auto Interpreter::StepLvalue() -> ErrorOr<Success> {
|
||||
case ExpressionKind::ValueLiteral:
|
||||
case ExpressionKind::IntrinsicExpression:
|
||||
case ExpressionKind::IfExpression:
|
||||
case ExpressionKind::WhereExpression:
|
||||
case ExpressionKind::ArrayTypeLiteral:
|
||||
case ExpressionKind::InstantiateImpl:
|
||||
CARBON_FATAL() << "Can't treat expression as lvalue: " << exp;
|
||||
@@ -1082,6 +1083,10 @@ auto Interpreter::StepExp() -> ErrorOr<Success> {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ExpressionKind::WhereExpression: {
|
||||
return todo_.FinishAction(
|
||||
&cast<TypeOfConstraintType>(exp.static_type()).constraint_type());
|
||||
}
|
||||
case ExpressionKind::UnimplementedExpression:
|
||||
CARBON_FATAL() << "Unimplemented: " << exp;
|
||||
case ExpressionKind::ArrayTypeLiteral: {
|
||||
|
||||
Reference in New Issue
Block a user