mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01: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:
+4
-3
@@ -10,9 +10,10 @@
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_invalid_fnty.carbon:[[@LINE+3]]: type error in negation
|
||||
// CHECK: expected: i32
|
||||
// CHECK: actual: Bool
|
||||
// TODO: We should type-check the prelude before the main input so that we can
|
||||
// use it within the types of top-level declarations.
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_invalid_fnty.carbon:[[@LINE+2]]: type error in `-`:
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_invalid_fnty.carbon:[[@LINE+1]]: missing declaration for builtin `Negate`
|
||||
fn f(g: __Fn(-true) -> true) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user