Add typechecking of type declarations (#984)

Also explicitly model the types of expressions whose values are class or choice types, and make those be the static_type of the type declaration. This ensures that the static_type of a NamedEntity consistently corresponds to the static type of an IdentifierExpression using that name.
This commit is contained in:
Geoff Romer authored and GitHub committed 2021-12-13 16:19:52 -08:00
1 parent 90c58dae2b
commit fd45b089e9
5 files changed
+123 -45

No files matched your search

@@ -392,6 +392,8 @@ auto Interpreter::Convert(Nonnull<const Value*> value,
case Value::Kind::ContinuationValue:
case Value::Kind::StringType:
case Value::Kind::StringValue:
case Value::Kind::TypeOfClassType:
case Value::Kind::TypeOfChoiceType:
// TODO: add `CHECK(TypeEqual(type, value->dynamic_type()))`, once we
// have Value::dynamic_type.
return value;