Clarify and simplify handling of lvalues (#956)

- Rename `PointerValue` to `LValue` to reflect how it's actually used. We can introduce a `PointerValue` type when we add support for actual pointer values.
- Remove support for pattern assignment. It's unclear if Carbon will support this, and even if we do, it raises questions that should first be addressed in a language proposal, like "is the left-hand side of `(x, y) = (1, 2)` an lvalue, or a pattern, or both, or something else entirely?"
This commit is contained in:
Geoff Romer
2021-11-23 14:13:08 -08:00
committed by GitHub
parent 6ae85bd13a
commit 3f7e1cd3fb
7 changed files with 25 additions and 110 deletions
+3 -3
View File
@@ -186,8 +186,8 @@ void Value::Print(llvm::raw_ostream& out) const {
case Value::Kind::FunctionValue:
out << "fun<" << cast<FunctionValue>(*this).declaration().name() << ">";
break;
case Value::Kind::PointerValue:
out << "ptr<" << cast<PointerValue>(*this).value() << ">";
case Value::Kind::LValue:
out << "ptr<" << cast<LValue>(*this).address() << ">";
break;
case Value::Kind::BoolType:
out << "Bool";
@@ -425,7 +425,7 @@ auto ValueEqual(Nonnull<const Value*> v1, Nonnull<const Value*> v2,
case Value::Kind::BindingPlaceholderValue:
case Value::Kind::AlternativeConstructorValue:
case Value::Kind::ContinuationValue:
case Value::Kind::PointerValue:
case Value::Kind::LValue:
// TODO: support pointer comparisons once we have a clearer distinction
// between pointers and lvalues.
FATAL() << "ValueEqual does not support this kind of value: " << *v1;