mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 09:30:27 +00:00
Add extensibility support for arithmetic operators. (#1751)
Add new prelude interfaces `Negate`, `AddWith`, `SubWith`, and `MulWith`, and use them to implement non-builtin arithmetic operations.
This commit is contained in:
1 parent
34a18b5e9e
commit
15ec5113aa
20 files changed
+401
-57
No files matched your search
@@ -11,9 +11,8 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
fn id[T:! Type](x: T) -> T {
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_addable.carbon:[[@LINE+3]]: type error in addition(1)
|
||||
// CHECK: expected: i32
|
||||
// CHECK: actual: T:! Type
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_addable.carbon:[[@LINE+2]]: type error in `+`:
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_addable.carbon:[[@LINE+1]]: could not find implementation of interface AddWith(U = i32) for T:! Type
|
||||
return x + 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user