Switch tests to use the rendered form of diagnostics (#8070)

Historically, we disabled the rendered form in tests outside of
`toolchain/diagnostics`. The idea was to keep tests shorter and avoid
very long chains of autoupdate before stabilizing due to all the line
numbers and other artifacts in the rendered form.

This PR adds `--diagnostic-line-numbers=[all|first]` and defaults to
`first` in tests. This keeps the rendered form so that we can easily
code review that form and the visual cues it does or doesn't provide.
But it removes all but the first location's line numbers to provide
significantly more stability in tests.

By default, tests get the full unicode line-drawing form of diagnostics
so we can ensure all of the artifacts there make sense with the specific
case being diagnosed, but we do retain some focused ASCII-rendering
tests to ensure that fallback remains usable.

There are some issues here that will be fixed in subsequent PRs.
Notably, we try to keep the frame together in the check lines, and so
force some parts to use the first location. This largely works, but
fails in some edge cases, causing the entire frame to be located
incorrectly. There is a TODO about this that we need to fix, and it only
occurs 6 times across the test suite, so it didn't seem worth
front-loading a fix for here.

Assisted-by: Claude Code
This commit is contained in:
Chandler Carruth authored and GitHub committed 2026-11-05 07:19:59 +00:00
1 parent 0b7059a360
commit d0badecd2a
888 files changed
+39731 -12799

No files matched your search

@@ -51,16 +51,44 @@ enum class EC { e1, e2, e3 };
''';
fn TestEnumClass(a: Cpp.EC, b: Cpp.EC) {
// CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitAndWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19
// CHECK:STDERR: -> │ let _: Cpp.EC = a & b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.EC)` in type `Cpp.EC` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.EC = a & b;
// CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitOrWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19
// CHECK:STDERR: -> │ let _: Cpp.EC = a | b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitOrWith(Cpp.EC)` in type `Cpp.EC` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.EC = a | b;
// CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitXorWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19
// CHECK:STDERR: -> │ let _: Cpp.EC = a ^ b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitXorWith(Cpp.EC)` in type `Cpp.EC` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.EC = a ^ b;
// CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-20: error: cannot access member of interface `Core.BitComplement` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19
// CHECK:STDERR: -> │ let _: Cpp.EC = ^a;
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitComplement` in type `Cpp.EC` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.EC = ^a;
}
@@ -137,105 +165,334 @@ struct ConvertibleToFloat {
fn TestInteger(a: Cpp.ConvertibleToInt, b: Cpp.ConvertibleToInt) {
// Test arithmetic.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a + b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a + b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a - b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.SubWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a - b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a * b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.MulWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a * b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a / b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.DivWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a / b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.ModWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a % b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.ModWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a % b;
// Test bitwise.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitAndWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a & b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a & b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitOrWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a | b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitOrWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a | b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitXorWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a ^ b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitXorWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a ^ b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-21: error: cannot access member of interface `Core.LeftShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a << b;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.LeftShiftWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a << b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-21: error: cannot access member of interface `Core.RightShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a >> b;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.RightShiftWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a >> b;
// Test comparison.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a == b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a == b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a != b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a != b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a < b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a < b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a <= b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a <= b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a > b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a > b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a >= b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a >= b);
// Test unary.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+9]]:16
// CHECK:STDERR: -> │ let _: i32 = -a;
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Negate` in
// CHECK:STDERR: · ┃ type `Cpp.ConvertibleToInt` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = -a;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.BitComplement` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+9]]:16
// CHECK:STDERR: -> │ let _: i32 = ^a;
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitComplement` in type `Cpp.ConvertibleToInt`
// CHECK:STDERR: · ┃ that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = ^a;
}
fn TestFloat(a: Cpp.ConvertibleToFloat, b: Cpp.ConvertibleToFloat) {
// Test arithmetic.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: f32 = a + b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = a + b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: f32 = a - b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.SubWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = a - b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: f32 = a * b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.MulWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = a * b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: f32 = a / b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.DivWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = a / b;
// Test comparison.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a == b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a == b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a != b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a != b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a < b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a < b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a <= b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a <= b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a > b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a > b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a >= b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a >= b);
// Test unary.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+9]]:16
// CHECK:STDERR: -> │ let _: f32 = -a;
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Negate` in
// CHECK:STDERR: · ┃ type `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = -a;
}
+21 -3
View File
@@ -62,7 +62,13 @@ public:
''';
fn TestDerefPass(var int_ptr: Cpp.MultiDeref) -> ref i32 {
// CHECK:STDERR: fail_todo_multi_deref.carbon:[[@LINE+2]]:10-41: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_multi_deref.carbon:[[@LINE+8]]:10
// CHECK:STDERR: -> │ return int_ptr.(Core.CppUnsafeDeref.Op)();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `operator* overload sets not implemented yet`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return int_ptr.(Core.CppUnsafeDeref.Op)();
}
@@ -89,7 +95,13 @@ public:
''';
fn TestDerefPass(var int_ptr: Cpp.MaybeDeref(i32)) -> ref i32 {
// CHECK:STDERR: fail_todo_maybe_deref.carbon:[[@LINE+2]]:10-41: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_maybe_deref.carbon:[[@LINE+8]]:10
// CHECK:STDERR: -> │ return int_ptr.(Core.CppUnsafeDeref.Op)();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `operator* overload sets not implemented yet`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return int_ptr.(Core.CppUnsafeDeref.Op)();
}
@@ -103,7 +115,13 @@ class NotAPtr {};
''';
fn TestDerefFail(not_ptr: Cpp.NotAPtr) {
// CHECK:STDERR: fail_not_a_ptr.carbon:[[@LINE+2]]:3-34: error: cannot access member of interface `Core.CppUnsafeDeref` in type `Cpp.NotAPtr` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_not_a_ptr.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ not_ptr.(Core.CppUnsafeDeref.Op)();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.CppUnsafeDeref` in type
// CHECK:STDERR: · ┃ `Cpp.NotAPtr` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
not_ptr.(Core.CppUnsafeDeref.Op)();
}
+222 -43
View File
@@ -93,13 +93,52 @@ library "[[@TEST_NAME]]";
import Cpp inline '''c++
struct NeqBoolish {
auto operator==(NeqBoolish) const -> bool;
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+3]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3-51: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator!=(NeqBoolish) const -> int;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ default fn NotEqual(self, other: Other) -> bool {
// CHECK:STDERR: · ─────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator!=(NeqBoolish) const -> int;
};
struct EqBoolish {
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator==(EqBoolish) const -> int*;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.Optional(i32* as Core.OptionalStorage)` does not
// CHECK:STDERR: · │ implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Equal(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬───────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator==(EqBoolish) const -> int*;
auto operator!=(EqBoolish) const -> bool;
};
@@ -109,28 +148,55 @@ struct BothBoolish {
False,
True,
};
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator==(BothBoolish) const -> Result;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to
// CHECK:STDERR: · │ ┃ `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Equal(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬───────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator==(BothBoolish) const -> Result;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator!=(BothBoolish) const -> Result;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to
// CHECK:STDERR: · │ ┃ `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ default fn NotEqual(self, other: Other) -> bool {
// CHECK:STDERR: · ─────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator!=(BothBoolish) const -> Result;
};
''';
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-16]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-17]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3-39: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+12]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-12]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-13]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3-39: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+7]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-16]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-17]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3-51: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
x == y;
x != y;
@@ -168,19 +234,45 @@ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
}
fn Test(default_eq_only: Cpp.DefaultEqOnly,
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+2]]:33-56: error: member name `DefaultSpaceshipOnly` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+8]]:33
// CHECK:STDERR: -> │ default_spaceship_only: Cpp.DefaultSpaceshipOnly,
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `DefaultSpaceshipOnly`
// CHECK:STDERR: · ┃ not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
default_spaceship_only: Cpp.DefaultSpaceshipOnly,
only_eq_declared: Cpp.OnlyEqDeclared) {
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+3]]:3-42: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-11]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(default_eq_only, default_eq_only);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(default_eq_only, default_eq_only);
EqWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+3]]:3-44: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-18]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(only_eq_declared, only_eq_declared);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(only_eq_declared, only_eq_declared);
}
@@ -235,46 +327,133 @@ fn Test(only_neq: Cpp.OnlyNeq,
deleted_neq: Cpp.DeletedNeq,
non_const_eq: Cpp.NonConstEq,
a2: Cpp.A2, b2: Cpp.B2) {
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.OnlyNeq` into type implementing `Core.EqWith(Cpp.OnlyNeq)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-13]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(only_neq, only_neq);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.OnlyNeq` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.OnlyNeq)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(only_neq, only_neq);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+4]]:10-35: error: name `only_non_default_spaceship` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+16]]:10
// CHECK:STDERR: -> │ EqWith(only_non_default_spaceship, only_non_default_spaceship);
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: name `only_non_default_spaceship` not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+2]]:38-63: error: name `only_non_default_spaceship` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+9]]:38
// CHECK:STDERR: -> │ EqWith(only_non_default_spaceship, only_non_default_spaceship);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: name
// CHECK:STDERR: · ┃ `only_non_default_spaceship`
// CHECK:STDERR: · ┃ not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(only_non_default_spaceship, only_non_default_spaceship);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-50: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.EqWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-24]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoRelevantMembers` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.NoRelevantMembers)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-42: error: cannot convert type `Cpp.EqReturnsVoid` into type implementing `Core.EqWith(Cpp.EqReturnsVoid)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-29]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(eq_returns_void, eq_returns_void);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.EqReturnsVoid` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.EqReturnsVoid)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(eq_returns_void, eq_returns_void);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-44: error: cannot convert type `Cpp.NeqReturnsVoid` into type implementing `Core.EqWith(Cpp.NeqReturnsVoid)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-34]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(neq_returns_void, neq_returns_void);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NeqReturnsVoid` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.NeqReturnsVoid)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(neq_returns_void, neq_returns_void);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+5]]:34: error: overload resolution selected deleted operator '!=' [CppInteropParseError]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-55]]:8: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-55]]:8: note: candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-41]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+20]]:34
// CHECK:STDERR: │ auto operator==(DeletedNeq) const -> bool;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ auto operator!=(DeletedNeq) const -> bool = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(deleted_neq, deleted_neq);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: overload resolution selected
// CHECK:STDERR: · ┃ deleted operator '!='
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(deleted_neq, deleted_neq);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-36: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-46]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(non_const_eq, non_const_eq);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(non_const_eq, non_const_eq);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-16: error: cannot convert type `Cpp.A2` into type implementing `Core.EqWith(Cpp.B2)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-51]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(a2, b2);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.A2` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.B2)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(a2, b2);
}
@@ -69,12 +69,25 @@ import Cpp library "prefix_inc_and_dec.h";
fn F() {
var prefix: Cpp.Prefix = Cpp.Prefix.Prefix();
// CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+4]]:9: error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╭─┤ fail_prefix_calling_postfix.carbon:[[@LINE+13]]:9
// CHECK:STDERR: -> │ prefix++;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+2]]:3-11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_prefix_calling_postfix.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ prefix++;
// CHECK:STDERR: · ━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check``
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
prefix++;
// CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+2]]:9: error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╭─┤ fail_prefix_calling_postfix.carbon:[[@LINE+6]]:9
// CHECK:STDERR: -> │ prefix--;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
prefix--;
}
@@ -93,10 +106,22 @@ import Cpp library "postfix_inc_and_dec.h";
fn F() {
var postfix: Cpp.Postfix = Cpp.Postfix.Postfix();
// CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.Inc` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_postfix_calling_prefix.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ ++postfix;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Inc` in type `Cpp.Postfix`
// CHECK:STDERR: · ┃ that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
++postfix;
// CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.Dec` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_postfix_calling_prefix.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ --postfix;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Dec` in type `Cpp.Postfix`
// CHECK:STDERR: · ┃ that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
--postfix;
}
@@ -211,8 +236,16 @@ fn F() {
var c: Cpp.BinaryC = {};
// Simple assignment.
// CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+3]]:3-8: error: cannot implicitly convert expression of type `Core.IntLiteral` to `Cpp.BinaryC` [ConversionFailure]
// CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+2]]:3-8: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(Cpp.BinaryC)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_import_assignment.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ c = 42;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to
// CHECK:STDERR: · │ ┃ `Cpp.BinaryC`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.BinaryC)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c = 42;
}
@@ -242,10 +275,26 @@ import Cpp library "binary_operators.h";
fn F() {
let c1: Cpp.BinaryC = Cpp.BinaryC.BinaryC();
// TODO: Include a list of non-viable candidate operators with this diagnostic.
// CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+2]]:32-37: error: cannot access member of interface `Core.AddWith(Core.IntLiteral)` in type `Cpp.BinaryC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_call_with_wrong_type.carbon:[[@LINE+10]]:32
// CHECK:STDERR: -> │ let unused c2: Cpp.BinaryC = c1 + 5;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Core.IntLiteral)` in
// CHECK:STDERR: · ┃ type `Cpp.BinaryC` that does not
// CHECK:STDERR: · ┃ implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c2: Cpp.BinaryC = c1 + 5;
// CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+2]]:32-37: error: cannot access member of interface `Core.AddWith(Cpp.BinaryC)` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_call_with_wrong_type.carbon:[[@LINE+10]]:32
// CHECK:STDERR: -> │ let unused c3: Cpp.BinaryC = 6 + c1;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.BinaryC)` in type
// CHECK:STDERR: · ┃ `Core.IntLiteral` that does not
// CHECK:STDERR: · ┃ implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c3: Cpp.BinaryC = 6 + c1;
}
@@ -265,9 +314,20 @@ void operator+(AmbiguousC, short);
''';
fn Test(c: Cpp.AmbiguousC) {
// CHECK:STDERR: fail_ambiguous.carbon:[[@LINE+4]]:5: error: use of overloaded operator '+' is ambiguous (with operand types 'const AmbiguousC' and 'int') [CppInteropParseError]
// CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-6]]:6: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-6]]:6: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_ambiguous.carbon:[[@LINE+15]]:5
// CHECK:STDERR: │ void operator+(AmbiguousC, char);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ void operator+(AmbiguousC, short);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ c + 1;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: use of overloaded operator '+' is ambiguous (with operand types
// CHECK:STDERR: · ┃ 'const AmbiguousC' and 'int')
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c + 1;
}
@@ -283,10 +343,23 @@ void operator+(DeletedC, void*) = delete;
''';
fn Test(c: Cpp.DeletedC) {
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+5]]:5: error: overload resolution selected deleted operator '+' [CppInteropParseError]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-6]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-6]]:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-7]]:26-30: note: no known conversion from 'int' to 'void *' for 2nd argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+18]]:5
// CHECK:STDERR: │ void operator+(DeletedC, int) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: │ void operator+(DeletedC, void*) = delete;
// CHECK:STDERR: · ┬ ┬────
// CHECK:STDERR: · ╰──────────────────────┤ candidate function not viable
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ no known conversion from 'int' to 'void *' for
// CHECK:STDERR: · │ 2nd argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ c + 1;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: overload resolution selected deleted operator '+'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c + 1;
}
@@ -317,12 +390,26 @@ fn F() {
let unused greater_than: bool = c1 > c2;
// Rewrite.
// CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+2]]:32-38: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_rewrite_spaceship.carbon:[[@LINE+9]]:32
// CHECK:STDERR: -> │ let unused less_than: bool = c1 < c2;
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused less_than: bool = c1 < c2;
// Rewrite.
// CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+2]]:44-51: error: semantics TODO: `Rewriting operator>= using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_rewrite_spaceship.carbon:[[@LINE+9]]:44
// CHECK:STDERR: -> │ let unused greater_than_or_equal: bool = c1 >= c2;
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator>= using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused greater_than_or_equal: bool = c1 >= c2;
@@ -346,9 +433,19 @@ auto operator<(CDel lhs, BaseDel rhs) -> bool;
fn F(c: Cpp.CDel) -> bool {
// Note that we mention `operator '<=>'` in the diagnostic.
// CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE+4]]:12: error: overload resolution selected deleted operator '<=>' [CppInteropParseError]
// CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-7]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-7]]:6: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_rewrite_deleted.carbon:[[@LINE+14]]:12
// CHECK:STDERR: │ auto operator<=>(CDel lhs, CDel rhs) -> std::strong_ordering = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: │ auto operator<(CDel lhs, BaseDel rhs) -> bool;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return c < c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: overload resolution selected deleted operator '<=>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c < c;
}
@@ -376,7 +473,14 @@ fn F() {
let unused equal: bool = c1 == c2;
// Rewrite.
// CHECK:STDERR: fail_todo_rewrite_equal.carbon:[[@LINE+2]]:32-39: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_rewrite_equal.carbon:[[@LINE+9]]:32
// CHECK:STDERR: -> │ let unused not_equal: bool = c1 != c2;
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused not_equal: bool = c1 != c2;
//@dump-sem-ir-end
@@ -448,7 +552,17 @@ import Cpp library "plus_with_string_view_conversion.h";
fn F() {
let s1: str = "hello";
let s2: str = "world";
// CHECK:STDERR: fail_todo_import_plus_with_string_view_conversion.carbon:[[@LINE+2]]:46-52: error: cannot access member of interface `Core.AddWith(str)` in type `str` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_import_plus_with_string_view_conversion.carbon:[[@LINE+12]]:46
// CHECK:STDERR: -> │ let unused c: Cpp.StringViewConvertibleC = s1 + s2;
// CHECK:STDERR: · ┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ `Core.AddWith(str)` in
// CHECK:STDERR: · ┃ type `str` that does
// CHECK:STDERR: · ┃ not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c: Cpp.StringViewConvertibleC = s1 + s2;
}
@@ -493,31 +607,73 @@ fn F() {
var c: Cpp.UnsupportedUnaryC = Cpp.UnsupportedUnaryC.UnsupportedUnaryC();
// Arithmetic.
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:36: error: expected expression [ExpectedExpr]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+22]]:36
// CHECK:STDERR: -> │ let plus: Cpp.UnsupportedUnaryC = +c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected expression
// CHECK:STDERR: · ┃ [ExpectedExpr]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:37: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+15]]:37
// CHECK:STDERR: -> │ let plus: Cpp.UnsupportedUnaryC = +c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:38: error: whitespace missing after binary operator [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:38
// CHECK:STDERR: -> │ let plus: Cpp.UnsupportedUnaryC = +c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: whitespace missing after binary
// CHECK:STDERR: · ┃ operator
// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let plus: Cpp.UnsupportedUnaryC = +c;
// Increment and Decrement.
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:4: error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:4
// CHECK:STDERR: -> │ c++;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c++;
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:4: error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:4
// CHECK:STDERR: -> │ c--;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c--;
// Bitwise.
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:41: error: expected expression [ExpectedExpr]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+15]]:41
// CHECK:STDERR: -> │ let not_value: Cpp.UnsupportedUnaryC = ~c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected expression
// CHECK:STDERR: · ┃ [ExpectedExpr]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:41: error: `let` declarations must end with a `;` [ExpectedDeclSemi]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:41
// CHECK:STDERR: -> │ let not_value: Cpp.UnsupportedUnaryC = ~c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: `let` declarations must end
// CHECK:STDERR: · ┃ with a `;`
// CHECK:STDERR: · ┃ [ExpectedDeclSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let not_value: Cpp.UnsupportedUnaryC = ~c;
// Logical.
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:51: error: `let` declarations must end with a `;` [ExpectedDeclSemi]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+9]]:51
// CHECK:STDERR: -> │ let not_result: Cpp.UnsupportedUnaryC = operator!(c1);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: `let` declarations
// CHECK:STDERR: · ┃ must end with a
// CHECK:STDERR: · ┃ `;`
// CHECK:STDERR: · ┃ [ExpectedDeclSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let not_result: Cpp.UnsupportedUnaryC = operator!(c1);
@@ -552,24 +708,80 @@ fn F() {
var c1: Cpp.UnsupportedBinaryC = Cpp.UnsupportedBinaryC.UnsupportedBinaryC();
// Logical.
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:44-51: error: name `operator` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+34]]:44
// CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: name `operator` not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+6]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+27]]:52
// CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: whitespace
// CHECK:STDERR: · ┃ missing around
// CHECK:STDERR: · ┃ binary operator
// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:59-60: error: name `c2` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+18]]:59
// CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: name `c2`
// CHECK:STDERR: · ┃ not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+2]]:53: error: cannot take the address of non-reference expression [AddrOfNonRef]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+10]]:53
// CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot take the
// CHECK:STDERR: · ┃ address of
// CHECK:STDERR: · ┃ non-reference
// CHECK:STDERR: · ┃ expression
// CHECK:STDERR: · ┃ [AddrOfNonRef]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+10]]:43-50: error: name `operator` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+40]]:43
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: name `operator` not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:51: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+33]]:51
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: whitespace missing
// CHECK:STDERR: · ┃ around binary
// CHECK:STDERR: · ┃ operator
// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+6]]:52: error: expected expression [ExpectedExpr]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+24]]:52
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected
// CHECK:STDERR: · ┃ expression
// CHECK:STDERR: · ┃ [ExpectedExpr]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+16]]:52
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: whitespace
// CHECK:STDERR: · ┃ missing around
// CHECK:STDERR: · ┃ binary operator
// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+2]]:52: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+7]]:52
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
}
@@ -654,7 +866,15 @@ fn F() {
//@dump-sem-ir-begin
let c1: Cpp.GlobalOpN.C = Cpp.GlobalOpN.C.C();
let c2: Cpp.GlobalOpN.C = Cpp.GlobalOpN.C.C();
// CHECK:STDERR: fail_todo_import_operands_in_namespace_operator_in_global.carbon:[[@LINE+2]]:36-42: error: cannot access member of interface `Core.AddWith(Cpp.GlobalOpN.C)` in type `Cpp.GlobalOpN.C` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_import_operands_in_namespace_operator_in_global.carbon:[[@LINE+10]]:36
// CHECK:STDERR: -> │ let unused c3: Cpp.GlobalOpN.C = c1 + c2;
// CHECK:STDERR: · ┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.GlobalOpN.C)`
// CHECK:STDERR: · ┃ in type `Cpp.GlobalOpN.C` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c3: Cpp.GlobalOpN.C = c1 + c2;
//@dump-sem-ir-end
@@ -761,7 +981,15 @@ import Cpp library "not_found.h";
fn F() {
let c1: Cpp.NoOperators = Cpp.NoOperators.NoOperators();
let c2: Cpp.NoOperators = Cpp.NoOperators.NoOperators();
// CHECK:STDERR: fail_import_not_found.carbon:[[@LINE+2]]:36-42: error: cannot access member of interface `Core.AddWith(Cpp.NoOperators)` in type `Cpp.NoOperators` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_import_not_found.carbon:[[@LINE+10]]:36
// CHECK:STDERR: -> │ let unused c3: Cpp.NoOperators = c1 + c2;
// CHECK:STDERR: · ┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.NoOperators)`
// CHECK:STDERR: · ┃ in type `Cpp.NoOperators` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c3: Cpp.NoOperators = c1 + c2;
}
@@ -784,9 +1012,20 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE+4]]:34-57: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: included from: fail_import_incomplete_unary.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete_unary.carbon:[[@LINE+15]]:34
// CHECK:STDERR: -> │ let unused result_unary: i32 = -*Cpp.CreateIncomplete();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with
// CHECK:STDERR: · ┃ incomplete operand type
// CHECK:STDERR: · ┃ `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete_unary.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused result_unary: i32 = -*Cpp.CreateIncomplete();
}
@@ -799,9 +1038,20 @@ import Cpp library "incomplete.h";
fn F() {
var complete: Cpp.Complete = Cpp.Complete.Complete();
// CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE+4]]:35-68: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: included from: fail_import_incomplete_binary.carbon:[[@LINE-5]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete_binary.carbon:[[@LINE+15]]:35
// CHECK:STDERR: -> │ let unused result_binary: i32 = complete + *Cpp.CreateIncomplete();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with
// CHECK:STDERR: · ┃ incomplete operand type
// CHECK:STDERR: · ┃ `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete_binary.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused result_binary: i32 = complete + *Cpp.CreateIncomplete();
}
@@ -825,8 +1075,17 @@ fn CreateIncomplete() -> Incomplete*;
fn F() {
var complete: Cpp.CompleteCpp = Cpp.CompleteCpp.CompleteCpp();
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+3]]:28-57: error: looking up a C++ operator with incomplete operand type `Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE-6]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_incomplete_operand_carbon_type.carbon:[[@LINE+12]]:28
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ────────┬────────
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ let unused result: i32 = *CreateIncomplete() + complete;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with incomplete
// CHECK:STDERR: · ┃ operand type `Incomplete`
// CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused result: i32 = *CreateIncomplete() + complete;
}
@@ -860,7 +1119,20 @@ library "[[@TEST_NAME]]";
import Cpp inline '''
template<typename T> struct FailTemplateB {};
template<typename T> struct FailTemplateA {
// CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+1]]:19: error: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_indirect_template_instantiation_error.carbon:[[@LINE+14]]:19
// CHECK:STDERR: -> │ friend typename T::error operator+(FailTemplateB<FailTemplateA>, FailTem...
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: type 'int' cannot be used prior to '::' because it
// CHECK:STDERR: · ┃ has no members
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ return x + x;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ in instantiation of template class 'FailTemplateA<int>'
// CHECK:STDERR: · │ requested here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
friend typename T::error operator+(FailTemplateB<FailTemplateA>, FailTemplateB<FailTemplateA>);
};
@@ -868,9 +1140,14 @@ using FailTemplateX = FailTemplateB<FailTemplateA<int>>;
''';
fn F(x: Cpp.FailTemplateX) -> i32 {
// CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+4]]:12: note: in instantiation of template class 'FailTemplateA<int>' requested here [CppInteropParseNote]
// CHECK:STDERR:
// CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.AddWith(Cpp.FailTemplateB)` in type `Cpp.FailTemplateB` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_indirect_template_instantiation_error.carbon:[[@LINE+9]]:10
// CHECK:STDERR: -> │ return x + x;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.FailTemplateB)` in type
// CHECK:STDERR: · ┃ `Cpp.FailTemplateB` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return x + x;
}
@@ -2152,7 +2429,7 @@ fn F() {
// CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic]
// CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic]
// CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc32 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc46 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.b80: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete]
// CHECK:STDOUT: %SubobjectDestroy.facet.a87: %SubobjectDestroy.type = facet_value bool, (%custom_witness.b80) [concrete]
@@ -2249,45 +2526,45 @@ fn F() {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %greater_than.patt: %pattern_type.831 = value_binding_pattern greater_than [concrete = constants.%greater_than.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref.loc24: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc24: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc24: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %c1.ref.loc31: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc31: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc31: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %less_than: bool = wrapper_binding less_than, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %less_than.patt: %pattern_type.831 = value_binding_pattern less_than [concrete = constants.%less_than.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref.loc29: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc29: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc29: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %c1.ref.loc43: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc43: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc43: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %greater_than_or_equal: bool = wrapper_binding greater_than_or_equal, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %greater_than_or_equal.patt: %pattern_type.831 = value_binding_pattern greater_than_or_equal [concrete = constants.%greater_than_or_equal.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref.loc32: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc32: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc32_41.1: %C = acquire_value %c1.ref.loc32
// CHECK:STDOUT: %.loc32_47.1: %C = acquire_value %c2.ref.loc32
// CHECK:STDOUT: %.loc32_41.2: ref %C = value_as_ref %.loc32_41.1
// CHECK:STDOUT: %addr.loc32_44.1: %ptr.0a2 = addr_of %.loc32_41.2
// CHECK:STDOUT: %.loc32_47.2: ref %C = value_as_ref %.loc32_47.1
// CHECK:STDOUT: %addr.loc32_44.2: %ptr.0a2 = addr_of %.loc32_47.2
// CHECK:STDOUT: %.loc32_44.1: ref bool = temporary_storage
// CHECK:STDOUT: %addr.loc32_44.3: %ptr.bb2 = addr_of %.loc32_44.1
// CHECK:STDOUT: %operator_LessEqual__carbon_thunk.call: init %empty_tuple.type = call imports.%operator_LessEqual__carbon_thunk.decl(%addr.loc32_44.1, %addr.loc32_44.2, %addr.loc32_44.3)
// CHECK:STDOUT: %.loc32_44.2: init bool to %.loc32_44.1 = mark_in_place_init %operator_LessEqual__carbon_thunk.call
// CHECK:STDOUT: %.loc32_44.3: ref bool = temporary %.loc32_44.1, %.loc32_44.2
// CHECK:STDOUT: %.loc32_44.4: bool = acquire_value %.loc32_44.3
// CHECK:STDOUT: %.loc32_34: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %less_than_or_equal: bool = wrapper_binding less_than_or_equal, %.loc32_44.4
// CHECK:STDOUT: %c1.ref.loc46: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc46: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc46_41.1: %C = acquire_value %c1.ref.loc46
// CHECK:STDOUT: %.loc46_47.1: %C = acquire_value %c2.ref.loc46
// CHECK:STDOUT: %.loc46_41.2: ref %C = value_as_ref %.loc46_41.1
// CHECK:STDOUT: %addr.loc46_44.1: %ptr.0a2 = addr_of %.loc46_41.2
// CHECK:STDOUT: %.loc46_47.2: ref %C = value_as_ref %.loc46_47.1
// CHECK:STDOUT: %addr.loc46_44.2: %ptr.0a2 = addr_of %.loc46_47.2
// CHECK:STDOUT: %.loc46_44.1: ref bool = temporary_storage
// CHECK:STDOUT: %addr.loc46_44.3: %ptr.bb2 = addr_of %.loc46_44.1
// CHECK:STDOUT: %operator_LessEqual__carbon_thunk.call: init %empty_tuple.type = call imports.%operator_LessEqual__carbon_thunk.decl(%addr.loc46_44.1, %addr.loc46_44.2, %addr.loc46_44.3)
// CHECK:STDOUT: %.loc46_44.2: init bool to %.loc46_44.1 = mark_in_place_init %operator_LessEqual__carbon_thunk.call
// CHECK:STDOUT: %.loc46_44.3: ref bool = temporary %.loc46_44.1, %.loc46_44.2
// CHECK:STDOUT: %.loc46_44.4: bool = acquire_value %.loc46_44.3
// CHECK:STDOUT: %.loc46_34: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %less_than_or_equal: bool = wrapper_binding less_than_or_equal, %.loc46_44.4
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %less_than_or_equal.patt: %pattern_type.831 = value_binding_pattern less_than_or_equal [concrete = constants.%less_than_or_equal.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc32_44.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc32_44.5: %Destroy.type = converted bool, %Destroy.facet.loc32_44.1 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %Destroy.facet.loc32_44.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc32_44.6: %Destroy.type = converted bool, %Destroy.facet.loc32_44.2 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %Destroy.facet.loc46_44.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc46_44.5: %Destroy.type = converted bool, %Destroy.facet.loc46_44.1 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %Destroy.facet.loc46_44.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc46_44.6: %Destroy.type = converted bool, %Destroy.facet.loc46_44.2 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc32: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc32_44.3)
// CHECK:STDOUT: %SelfDestruct.call.loc46: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc46_44.3)
// CHECK:STDOUT: %Destroy.facet.loc19_38.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc19_38.5: %Destroy.type = converted bool, %Destroy.facet.loc19_38.1 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %Destroy.facet.loc19_38.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
@@ -2309,7 +2586,7 @@ fn F() {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32(%self.param: ref bool) = "no_op";
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc46(%self.param: ref bool) = "no_op";
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_todo_rewrite_equal.carbon
// CHECK:STDOUT:
@@ -2430,9 +2707,9 @@ fn F() {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %equal.patt: %pattern_type.831 = value_binding_pattern equal [concrete = constants.%equal.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref.loc21: ref %EqualC = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc21: ref %EqualC = name_ref c2, %c2
// CHECK:STDOUT: %.loc21: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %c1.ref.loc28: ref %EqualC = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc28: ref %EqualC = name_ref c2, %c2
// CHECK:STDOUT: %.loc28: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %not_equal: bool = wrapper_binding not_equal, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %not_equal.patt: %pattern_type.831 = value_binding_pattern not_equal [concrete = constants.%not_equal.patt]
@@ -2884,10 +3161,10 @@ fn F() {
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref: %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc12: type = splice_block %C.ref.loc12 [concrete = constants.%C] {
// CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalOpN.ref.loc12: <namespace> = name_ref GlobalOpN, imports.%GlobalOpN [concrete = imports.%GlobalOpN]
// CHECK:STDOUT: %C.ref.loc12: type = name_ref C, imports.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %.loc20: type = splice_block %C.ref.loc20 [concrete = constants.%C] {
// CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalOpN.ref.loc20: <namespace> = name_ref GlobalOpN, imports.%GlobalOpN [concrete = imports.%GlobalOpN]
// CHECK:STDOUT: %C.ref.loc20: type = name_ref C, imports.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c3: %C = wrapper_binding c3, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
@@ -118,9 +118,26 @@ library "[[@TEST_NAME]]";
import Cpp inline '''c++
struct LessReturnsBoolish {
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+3]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3-38: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator<(LessReturnsBoolish) const -> int;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Less(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬──────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<(LessReturnsBoolish) const -> int;
auto operator<=(LessReturnsBoolish) const -> bool;
auto operator>(LessReturnsBoolish) const -> bool;
@@ -129,6 +146,28 @@ struct LessReturnsBoolish {
struct LessEqualReturnsBoolish {
auto operator<(LessEqualReturnsBoolish) const -> bool;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator<=(LessEqualReturnsBoolish) const -> int*;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.Optional(i32* as Core.OptionalStorage)` does not
// CHECK:STDERR: · │ implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn LessOrEquivalent(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬──────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<=(LessEqualReturnsBoolish) const -> int*;
auto operator>(LessEqualReturnsBoolish) const -> bool;
auto operator>=(LessEqualReturnsBoolish) const -> bool;
@@ -139,6 +178,28 @@ struct GreaterEqualReturnsBoolish {
auto operator<(GreaterEqualReturnsBoolish) const -> bool;
auto operator<=(GreaterEqualReturnsBoolish) const -> bool;
auto operator>(GreaterEqualReturnsBoolish) const -> bool;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator>=(GreaterEqualReturnsBoolish) const -> Result;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to
// CHECK:STDERR: · │ ┃ `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn GreaterOrEquivalent(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬─────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator>=(GreaterEqualReturnsBoolish) const -> Result;
};
@@ -154,45 +215,93 @@ struct GreaterReturnsBoolish {
};
struct AllReturnBoolish {
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator<(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Less(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬──────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<(AllReturnBoolish) const -> double;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator<=(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn LessOrEquivalent(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬──────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<=(AllReturnBoolish) const -> double;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator>(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Greater(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator>(AllReturnBoolish) const -> double;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator>=(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn GreaterOrEquivalent(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬─────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator>=(AllReturnBoolish) const -> double;
};
''';
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+32]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-34]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-35]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3-50: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+27]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-29]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-30]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3-53: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+22]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-19]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-20]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3-38: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-23]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-24]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3-50: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+12]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-27]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-28]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:30:3-41: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+7]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-31]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-32]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3-53: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
x < y;
x <= y;
@@ -276,33 +385,93 @@ fn Test(missing_less: Cpp.MissingLess,
no_relevant_members: Cpp.NoRelevantMembers,
less_returns_void: Cpp.LessReturnsVoid,
less_non_const: Cpp.LessNonConst) {
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-41: error: cannot convert type `Cpp.MissingLess` into type implementing `Core.OrderedWith(Cpp.MissingLess)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-15]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_less, missing_less);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingLess` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.MissingLess)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(missing_less, missing_less);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-53: error: cannot convert type `Cpp.MissingLessEqual` into type implementing `Core.OrderedWith(Cpp.MissingLessEqual)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-20]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_less_equal, missing_less_equal);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingLessEqual` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.MissingLessEqual)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(missing_less_equal, missing_less_equal);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-47: error: cannot convert type `Cpp.MissingGreater` into type implementing `Core.OrderedWith(Cpp.MissingGreater)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-25]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_greater, missing_greater);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingGreater` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.MissingGreater)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(missing_greater, missing_greater);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-59: error: cannot convert type `Cpp.MissingGreaterEqual` into type implementing `Core.OrderedWith(Cpp.MissingGreaterEqual)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-30]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_greater_equal, missing_greater_equal);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingGreaterEqual` into type
// CHECK:STDERR: · ┃ implementing `Core.OrderedWith(Cpp.MissingGreaterEqual)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(missing_greater_equal, missing_greater_equal);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-55: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.OrderedWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-35]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoRelevantMembers` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.NoRelevantMembers)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-51: error: cannot convert type `Cpp.LessReturnsVoid` into type implementing `Core.OrderedWith(Cpp.LessReturnsVoid)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-40]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(less_returns_void, less_returns_void);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.LessReturnsVoid` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.LessReturnsVoid)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(less_returns_void, less_returns_void);
@@ -152,31 +152,96 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly,
returns_partial_ordering: Cpp.ReturnsPartialOrdering,
cross_type_lhs: Cpp.CrossTypeLhs,
cross_type_rhs: Cpp.CrossTypeRhs) {
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-56: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-23]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-61: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-21]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-63: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-25]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(returns_strong_ordering, returns_strong_ordering);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(returns_strong_ordering, returns_strong_ordering);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-65: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-29]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(returns_partial_ordering, returns_partial_ordering);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(returns_partial_ordering, returns_partial_ordering);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-45: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-33]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(cross_type_lhs, cross_type_rhs);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(cross_type_lhs, cross_type_rhs);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+5]]:3-45: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-37]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+20]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(cross_type_rhs, cross_type_lhs);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-28]]:9-54: warning: binding `returns_weak_ordering` unused [UnusedBinding]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE-88]]:9
// CHECK:STDERR: -> │ returns_weak_ordering: Cpp.ReturnsWeakOrdering,
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ warning: binding `returns_weak_ordering` unused
// CHECK:STDERR: · ┃ [UnusedBinding]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(cross_type_rhs, cross_type_lhs);
}
@@ -190,8 +255,18 @@ import Cpp library "three_way_comparable_types.h";
fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {}
fn Test(returns_strong_ordering: Cpp.ReturnsStrongOrdering) {
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-58: error: cannot convert type `Cpp.ReturnsStrongOrdering` into type implementing `Core.EqWith(Cpp.ReturnsStrongOrdering)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-4]]:1-65: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {}
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(returns_strong_ordering, returns_strong_ordering);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.ReturnsStrongOrdering` into type
// CHECK:STDERR: · ┃ implementing `Core.EqWith(Cpp.ReturnsStrongOrdering)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(returns_strong_ordering, returns_strong_ordering);
}