mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 22:02:51 +01:00
Set the value of .Self in a where to that of the outer .Self. (#2344)
Prior to this change, declarations like `let N:! X(.Self) where .(X(.Self).Y) == 5;` have the surprising behavior of the two `.Self` expressions resolving to two different symbolic values. Fix this by forcing the inner one to have the same symbolic value as the outer one, albeit with a different type.
This commit is contained in:
@@ -430,6 +430,9 @@ void Value::Print(llvm::raw_ostream& out) const {
|
||||
for (const LookupContext& ctx : constraint.lookup_contexts()) {
|
||||
out << combine << *ctx.context;
|
||||
}
|
||||
if (constraint.lookup_contexts().empty()) {
|
||||
out << "Type";
|
||||
}
|
||||
out << " where ";
|
||||
llvm::ListSeparator sep(" and ");
|
||||
for (const RewriteConstraint& rewrite :
|
||||
@@ -447,7 +450,6 @@ void Value::Print(llvm::raw_ostream& out) const {
|
||||
}
|
||||
for (const EqualityConstraint& equality :
|
||||
constraint.equality_constraints()) {
|
||||
// TODO: Skip cases matching something in `rewrite_constraints()`.
|
||||
out << sep;
|
||||
llvm::ListSeparator equal(" == ");
|
||||
for (Nonnull<const Value*> value : equality.values) {
|
||||
|
||||
Reference in New Issue
Block a user