mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Support user-defined implicit conversions via ImplicitAs (#1273)
Support is added for all of the non-type expression contexts where we currently accept built-in conversions, such as reordering the fields in a struct.
This commit is contained in:
@@ -401,6 +401,7 @@ auto Interpreter::StepLvalue() -> ErrorOr<Success> {
|
||||
case ExpressionKind::ContinuationTypeLiteral:
|
||||
case ExpressionKind::StringLiteral:
|
||||
case ExpressionKind::StringTypeLiteral:
|
||||
case ExpressionKind::ValueLiteral:
|
||||
case ExpressionKind::IntrinsicExpression:
|
||||
case ExpressionKind::IfExpression:
|
||||
case ExpressionKind::ArrayTypeLiteral:
|
||||
@@ -1042,6 +1043,10 @@ auto Interpreter::StepExp() -> ErrorOr<Success> {
|
||||
CARBON_CHECK(act.pos() == 0);
|
||||
return todo_.FinishAction(arena_->New<StringType>());
|
||||
}
|
||||
case ExpressionKind::ValueLiteral: {
|
||||
CARBON_CHECK(act.pos() == 0);
|
||||
return todo_.FinishAction(&cast<ValueLiteral>(exp).value());
|
||||
}
|
||||
case ExpressionKind::IfExpression: {
|
||||
const auto& if_expr = cast<IfExpression>(exp);
|
||||
if (act.pos() == 0) {
|
||||
|
||||
Reference in New Issue
Block a user