Skip to content

Commit cd14dca

Browse files
authored
Document and test that structs with different field orders are different types for impl lookup (#5778)
This encodes the decision of #5413 in our tests.
1 parent ff9154b commit cd14dca

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

toolchain/check/testdata/impl/lookup/struct.carbon

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ impl {.aa: (), .bb: ()} as Z where .X = D {
2929
fn ZZ() -> D { return () as D; }
3030
}
3131

32-
// TODO: Are structs with different field orders different types too, for impl
33-
// lookup? Or should this impl be diagnosed as overlapping with the impl on
34-
// `{.a, .b}`? Raised in:
35-
// https://github.com/carbon-language/carbon-lang/issues/5413
32+
// Structs with different field orders are different types too, for impl
33+
// lookup. See https://github.com/carbon-language/carbon-lang/issues/5413.
3634
impl {.b: (), .a: ()} as Z where .X = D {
3735
fn ZZ() -> D { return () as D; }
3836
}
@@ -46,8 +44,5 @@ fn G() {
4644
// names.
4745
let c1: C = F({.a: (), .b: ()});
4846
let d1: D = F({.aa: (), .bb: ()});
49-
50-
// TODO: It is unclear if `F` should return `C` or `D`, since it has the same
51-
// field names but different order as the impl that would give us `C` here.
5247
let d2: D = F({.b: (), .a: ()});
5348
}

0 commit comments

Comments
 (0)