mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-10 12:28:25 +00:00
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:
1 parent
0b7059a360
commit
d0badecd2a
888 files changed
+39731
-12799
No files matched your search
+89
-17
@@ -51,9 +51,23 @@ let v: a = {} as A({});
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+4]]:11-17: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo]
|
||||
// CHECK:STDERR: ╭─┤ fail_control_flow.carbon:[[@LINE+18]]:11
|
||||
// CHECK:STDERR: -> │ alias a = true or false;
|
||||
// CHECK:STDERR: · ━━━┳━━━
|
||||
// CHECK:STDERR: · ┏━━━━━━━━━━━━┛
|
||||
// CHECK:STDERR: · ┃ error: semantics TODO:
|
||||
// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.`
|
||||
// CHECK:STDERR: · ┃ [SemanticsTodo]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+2]]:11-23: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo]
|
||||
// CHECK:STDERR: ╭─┤ fail_control_flow.carbon:[[@LINE+9]]:11
|
||||
// CHECK:STDERR: -> │ alias a = true or false;
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━┛
|
||||
// CHECK:STDERR: · ┃ error: semantics TODO:
|
||||
// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.`
|
||||
// CHECK:STDERR: · ┃ [SemanticsTodo]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
alias a = true or false;
|
||||
|
||||
@@ -64,14 +78,30 @@ library "[[@TEST_NAME]]";
|
||||
class C {}
|
||||
|
||||
alias a = C;
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-2]]:7: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: ╭─┤ fail_name_conflict.carbon:[[@LINE+11]]:5
|
||||
// CHECK:STDERR: │ alias a = C;
|
||||
// CHECK:STDERR: · ┬
|
||||
// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var a: C = {};
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: duplicate name `a` being declared in the same scope
|
||||
// CHECK:STDERR: · ┃ [NameDeclDuplicate]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: C = {};
|
||||
|
||||
var b: C = {};
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:7: error: duplicate name `b` being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-2]]:5-8: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: ╭─┤ fail_name_conflict.carbon:[[@LINE+11]]:7
|
||||
// CHECK:STDERR: │ var b: C = {};
|
||||
// CHECK:STDERR: · ──┬─
|
||||
// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ alias b = C;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: duplicate name `b` being declared in the same scope
|
||||
// CHECK:STDERR: · ┃ [NameDeclDuplicate]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
alias b = C;
|
||||
|
||||
@@ -82,7 +112,12 @@ library "[[@TEST_NAME]]";
|
||||
var a: () = ();
|
||||
var b: ()* = &a;
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+2]]:11-12: error: alias refers to a runtime value [AliasRequiresConstantValue]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+7]]:11
|
||||
// CHECK:STDERR: -> │ alias c = *b;
|
||||
// CHECK:STDERR: · ━┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: alias refers to a runtime value
|
||||
// CHECK:STDERR: · ┃ [AliasRequiresConstantValue]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
alias c = *b;
|
||||
|
||||
@@ -90,7 +125,12 @@ alias c = *b;
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:8-16: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams]
|
||||
// CHECK:STDERR: ╭─┤ fail_params.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ alias A(T: type) = T*;
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: `alias` declaration cannot have parameters
|
||||
// CHECK:STDERR: · ┃ [UnexpectedDeclNameParams]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
alias A(T: type) = T*;
|
||||
|
||||
@@ -100,24 +140,56 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class Class {}
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:10-13: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+10]]:1-8: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+33]]:10
|
||||
// CHECK:STDERR: -> │ abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: · ────┬─── ━━┳━
|
||||
// CHECK:STDERR: · │ ┗━━┫ error: `base` not allowed on declaration with `abstract`
|
||||
// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: · ╰───────────┤ `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:15-21: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:1-8: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+25]]:15
|
||||
// CHECK:STDERR: -> │ abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: · ────┬─── ━━┳━━━━
|
||||
// CHECK:STDERR: · │ ┗━━┫ error: `default` not allowed on declaration with `abstract`
|
||||
// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: · ╰────────────────┤ `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:23-27: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-8: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+17]]:23
|
||||
// CHECK:STDERR: -> │ abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: · ────┬─── ┳━━━━
|
||||
// CHECK:STDERR: · │ ┗━━┫ error: `final` not allowed on declaration with
|
||||
// CHECK:STDERR: · │ ┃ `abstract`
|
||||
// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: · ╰──────────────────────┤ `abstract` previously appeared here
|
||||
// CHECK:STDERR: · │ [ModifierPrevious]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: · ━━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `alias` declaration
|
||||
// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
abstract base default final alias A = Class;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `impl` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ impl alias B = Class;
|
||||
// CHECK:STDERR: · ━━┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: `impl` not allowed on `alias` declaration
|
||||
// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
impl alias B = Class;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-6: error: `extern` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ extern alias C = Class;
|
||||
// CHECK:STDERR: · ━━━┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: `extern` not allowed on `alias` declaration
|
||||
// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
extern alias C = Class;
|
||||
|
||||
|
||||
+6
-2
@@ -56,7 +56,11 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "export";
|
||||
|
||||
// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+2]]:8: error: name `C` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_orig_name_not_in_export.carbon:[[@LINE+6]]:8
|
||||
// CHECK:STDERR: -> │ var c: C = {};
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `C` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var c: C = {};
|
||||
|
||||
@@ -275,7 +279,7 @@ var d: D* = &c;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc12: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: assign file.%c.var, <error>
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+13
-4
@@ -38,7 +38,11 @@ package Test library "[[@TEST_NAME]]";
|
||||
|
||||
import library "def";
|
||||
|
||||
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:11: error: name `A` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_local_def.carbon:[[@LINE+6]]:11
|
||||
// CHECK:STDERR: -> │ var inst: A = {};
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `A` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var inst: A = {};
|
||||
|
||||
@@ -48,7 +52,12 @@ package Other library "[[@TEST_NAME]]";
|
||||
|
||||
import Test library "def";
|
||||
|
||||
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:11-16: error: member name `A` not found in `Test` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_other_def.carbon:[[@LINE+7]]:11
|
||||
// CHECK:STDERR: -> │ var inst: Test.A = {};
|
||||
// CHECK:STDERR: · ━━━┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: member name `A` not found in `Test`
|
||||
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var inst: Test.A = {};
|
||||
|
||||
@@ -163,7 +172,7 @@ var inst: Test.A = {};
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc12: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: assign file.%inst.var, <error>
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
@@ -203,7 +212,7 @@ var inst: Test.A = {};
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc13: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: assign file.%inst.var, <error>
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+11
-2
@@ -34,10 +34,19 @@ library "[[@TEST_NAME]]";
|
||||
namespace NS;
|
||||
|
||||
fn F() -> {} {
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+2]]:9-10: error: name `NS` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_local_in_namespace.carbon:[[@LINE+6]]:9
|
||||
// CHECK:STDERR: -> │ alias NS.a = {};
|
||||
// CHECK:STDERR: · ━┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `NS` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
alias NS.a = {};
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+2]]:10-13: error: member name `a` not found in `NS` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_local_in_namespace.carbon:[[@LINE+7]]:10
|
||||
// CHECK:STDERR: -> │ return NS.a;
|
||||
// CHECK:STDERR: · ━━┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: member name `a` not found in `NS`
|
||||
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return NS.a;
|
||||
}
|
||||
|
||||
+39
-10
@@ -19,21 +19,41 @@ alias A = C;
|
||||
|
||||
// The diagnostics below should refer to `A`, not `C`.
|
||||
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:15-21: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11: note: return type of function is `A` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: ╭─┤ fail_alias_nested_in_type.carbon:[[@LINE+7]]:15
|
||||
// CHECK:STDERR: -> │ fn F() -> A { return; }
|
||||
// CHECK:STDERR: · ┬ ━━━┳━━━
|
||||
// CHECK:STDERR: · │ ┗━━┫ error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: · ╰───────────┤ return type of function is `A` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn F() -> A { return; }
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:16-22: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-12: note: return type of function is `A*` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: ╭─┤ fail_alias_nested_in_type.carbon:[[@LINE+7]]:16
|
||||
// CHECK:STDERR: -> │ fn G() -> A* { return; }
|
||||
// CHECK:STDERR: · ─┬ ━━━┳━━━
|
||||
// CHECK:STDERR: · │ ┗━━┫ error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: · ╰───────────┤ return type of function is `A*` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn G() -> A* { return; }
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:22-28: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-18: note: return type of function is `const A*` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: ╭─┤ fail_alias_nested_in_type.carbon:[[@LINE+9]]:22
|
||||
// CHECK:STDERR: -> │ fn H() -> const A* { return; }
|
||||
// CHECK:STDERR: · ────┬─── ━━━┳━━━
|
||||
// CHECK:STDERR: · │ ┗━━┫ error: missing return value
|
||||
// CHECK:STDERR: · │ ┃ [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: · ╰──────────────┤ return type of function is `const A*`
|
||||
// CHECK:STDERR: · │ [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn H() -> const A* { return; }
|
||||
// TODO: Preserve type sugar in generic arguments, such as for `Core.Array`.
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:26-32: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-22: note: return type of function is `array(C, 42)` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: ╭─┤ fail_alias_nested_in_type.carbon:[[@LINE+9]]:26
|
||||
// CHECK:STDERR: -> │ fn I() -> array(A, 42) { return; }
|
||||
// CHECK:STDERR: · ──────┬───── ━━━┳━━━
|
||||
// CHECK:STDERR: · │ ┗━━┫ error: missing return value
|
||||
// CHECK:STDERR: · │ ┃ [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: · ╰────────────────┤ return type of function is `array(C, 42)`
|
||||
// CHECK:STDERR: · │ [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn I() -> array(A, 42) { return; }
|
||||
|
||||
@@ -51,12 +71,21 @@ fn MakePtr() -> A*;
|
||||
|
||||
fn F() {
|
||||
// The type of a call is the declared return type of the callee.
|
||||
// CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+2]]:3-19: error: type `A*` does not support qualified expressions [QualifiedExprUnsupported]
|
||||
// CHECK:STDERR: ╭─┤ fail_alias_in_type_of_expr.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ MakePtr().missing;
|
||||
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: type `A*` does not support qualified expressions
|
||||
// CHECK:STDERR: · ┃ [QualifiedExprUnsupported]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
MakePtr().missing;
|
||||
|
||||
// The type of a dereference is the pointee type of the pointer's type.
|
||||
// CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+2]]:3-16: error: value of type `A` is not callable [CallToNonCallable]
|
||||
// CHECK:STDERR: ╭─┤ fail_alias_in_type_of_expr.carbon:[[@LINE+6]]:3
|
||||
// CHECK:STDERR: -> │ (*MakePtr())();
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: value of type `A` is not callable [CallToNonCallable]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
(*MakePtr())();
|
||||
}
|
||||
+6
-1
@@ -34,7 +34,12 @@ library "[[@TEST_NAME]]";
|
||||
fn F() -> () {
|
||||
var a: () = ();
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_local.carbon:[[@LINE+2]]:13: error: alias refers to a runtime value [AliasRequiresConstantValue]
|
||||
// CHECK:STDERR: ╭─┤ fail_local.carbon:[[@LINE+7]]:13
|
||||
// CHECK:STDERR: -> │ alias b = a;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: alias refers to a runtime value
|
||||
// CHECK:STDERR: · ┃ [AliasRequiresConstantValue]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
alias b = a;
|
||||
//@dump-sem-ir-end
|
||||
|
||||
+39
-7
@@ -81,12 +81,36 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class Incomplete;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+7]]:8-27: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: min_prelude/parts/array.carbon:13:3-24: note: `<builtin array(T, N)>` evaluates to incomplete type `<builtin array(Incomplete, 1)>` [IncompleteTypeInMonomorphization]
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-4]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_incomplete_element.carbon:[[@LINE+31]]:8
|
||||
// CHECK:STDERR: │ class Incomplete;
|
||||
// CHECK:STDERR: · ────────┬────────
|
||||
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var a: array(Incomplete, 1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `array(Incomplete, 1)` in
|
||||
// CHECK:STDERR: · ┃ name binding declaration
|
||||
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ min_prelude/parts/array.carbon
|
||||
// CHECK:STDERR: │ adapt MakeArray(T, N);
|
||||
// CHECK:STDERR: · ┬─────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ `<builtin array(T, N)>` evaluates to incomplete type
|
||||
// CHECK:STDERR: · │ `<builtin array(Incomplete, 1)>`
|
||||
// CHECK:STDERR: · │ [IncompleteTypeInMonomorphization]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+3]]:8-27: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-7]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_incomplete_element.carbon:[[@LINE+12]]:8
|
||||
// CHECK:STDERR: │ class Incomplete;
|
||||
// CHECK:STDERR: · ────────┬────────
|
||||
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var a: array(Incomplete, 1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `array(Incomplete, 1)` in
|
||||
// CHECK:STDERR: · ┃ name binding declaration
|
||||
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: array(Incomplete, 1);
|
||||
|
||||
@@ -96,8 +120,16 @@ var p: Incomplete* = &a[0];
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+3]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+2]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid_element.carbon:[[@LINE+11]]:14
|
||||
// CHECK:STDERR: -> │ var a: array(1, 1);
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type
|
||||
// CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.ImplicitAs(type)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: array(1, 1);
|
||||
|
||||
|
||||
+22
-4
@@ -36,7 +36,12 @@ let b: array(i32, 3)* = &a;
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_negative.carbon:[[@LINE+2]]:19-20: error: array bound of -1 is negative [ArrayBoundNegative]
|
||||
// CHECK:STDERR: ╭─┤ fail_negative.carbon:[[@LINE+7]]:19
|
||||
// CHECK:STDERR: -> │ var a: array(i32, -1);
|
||||
// CHECK:STDERR: · ━┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound of -1 is negative
|
||||
// CHECK:STDERR: · ┃ [ArrayBoundNegative]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: array(i32, -1);
|
||||
|
||||
@@ -44,7 +49,12 @@ var a: array(i32, -1);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:19-38: error: array bound of 39999999999999999993 is too large [ArrayBoundTooLarge]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:19
|
||||
// CHECK:STDERR: -> │ var a: array(i32, 39999999999999999993);
|
||||
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound of 39999999999999999993 is too large
|
||||
// CHECK:STDERR: · ┃ [ArrayBoundTooLarge]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: array(i32, 39999999999999999993);
|
||||
|
||||
@@ -52,8 +62,16 @@ var a: array(i32, 39999999999999999993);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+3]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+2]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid_type_with_overflow.carbon:[[@LINE+11]]:14
|
||||
// CHECK:STDERR: -> │ var b: array(1, 39999999999999999993);
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type
|
||||
// CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.ImplicitAs(type)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var b: array(1, 39999999999999999993);
|
||||
|
||||
|
||||
+49
-9
@@ -16,8 +16,16 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class C {}
|
||||
|
||||
// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+3]]:22-35: error: cannot implicitly convert expression of type `()` to `C` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+2]]:22-35: note: type `()` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_arg_wrong_type.carbon:[[@LINE+11]]:22
|
||||
// CHECK:STDERR: -> │ var a: array(C, 3) = ({}, (), true);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
|
||||
// CHECK:STDERR: · │ ┃ `()` to `C`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.ImplicitAs(C)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: array(C, 3) = ({}, (), true);
|
||||
|
||||
@@ -29,14 +37,28 @@ class C {}
|
||||
class D {}
|
||||
|
||||
var a: (D, C, D);
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+3]]:22: error: cannot implicitly convert expression of type `D` to `C` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+2]]:22: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_var_wrong_type.carbon:[[@LINE+11]]:22
|
||||
// CHECK:STDERR: -> │ var b: array(C, 3) = a;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
|
||||
// CHECK:STDERR: · │ ┃ `D` to `C`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `D` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.ImplicitAs(C)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var b: array(C, 3) = a;
|
||||
|
||||
var c: (C, D, D);
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+3]]:22: error: cannot copy value of type `C` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+2]]:22: note: type `C` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_var_wrong_type.carbon:[[@LINE+9]]:22
|
||||
// CHECK:STDERR: -> │ var d: array(C, 3) = c;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `C`
|
||||
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var d: array(C, 3) = c;
|
||||
|
||||
@@ -46,7 +68,13 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class C {}
|
||||
|
||||
// CHECK:STDERR: fail_arg_too_short.carbon:[[@LINE+2]]:22-29: error: cannot initialize array of 3 elements from 2 initializers [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR: ╭─┤ fail_arg_too_short.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ var a: array(C, 3) = ({}, {});
|
||||
// CHECK:STDERR: · ┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot initialize array of 3 elements from 2
|
||||
// CHECK:STDERR: · ┃ initializers
|
||||
// CHECK:STDERR: · ┃ [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: array(C, 3) = ({}, {});
|
||||
|
||||
@@ -57,12 +85,24 @@ library "[[@TEST_NAME]]";
|
||||
class C {}
|
||||
|
||||
var a: (C, C);
|
||||
// CHECK:STDERR: fail_var_too_short.carbon:[[@LINE+2]]:22: error: cannot initialize array of 3 elements from tuple with 2 elements [ArrayInitFromExprArgCountMismatch]
|
||||
// CHECK:STDERR: ╭─┤ fail_var_too_short.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ var b: array(C, 3) = a;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot initialize array of 3 elements from
|
||||
// CHECK:STDERR: · ┃ tuple with 2 elements
|
||||
// CHECK:STDERR: · ┃ [ArrayInitFromExprArgCountMismatch]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var b: array(C, 3) = a;
|
||||
|
||||
// --- fail_arg_too_long.carbon
|
||||
|
||||
// CHECK:STDERR: fail_arg_too_long.carbon:[[@LINE+2]]:23-34: error: cannot initialize array of 1 element from 3 initializers [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR: ╭─┤ fail_arg_too_long.carbon:[[@LINE+8]]:23
|
||||
// CHECK:STDERR: -> │ var a: array((), 1) = ((), (), ());
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot initialize array of 1 element from 3
|
||||
// CHECK:STDERR: · ┃ initializers
|
||||
// CHECK:STDERR: · ┃ [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: array((), 1) = ((), (), ());
|
||||
+6
-1
@@ -39,7 +39,12 @@ fn F(a: array({}, 3)) -> {} {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn F(a: array({}, 3)) -> {} {
|
||||
// CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+2]]:12-29: error: array index `3` is past the end of type `array({}, 3)` [ArrayIndexOutOfBounds]
|
||||
// CHECK:STDERR: ╭─┤ fail_out_of_bound_non_literal.carbon:[[@LINE+7]]:12
|
||||
// CHECK:STDERR: -> │ return a[{.index = 3}.index];
|
||||
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array index `3` is past the end of type `array({}, 3)`
|
||||
// CHECK:STDERR: · ┃ [ArrayIndexOutOfBounds]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return a[{.index = 3}.index];
|
||||
}
|
||||
|
||||
+20
-3
@@ -32,7 +32,14 @@ fn H() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn F(generic N: i32) {
|
||||
// CHECK:STDERR: fail_init_dependent_bound.carbon:[[@LINE+2]]:35-43: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound]
|
||||
// CHECK:STDERR: ╭─┤ fail_init_dependent_bound.carbon:[[@LINE+9]]:35
|
||||
// CHECK:STDERR: -> │ var unused arr: array(i32, N) = (1, 2, 3);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot initialize array with
|
||||
// CHECK:STDERR: · ┃ dependent bound from a list of
|
||||
// CHECK:STDERR: · ┃ initializers
|
||||
// CHECK:STDERR: · ┃ [ArrayInitDependentBound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused arr: array(i32, N) = (1, 2, 3);
|
||||
}
|
||||
@@ -45,8 +52,18 @@ interface Y(T: type, U: T) {}
|
||||
constraint Z(N: i32) {
|
||||
// Forming the specific of `Y` uses constant values which are canonical and
|
||||
// have no location. The error should still point somewhere reasonable.
|
||||
// CHECK:STDERR: fail_init_dependent_bound_in_constant.carbon:[[@LINE+3]]:24-42: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound]
|
||||
// CHECK:STDERR: fail_init_dependent_bound_in_constant.carbon:[[@LINE-6]]:1-28: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_init_dependent_bound_in_constant.carbon:[[@LINE+13]]:24
|
||||
// CHECK:STDERR: │ interface Y(T: type, U: T) {}
|
||||
// CHECK:STDERR: · ──────────────┬─────────────
|
||||
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
|
||||
// CHECK:STDERR: · │ [DeductionGenericHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ extend require impls Y(array((), N), ());
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot initialize array with dependent bound
|
||||
// CHECK:STDERR: · ┃ from a list of initializers
|
||||
// CHECK:STDERR: · ┃ [ArrayInitDependentBound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
extend require impls Y(array((), N), ());
|
||||
}
|
||||
|
||||
+19
-5
@@ -133,9 +133,16 @@ fn F(a: A) {
|
||||
// a copy to perform initialization. It's not clear whether that is the right
|
||||
// behavior.
|
||||
|
||||
// CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+4]]:3-22: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+3]]:3-22: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+2]]:26-54: note: in copy of `A` [InCopy]
|
||||
// CHECK:STDERR: ╭─┤ fail_init_tuple_variable.carbon:[[@LINE+11]]:3
|
||||
// CHECK:STDERR: -> │ var unused a_init: A = (a as ({}, Noncopyable)) as A;
|
||||
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ ┬────────────────────────────
|
||||
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━┫ error: cannot copy value of type `Noncopyable`
|
||||
// CHECK:STDERR: · │ │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰─────────────────┤ type `Noncopyable` does not implement interface
|
||||
// CHECK:STDERR: · │ │ `Core.Copy`
|
||||
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: · ╰──────┤ in copy of `A` [InCopy]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused a_init: A = (a as ({}, Noncopyable)) as A;
|
||||
}
|
||||
@@ -155,8 +162,15 @@ class B {
|
||||
// We do not try to implicitly convert from the first operand of `as` to the
|
||||
// adapted type of the second operand.
|
||||
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12-25: error: cannot convert expression of type `{.x: ()}` to `B` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+2]]:12-25: note: type `{.x: ()}` does not implement interface `Core.As(B)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_adapt_init_from_struct.carbon:[[@LINE+10]]:12
|
||||
// CHECK:STDERR: -> │ var b: B = {.x = ()} as B;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `{.x: ()}` to `B` with
|
||||
// CHECK:STDERR: · │ ┃ `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `{.x: ()}` does not implement interface `Core.As(B)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var b: B = {.x = ()} as B;
|
||||
|
||||
|
||||
+20
-4
@@ -106,8 +106,16 @@ let n: Y = ({.x = ()} as X) as Y;
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:13-19: error: cannot convert expression of type `Core.IntLiteral` to `{}` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:13-19: note: type `Core.IntLiteral` does not implement interface `Core.As({})` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_no_conversion.carbon:[[@LINE+11]]:13
|
||||
// CHECK:STDERR: -> │ let a: {} = 1 as {};
|
||||
// CHECK:STDERR: · ┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Core.IntLiteral` to
|
||||
// CHECK:STDERR: · │ ┃ `{}` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.As({})`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: {} = 1 as {};
|
||||
|
||||
@@ -115,8 +123,16 @@ let a: {} = 1 as {};
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:32-40: error: cannot implicitly convert non-type value of type `{.x: ()}` to `type` [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+2]]:32-40: note: type `{.x: ()}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_type.carbon:[[@LINE+11]]:32
|
||||
// CHECK:STDERR: -> │ let n: {.x: ()} = {.x = ()} as {.x = ()};
|
||||
// CHECK:STDERR: · ┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type
|
||||
// CHECK:STDERR: · │ ┃ value of type `{.x: ()}` to `type`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: · ╰────┤ type `{.x: ()}` does not implement
|
||||
// CHECK:STDERR: · │ interface `Core.ImplicitAs(type)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let n: {.x: ()} = {.x = ()} as {.x = ()};
|
||||
|
||||
|
||||
+20
-4
@@ -58,12 +58,28 @@ var reference: const X;
|
||||
let ptr: const X* = &reference;
|
||||
|
||||
fn Use() {
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `const X` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+2]]:24-37: note: type `const X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_const.carbon:[[@LINE+11]]:24
|
||||
// CHECK:STDERR: -> │ let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `const X`
|
||||
// CHECK:STDERR: · │ ┃ to `X` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `const X` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.As(X)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `const X*` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+2]]:22-30: note: type `const X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_const.carbon:[[@LINE+11]]:22
|
||||
// CHECK:STDERR: -> │ let unused b: X* = ptr as X*;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `const X*` to
|
||||
// CHECK:STDERR: · │ ┃ `X*` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `const X*` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.As(X*)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused b: X* = ptr as X*;
|
||||
}
|
||||
|
||||
+107
-45
@@ -39,12 +39,34 @@ let value: X = Init();
|
||||
fn Use() {
|
||||
// TODO: These should probably be valid.
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+3]]:41-71: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+2]]:41-71: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_todo_add_unformed_nonref.carbon:[[@LINE+14]]:41
|
||||
// CHECK:STDERR: -> │ var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of
|
||||
// CHECK:STDERR: · │ ┃ type `X` to
|
||||
// CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` with
|
||||
// CHECK:STDERR: · │ ┃ `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `X` does not implement
|
||||
// CHECK:STDERR: · │ interface
|
||||
// CHECK:STDERR: · │ `Core.As(Core.MaybeUnformed(X))`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X);
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+3]]:41-70: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+2]]:41-70: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_todo_add_unformed_nonref.carbon:[[@LINE+14]]:41
|
||||
// CHECK:STDERR: -> │ let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of
|
||||
// CHECK:STDERR: · │ ┃ type `X` to
|
||||
// CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` with
|
||||
// CHECK:STDERR: · │ ┃ `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `X` does not implement
|
||||
// CHECK:STDERR: · │ interface
|
||||
// CHECK:STDERR: · │ `Core.As(Core.MaybeUnformed(X))`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X);
|
||||
//@dump-sem-ir-end
|
||||
@@ -62,26 +84,66 @@ var reference: Core.MaybeUnformed(X);
|
||||
let ptr: Core.MaybeUnformed(X)* = &reference;
|
||||
|
||||
fn Use() {
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-31: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-31: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:21
|
||||
// CHECK:STDERR: -> │ var unused i: X = Init() as X;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type
|
||||
// CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` to `X` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)` does not implement
|
||||
// CHECK:STDERR: · │ interface `Core.As(X)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused i: X = Init() as X;
|
||||
// TODO: The diagnostic should explain that the reason we can't perform this
|
||||
// conversion is due to the expression category.
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-38: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `unsafe as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-38: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.UnsafeAs(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:21
|
||||
// CHECK:STDERR: -> │ var unused j: X = Init() unsafe as X;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type
|
||||
// CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` to `X` with `unsafe as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)` does not implement
|
||||
// CHECK:STDERR: · │ interface `Core.UnsafeAs(X)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused j: X = Init() unsafe as X;
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-30: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-30: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:21
|
||||
// CHECK:STDERR: -> │ let unused v: X = value as X;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type
|
||||
// CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` to `X` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)` does not implement
|
||||
// CHECK:STDERR: · │ interface `Core.As(X)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused v: X = value as X;
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:24-37: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:24
|
||||
// CHECK:STDERR: -> │ let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type
|
||||
// CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` to `X` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)` does not implement
|
||||
// CHECK:STDERR: · │ interface `Core.As(X)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `Core.MaybeUnformed(X)*` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:22-30: note: type `Core.MaybeUnformed(X)*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:22
|
||||
// CHECK:STDERR: -> │ let unused b: X* = ptr as X*;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type
|
||||
// CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)*` to `X*` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)*` does not implement
|
||||
// CHECK:STDERR: · │ interface `Core.As(X*)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused b: X* = ptr as X*;
|
||||
}
|
||||
@@ -208,7 +270,7 @@ fn Use() {
|
||||
// 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.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc15_3.4 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc26_3.4 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.4: %SubobjectDestroy.WithSelf.Op.type.6870fd.4 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.b80ef6.4: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.4), @SubobjectDestroy [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.facet.4df: %SubobjectDestroy.type = facet_value %MaybeUnformed.67f, (%custom_witness.b80ef6.4) [concrete]
|
||||
@@ -235,19 +297,19 @@ fn Use() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %i.var: ref %MaybeUnformed.67f = var_storage %i.var_patt
|
||||
// CHECK:STDOUT: %Init.ref: %Init.type = name_ref Init, file.%Init.decl [concrete = constants.%Init]
|
||||
// CHECK:STDOUT: %.loc15_46: ref %X = temporary_storage
|
||||
// CHECK:STDOUT: %Init.call: init %X to %.loc15_46 = call %Init.ref()
|
||||
// CHECK:STDOUT: %Core.ref.loc15_51: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc15_55: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc15_70: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc15_71: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc15_48: %MaybeUnformed.67f = converted %Init.call, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc26_46: ref %X = temporary_storage
|
||||
// CHECK:STDOUT: %Init.call: init %X to %.loc26_46 = call %Init.ref()
|
||||
// CHECK:STDOUT: %Core.ref.loc26_51: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc26_55: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc26_70: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc26_71: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc26_48: %MaybeUnformed.67f = converted %Init.call, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: assign %i.var, <error>
|
||||
// CHECK:STDOUT: %.loc15_37: type = splice_block %MaybeUnformed.loc15_37 [concrete = constants.%MaybeUnformed.67f] {
|
||||
// CHECK:STDOUT: %Core.ref.loc15_17: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc15_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc15_36: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc15_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc26_37: type = splice_block %MaybeUnformed.loc26_37 [concrete = constants.%MaybeUnformed.67f] {
|
||||
// CHECK:STDOUT: %Core.ref.loc26_17: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc26_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc26_36: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc26_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %i: ref %MaybeUnformed.67f = wrapper_binding i, %i.var
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
@@ -255,40 +317,40 @@ fn Use() {
|
||||
// CHECK:STDOUT: %i.var_patt: %pattern_type.55d = var_pattern %i.patt [concrete = constants.%i.var_patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %value.ref: %X = name_ref value, file.%value
|
||||
// CHECK:STDOUT: %Core.ref.loc19_50: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc19_54: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc19_69: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc19_70: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc19_47: %MaybeUnformed.67f = converted %value.ref, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc19_37: type = splice_block %MaybeUnformed.loc19_37 [concrete = constants.%MaybeUnformed.67f] {
|
||||
// CHECK:STDOUT: %Core.ref.loc19_17: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc19_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc19_36: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc19_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %Core.ref.loc41_50: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc41_54: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc41_69: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc41_70: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc41_47: %MaybeUnformed.67f = converted %value.ref, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc41_37: type = splice_block %MaybeUnformed.loc41_37 [concrete = constants.%MaybeUnformed.67f] {
|
||||
// CHECK:STDOUT: %Core.ref.loc41_17: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc41_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc41_36: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc41_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v: %MaybeUnformed.67f = wrapper_binding v, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %v.patt: %pattern_type.55d = value_binding_pattern v [concrete = constants.%v.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Destroy.facet.loc15_3.1: %Destroy.type = facet_value constants.%MaybeUnformed.67f, (constants.%DestroyImpl.impl_witness.8e6, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %.loc15_3.1: %Destroy.type = converted constants.%MaybeUnformed.67f, %Destroy.facet.loc15_3.1 [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc15_3.2: %Destroy.type = facet_value constants.%MaybeUnformed.67f, (constants.%DestroyImpl.impl_witness.8e6, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %.loc15_3.2: %Destroy.type = converted constants.%MaybeUnformed.67f, %Destroy.facet.loc15_3.2 [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc26_3.1: %Destroy.type = facet_value constants.%MaybeUnformed.67f, (constants.%DestroyImpl.impl_witness.8e6, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %.loc26_3.1: %Destroy.type = converted constants.%MaybeUnformed.67f, %Destroy.facet.loc26_3.1 [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc26_3.2: %Destroy.type = facet_value constants.%MaybeUnformed.67f, (constants.%DestroyImpl.impl_witness.8e6, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %.loc26_3.2: %Destroy.type = converted constants.%MaybeUnformed.67f, %Destroy.facet.loc26_3.2 [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%i.var)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_3.1(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_3.1(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_3.2(%self.param: ref %X) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_3.2(%self.param: ref %X) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_3.3(%self.param: ref %.f01) {
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_3.3(%self.param: ref %.f01) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
|
||||
+30
-6
@@ -60,16 +60,40 @@ var reference: partial X;
|
||||
let ptr: partial X* = &reference;
|
||||
|
||||
fn Use() {
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:21-30: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:21-30: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_partial.carbon:[[@LINE+11]]:21
|
||||
// CHECK:STDERR: -> │ let unused v: X = value as X;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `partial X` to
|
||||
// CHECK:STDERR: · │ ┃ `X` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `partial X` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.As(X)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused v: X = value as X;
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:24-37: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_partial.carbon:[[@LINE+11]]:24
|
||||
// CHECK:STDERR: -> │ let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `partial X`
|
||||
// CHECK:STDERR: · │ ┃ to `X` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `partial X` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.As(X)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `partial X*` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:22-30: note: type `partial X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_cannot_remove_partial.carbon:[[@LINE+11]]:22
|
||||
// CHECK:STDERR: -> │ let unused b: X* = ptr as X*;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `partial X*`
|
||||
// CHECK:STDERR: · │ ┃ to `X*` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `partial X*` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.As(X*)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused b: X* = ptr as X*;
|
||||
}
|
||||
|
||||
+9
-2
@@ -18,8 +18,15 @@ class A {};
|
||||
class B {};
|
||||
|
||||
fn Convert(a: A) -> B {
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:10-22: error: cannot convert expression of type `A` to `B` with `unsafe as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:10-22: note: type `A` does not implement interface `Core.UnsafeAs(B)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_no_conversion.carbon:[[@LINE+10]]:10
|
||||
// CHECK:STDERR: -> │ return a unsafe as B;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `A` to `B` with
|
||||
// CHECK:STDERR: · │ ┃ `unsafe as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `A` does not implement interface `Core.UnsafeAs(B)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return a unsafe as B;
|
||||
}
|
||||
+12
-2
@@ -17,10 +17,20 @@
|
||||
// This regression test ensures that reuse of `<error>` in different scopes
|
||||
// works.
|
||||
|
||||
// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+2]]:8-20: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant]
|
||||
// CHECK:STDERR: ╭─┤ fail_multi_error.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ fn Foo[runtime a: ()]();
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: implicit parameters of functions must be constant
|
||||
// CHECK:STDERR: · ┃ [ImplictParamMustBeConstant]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Foo[runtime a: ()]();
|
||||
// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+2]]:8-20: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant]
|
||||
// CHECK:STDERR: ╭─┤ fail_multi_error.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ fn Boo[runtime a: ()]() {}
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: implicit parameters of functions must be constant
|
||||
// CHECK:STDERR: · ┃ [ImplictParamMustBeConstant]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Boo[runtime a: ()]() {}
|
||||
|
||||
|
||||
+11
-2
@@ -16,7 +16,11 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn Main() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_not_found.carbon:[[@LINE+2]]:3: error: name `x` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_found.carbon:[[@LINE+6]]:3
|
||||
// CHECK:STDERR: -> │ x;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `x` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
x;
|
||||
//@dump-sem-ir-end
|
||||
@@ -28,7 +32,12 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_qualififier_unsupported.carbon:[[@LINE+2]]:3-8: error: type `bool` does not support qualified expressions [QualifiedExprUnsupported]
|
||||
// CHECK:STDERR: ╭─┤ fail_qualififier_unsupported.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ true.b;
|
||||
// CHECK:STDERR: · ━━━┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: type `bool` does not support qualified expressions
|
||||
// CHECK:STDERR: · ┃ [QualifiedExprUnsupported]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
true.b;
|
||||
//@dump-sem-ir-end
|
||||
|
||||
+17
-3
@@ -63,7 +63,11 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_negative_bound.carbon:[[@LINE+2]]:8-25: error: array bound of -1 is negative [ArrayBoundNegative]
|
||||
// CHECK:STDERR: ╭─┤ fail_negative_bound.carbon:[[@LINE+6]]:8
|
||||
// CHECK:STDERR: -> │ var n: MakeArray(i32, -1);
|
||||
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound of -1 is negative [ArrayBoundNegative]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var n: MakeArray(i32, -1);
|
||||
|
||||
@@ -73,7 +77,12 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_bound_too_large.carbon:[[@LINE+2]]:8-46: error: array bound of 18446744073709551616 is too large [ArrayBoundTooLarge]
|
||||
// CHECK:STDERR: ╭─┤ fail_bound_too_large.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ var n: MakeArray(i32, 0x1_0000_0000_0000_0000);
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound of 18446744073709551616 is too large
|
||||
// CHECK:STDERR: · ┃ [ArrayBoundTooLarge]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var n: MakeArray(i32, 0x1_0000_0000_0000_0000);
|
||||
|
||||
@@ -84,7 +93,12 @@ library "[[@TEST_NAME]]";
|
||||
import library "types";
|
||||
|
||||
fn F(n: Core.IntLiteral) {
|
||||
// CHECK:STDERR: fail_dyn_bound.carbon:[[@LINE+2]]:17-33: error: cannot evaluate type expression [TypeExprEvaluationFailure]
|
||||
// CHECK:STDERR: ╭─┤ fail_dyn_bound.carbon:[[@LINE+7]]:17
|
||||
// CHECK:STDERR: -> │ var unused a: MakeArray(i32, n);
|
||||
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression
|
||||
// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused a: MakeArray(i32, n);
|
||||
}
|
||||
|
||||
+38
-6
@@ -41,22 +41,54 @@ alias IntLiteral = MakeIntLiteral();
|
||||
fn AddCharInt(c: CharLiteral, n: IntLiteral) -> CharLiteral = "char_literal.add";
|
||||
fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-54: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let a: CharLiteral = AddCharInt('a', 0x10000000000000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 4503599627370593 is
|
||||
// CHECK:STDERR: · ┃ not a valid Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = AddCharInt('a', 0x10000000000000);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+5]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE-3]]:5-18: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+19]]:5
|
||||
// CHECK:STDERR: │ let a: CharLiteral = AddCharInt('a', 0x10000000000000);
|
||||
// CHECK:STDERR: · ───────┬──────
|
||||
// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ let a: CharLiteral = AddCharInt('\u{10FFFF}', 1);
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: duplicate name `a` being declared in the same scope
|
||||
// CHECK:STDERR: · ┃ [NameDeclDuplicate]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-48: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let a: CharLiteral = AddCharInt('\u{10FFFF}', 1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 1114112 is not a
|
||||
// CHECK:STDERR: · ┃ valid Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = AddCharInt('\u{10FFFF}', 1);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-46: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let b: CharLiteral = AddCharInt('\u{D7FF}', 1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 55296 is not a
|
||||
// CHECK:STDERR: · ┃ valid Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: CharLiteral = AddCharInt('\u{D7FF}', 1);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-48: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let c: CharLiteral = AddCharInt('a', Negate(98));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result -1 is not a valid
|
||||
// CHECK:STDERR: · ┃ Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: CharLiteral = AddCharInt('a', Negate(98));
|
||||
|
||||
|
||||
@@ -26,15 +26,30 @@ fn ToChar(c: CharLiteral) -> UInt(8) = "char_literal.convert_char";
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "builtin";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn ToCharBarResultU16(c: CharLiteral) -> UInt(16) = "char_literal.convert_char";
|
||||
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "char_literal.convert_char"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn ToCharBarResultU16(c: CharLiteral) -> UInt(16) = "char_literal.convert_char";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn ToCharBadResultU9(c: CharLiteral) -> UInt(9) = "char_literal.convert_char";
|
||||
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "char_literal.convert_char"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn ToCharBadResultU9(c: CharLiteral) -> UInt(9) = "char_literal.convert_char";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-31: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn ToCharNoParam() -> UInt(8) = "char_literal.convert_char";
|
||||
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "char_literal.convert_char"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn ToCharNoParam() -> UInt(8) = "char_literal.convert_char";
|
||||
|
||||
@@ -44,8 +59,18 @@ library "[[@TEST_NAME]]";
|
||||
import library "builtin";
|
||||
|
||||
let c: CharLiteral = 'a';
|
||||
// CHECK:STDERR: fail_runtime_call.carbon:[[@LINE+3]]:18-26: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: builtin.carbon:10:1-38: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_call.carbon:[[@LINE+13]]:18
|
||||
// CHECK:STDERR: -> │ let d: UInt(8) = ToChar(c);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ builtin.carbon
|
||||
// CHECK:STDERR: │ fn ToChar(c: CharLiteral) -> UInt(8) = "char_literal.convert_char";
|
||||
// CHECK:STDERR: · ───────────────────┬──────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let d: UInt(8) = ToChar(c);
|
||||
|
||||
@@ -65,7 +90,13 @@ let c: UInt(8) = ToChar('\u{7F}');
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "builtin";
|
||||
|
||||
// CHECK:STDERR: fail_size_small.carbon:[[@LINE+2]]:18-33: error: character value U+0080 too large for type `<builtin u8>` [CharTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_size_small.carbon:[[@LINE+8]]:18
|
||||
// CHECK:STDERR: -> │ let c: UInt(8) = ToChar('\u{80}');
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character value U+0080 too large for type
|
||||
// CHECK:STDERR: · ┃ `<builtin u8>`
|
||||
// CHECK:STDERR: · ┃ [CharTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: UInt(8) = ToChar('\u{80}');
|
||||
|
||||
@@ -74,7 +105,13 @@ let c: UInt(8) = ToChar('\u{80}');
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "builtin";
|
||||
|
||||
// CHECK:STDERR: fail_size_multi_byte.carbon:[[@LINE+2]]:18-35: error: character value U+1E15 too large for type `<builtin u8>` [CharTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_size_multi_byte.carbon:[[@LINE+8]]:18
|
||||
// CHECK:STDERR: -> │ let c: UInt(8) = ToChar('\u{1E15}');
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character value U+1E15 too large for type
|
||||
// CHECK:STDERR: · ┃ `<builtin u8>`
|
||||
// CHECK:STDERR: · ┃ [CharTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: UInt(8) = ToChar('\u{1E15}');
|
||||
|
||||
|
||||
@@ -45,10 +45,23 @@ fn UInt(n: IntLiteral) -> type = "int.make_type_unsigned";
|
||||
|
||||
fn ConvertToU8(c: CharLiteral) -> UInt(8) = "char_literal.convert_int";
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+5]]:13-34: error: character value U+0100 too large for type `<builtin u8>` [CharTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+18]]:13
|
||||
// CHECK:STDERR: -> │ let g: u8 = ConvertToU8('\u{100}');
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character value U+0100 too large for type `<builtin u8>`
|
||||
// CHECK:STDERR: · ┃ [CharTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:13-34: error: cannot implicitly convert expression of type `<builtin u8>` to `u8` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:13-34: note: type `<builtin u8>` does not implement interface `Core.ImplicitAs(u8)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+11]]:13
|
||||
// CHECK:STDERR: -> │ let g: u8 = ConvertToU8('\u{100}');
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
|
||||
// CHECK:STDERR: · │ ┃ `<builtin u8>` to `u8`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `<builtin u8>` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.ImplicitAs(u8)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let g: u8 = ConvertToU8('\u{100}');
|
||||
|
||||
|
||||
@@ -42,11 +42,23 @@ alias IntLiteral = MakeIntLiteral();
|
||||
fn SubCharInt(c: CharLiteral, n: IntLiteral) -> CharLiteral = "char_literal.sub_int";
|
||||
fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-46: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let a: CharLiteral = SubCharInt('\u{0000}', 1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result -1 is not a valid
|
||||
// CHECK:STDERR: · ┃ Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = SubCharInt('\u{0000}', 1);
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-56: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let b: CharLiteral = SubCharInt('\u{10FFFF}', Negate(1));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 1114112 is not a
|
||||
// CHECK:STDERR: · ┃ valid Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: CharLiteral = SubCharInt('\u{10FFFF}', Negate(1));
|
||||
|
||||
|
||||
@@ -58,10 +58,24 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class FailIncomplete;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+5]]:17-33: error: function returns incomplete type `FailIncomplete` [IncompleteTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-3]]:1-21: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+19]]:17
|
||||
// CHECK:STDERR: │ class FailIncomplete;
|
||||
// CHECK:STDERR: · ──────────┬──────────
|
||||
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `FailIncomplete`
|
||||
// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+8]]:1
|
||||
// CHECK:STDERR: -> │ fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function
|
||||
// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -74,7 +88,13 @@ class FailWrongArg {
|
||||
var end: i32*;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_arg.carbon:[[@LINE+2]]:1-33: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_wrong_arg.carbon:[[@LINE+8]]:1
|
||||
// CHECK:STDERR: -> │ fn Make(n: i32) -> FailWrongArg = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function
|
||||
// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Make(n: i32) -> FailWrongArg = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -87,7 +107,13 @@ class FailWrongArgCount {
|
||||
var end: i32*;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+2]]:1-58: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_wrong_arg_count.carbon:[[@LINE+8]]:1
|
||||
// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initia...
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function
|
||||
// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -95,7 +121,13 @@ fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_not_a_class.carbon:[[@LINE+2]]:1-36: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_a_class.carbon:[[@LINE+8]]:1
|
||||
// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3)) -> i32 = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function
|
||||
// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3)) -> i32 = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -107,7 +139,13 @@ class FailWrongFieldCount {
|
||||
var start: i32*;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_field_count.carbon:[[@LINE+2]]:1-52: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_wrong_field_count.carbon:[[@LINE+8]]:1
|
||||
// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3)) -> FailWrongFieldCount = "cpp.std.initializer_...
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function
|
||||
// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3)) -> FailWrongFieldCount = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -120,7 +158,13 @@ class FailWrongFirstField {
|
||||
var end: i32;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_first_field.carbon:[[@LINE+2]]:1-52: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_wrong_first_field.carbon:[[@LINE+8]]:1
|
||||
// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3)) -> FailWrongFirstField = "cpp.std.initializer_...
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function
|
||||
// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3)) -> FailWrongFirstField = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -133,6 +177,12 @@ class FailWrongSecondField {
|
||||
var end: {.a: i32};
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_second_field.carbon:[[@LINE+2]]:1-53: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_wrong_second_field.carbon:[[@LINE+8]]:1
|
||||
// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3)) -> FailWrongSecondField = "cpp.std.initializer...
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function
|
||||
// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3)) -> FailWrongSecondField = "cpp.std.initializer_list.make";
|
||||
+18
-3
@@ -28,13 +28,28 @@ var x: f64 = Add(2.2, 2.3);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew(a: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn BadReturnType(a: f64, b: f64) -> bool = "float.add";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.add";
|
||||
fn JustRight(a: f64, b: f64) -> f64 = "float.add";
|
||||
|
||||
+18
-3
@@ -24,11 +24,21 @@ fn Call(ref a: f64, b: f64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: f64, b: f64) = "float.add_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: f64, b: f64) = "float.add_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: f64, b: f32) = "float.add_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: f64, b: f32) = "float.add_assign";
|
||||
|
||||
@@ -37,6 +47,11 @@ fn MixedTypes(ref a: f64, b: f32) = "float.add_assign";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.add_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.add_assign";
|
||||
+58
-31
@@ -110,13 +110,29 @@ import library "f32";
|
||||
import library "f64";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-37: error: value 9.9999999999999994E+38 too large for floating-point type `f32` [FloatTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_truncate_overflow.carbon:[[@LINE+8]]:14
|
||||
// CHECK:STDERR: -> │ let a: f32 = Float64ToFloat32(1.0e39);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: value 9.9999999999999994E+38 too large for
|
||||
// CHECK:STDERR: · ┃ floating-point type `f32`
|
||||
// CHECK:STDERR: · ┃ [FloatTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: f32 = Float64ToFloat32(1.0e39);
|
||||
// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-42: error: value 10*10^38 too large for floating-point type `f32` [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_truncate_overflow.carbon:[[@LINE+7]]:14
|
||||
// CHECK:STDERR: -> │ let b: f32 = FloatLiteralToFloat32(1.0e39);
|
||||
// CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: value 10*10^38 too large for floating-point type `f32`
|
||||
// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: f32 = FloatLiteralToFloat32(1.0e39);
|
||||
// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-43: error: value 10*10^308 too large for floating-point type `f64` [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_truncate_overflow.carbon:[[@LINE+7]]:14
|
||||
// CHECK:STDERR: -> │ let c: f64 = FloatLiteralToFloat64(1.0e309);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: value 10*10^308 too large for floating-point type `f64`
|
||||
// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: f64 = FloatLiteralToFloat64(1.0e309);
|
||||
//@dump-sem-ir-end
|
||||
@@ -138,8 +154,19 @@ import library "f64";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
let not_constant_64: f64 = 0.0;
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:33-65: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: f64.carbon:5:1-36: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:33
|
||||
// CHECK:STDERR: -> │ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to
|
||||
// CHECK:STDERR: · ┃ compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ f64.carbon
|
||||
// CHECK:STDERR: │ fn Float64ToFloat64(a: f64) -> f64 = "float.convert_checked";
|
||||
// CHECK:STDERR: · ──────────────────┬─────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
//@dump-sem-ir-end
|
||||
@@ -614,24 +641,24 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %.loc9_37.1: %f32.3bc = value_of_initializer @__global_init.%Float64ToFloat32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc9_37.2: %f32.3bc = converted @__global_init.%Float64ToFloat32.call, %.loc9_37.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f32.loc9: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc]
|
||||
// CHECK:STDOUT: %a: %f32.3bc = wrapper_binding a, %.loc9_37.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_37.1: %f32.3bc = value_of_initializer @__global_init.%Float64ToFloat32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_37.2: %f32.3bc = converted @__global_init.%Float64ToFloat32.call, %.loc15_37.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f32.loc15: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc]
|
||||
// CHECK:STDOUT: %a: %f32.3bc = wrapper_binding a, %.loc15_37.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %a.patt: %pattern_type.239 = value_binding_pattern a [concrete = constants.%a.patt.56d]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc12_42.1: %f32.3bc = value_of_initializer @__global_init.%FloatLiteralToFloat32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc12_42.2: %f32.3bc = converted @__global_init.%FloatLiteralToFloat32.call, %.loc12_42.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f32.loc12: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc]
|
||||
// CHECK:STDOUT: %b: %f32.3bc = wrapper_binding b, %.loc12_42.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc23_42.1: %f32.3bc = value_of_initializer @__global_init.%FloatLiteralToFloat32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc23_42.2: %f32.3bc = converted @__global_init.%FloatLiteralToFloat32.call, %.loc23_42.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f32.loc23: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc]
|
||||
// CHECK:STDOUT: %b: %f32.3bc = wrapper_binding b, %.loc23_42.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %b.patt: %pattern_type.239 = value_binding_pattern b [concrete = constants.%b.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc15_43.1: %f64.761 = value_of_initializer @__global_init.%FloatLiteralToFloat64.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_43.2: %f64.761 = converted @__global_init.%FloatLiteralToFloat64.call, %.loc15_43.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc31_43.1: %f64.761 = value_of_initializer @__global_init.%FloatLiteralToFloat64.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc31_43.2: %f64.761 = converted @__global_init.%FloatLiteralToFloat64.call, %.loc31_43.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f64: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
|
||||
// CHECK:STDOUT: %c: %f64.761 = wrapper_binding c, %.loc15_43.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %c: %f64.761 = wrapper_binding c, %.loc31_43.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %c.patt: %pattern_type.667 = value_binding_pattern c [concrete = constants.%c.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -640,21 +667,21 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Float64ToFloat32.ref: %Float64ToFloat32.type = name_ref Float64ToFloat32, imports.%Main.Float64ToFloat32 [concrete = constants.%Float64ToFloat32]
|
||||
// CHECK:STDOUT: %float.loc9: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.1]
|
||||
// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.1]
|
||||
// CHECK:STDOUT: %impl.elem0: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc9_31.1: <bound method> = bound_method %float.loc9, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %bound_method.loc15_31.1: <bound method> = bound_method %float.loc15, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc9_31.2: <bound method> = bound_method %float.loc9, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc9_31.2(%float.loc9) [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %.loc9_31.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %.loc9_31.2: %f64.761 = converted %float.loc9, %.loc9_31.1 [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %Float64ToFloat32.call: init %f32.3bc = call %Float64ToFloat32.ref(%.loc9_31.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %bound_method.loc15_31.2: <bound method> = bound_method %float.loc15, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc15_31.2(%float.loc15) [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %.loc15_31.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %.loc15_31.2: %f64.761 = converted %float.loc15, %.loc15_31.1 [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %Float64ToFloat32.call: init %f32.3bc = call %Float64ToFloat32.ref(%.loc15_31.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat32.ref: %FloatLiteralToFloat32.type = name_ref FloatLiteralToFloat32, imports.%Main.FloatLiteralToFloat32 [concrete = constants.%FloatLiteralToFloat32]
|
||||
// CHECK:STDOUT: %float.loc12: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.2]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat32.call: init %f32.3bc = call %FloatLiteralToFloat32.ref(%float.loc12) [concrete = <error>]
|
||||
// CHECK:STDOUT: %float.loc23: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.2]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat32.call: init %f32.3bc = call %FloatLiteralToFloat32.ref(%float.loc23) [concrete = <error>]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat64.ref: %FloatLiteralToFloat64.type = name_ref FloatLiteralToFloat64, imports.%Main.FloatLiteralToFloat64 [concrete = constants.%FloatLiteralToFloat64]
|
||||
// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e308 [concrete = constants.%float.82f]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat64.call: init %f64.761 = call %FloatLiteralToFloat64.ref(%float.loc15) [concrete = <error>]
|
||||
// CHECK:STDOUT: %float.loc31: Core.FloatLiteral = float_literal_value 10e308 [concrete = constants.%float.82f]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat64.call: init %f64.761 = call %FloatLiteralToFloat64.ref(%float.loc31) [concrete = <error>]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -789,10 +816,10 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %not_constant_64.patt: %pattern_type.667 = value_binding_pattern not_constant_64 [concrete = constants.%not_constant_64.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc10_65.1: %f64.761 = value_of_initializer @__global_init.%Float64ToFloat64.call
|
||||
// CHECK:STDOUT: %.loc10_65.2: %f64.761 = converted @__global_init.%Float64ToFloat64.call, %.loc10_65.1
|
||||
// CHECK:STDOUT: %f64.loc10: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
|
||||
// CHECK:STDOUT: %convert_not_constant: %f64.761 = wrapper_binding convert_not_constant, %.loc10_65.2
|
||||
// CHECK:STDOUT: %.loc21_65.1: %f64.761 = value_of_initializer @__global_init.%Float64ToFloat64.call
|
||||
// CHECK:STDOUT: %.loc21_65.2: %f64.761 = converted @__global_init.%Float64ToFloat64.call, %.loc21_65.1
|
||||
// CHECK:STDOUT: %f64.loc21: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
|
||||
// CHECK:STDOUT: %convert_not_constant: %f64.761 = wrapper_binding convert_not_constant, %.loc21_65.2
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %convert_not_constant.patt: %pattern_type.667 = value_binding_pattern convert_not_constant [concrete = constants.%convert_not_constant.patt]
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+320
-206
@@ -96,74 +96,178 @@ library "[[@TEST_NAME]]";
|
||||
import library "float_to_int";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:21-49: error: floating-point value 2147483648 too large for integer type `i32` [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:21
|
||||
// CHECK:STDERR: -> │ let overflow: i32 = ConvertF64ToI32(2147483648.0);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value 2147483648 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let overflow: i32 = ConvertF64ToI32(2147483648.0);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-58: error: floating-point value -2147483649 too large for integer type `i32` [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let underflow: i32 = ConvertF64ToI32(Negate(2147483649.0));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value -2147483649 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let underflow: i32 = ConvertF64ToI32(Negate(2147483649.0));
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:25-52: error: floating-point value -1 too large for integer type `u32` [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:25
|
||||
// CHECK:STDERR: -> │ let unsigned_neg: u32 = ConvertF64ToU32(Negate(1.0));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value -1 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `u32`
|
||||
// CHECK:STDERR: · ┃ [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unsigned_neg: u32 = ConvertF64ToU32(Negate(1.0));
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:29-66: error: floating-point value 21474836480*10^-1 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:29
|
||||
// CHECK:STDERR: -> │ let literal_overflow: i32 = ConvertFloatLiteralToI32(2147483648.0);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value 21474836480*10^-1
|
||||
// CHECK:STDERR: · ┃ too large for integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow: i32 = ConvertFloatLiteralToI32(2147483648.0);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:35-71: error: floating-point value 10*10^999999 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:35
|
||||
// CHECK:STDERR: -> │ let giant_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value 10*10^999999
|
||||
// CHECK:STDERR: · ┃ too large for integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let giant_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:62-106: error: floating-point value 10*10^9999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+11]]:62
|
||||
// CHECK:STDERR: -> │ ...overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value 10*10^9999999
|
||||
// CHECK:STDERR: · ┃ too large to convert: result would be
|
||||
// CHECK:STDERR: · ┃ an integer whose width is greater
|
||||
// CHECK:STDERR: · ┃ than the maximum supported width of
|
||||
// CHECK:STDERR: · ┃ 8388608
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForUnsizedInt]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let giant_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-107: error: floating-point value 10*10^999999999999999999999999999999999 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:44
|
||||
// CHECK:STDERR: -> │ ...l_overflow: i32 = ConvertFloatLiteralToI32(1.0e100000000000000000000000000...
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value
|
||||
// CHECK:STDERR: · ┃ 10*10^999999999999999999999999999999999 too
|
||||
// CHECK:STDERR: · ┃ large for integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let giant_exponent_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000000000000000000000000000000);
|
||||
|
||||
//
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:71-141: error: floating-point value 10*10^999999999999999999999999999999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+11]]:71
|
||||
// CHECK:STDERR: -> │ ...Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000000000000000...
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value
|
||||
// CHECK:STDERR: · ┃ 10*10^999999999999999999999999999999999 too
|
||||
// CHECK:STDERR: · ┃ large to convert: result would be an integer
|
||||
// CHECK:STDERR: · ┃ whose width is greater than the maximum
|
||||
// CHECK:STDERR: · ┃ supported width of 8388608
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForUnsizedInt]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e1000000000000000000000000000000000);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-82: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:44
|
||||
// CHECK:STDERR: -> │ ...al_overflow_large_mantissa: i32 = ConvertFloatLiteralToI32(214748364.8e1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value
|
||||
// CHECK:STDERR: · ┃ 2147483648*10^0 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_large_mantissa: i32 = ConvertFloatLiteralToI32(214748364.8e1);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:42-80: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:42
|
||||
// CHECK:STDERR: -> │ ...eral_overflow_med_mantissa: i32 = ConvertFloatLiteralToI32(21474.83648e5);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value
|
||||
// CHECK:STDERR: · ┃ 2147483648*10^0 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_med_mantissa: i32 = ConvertFloatLiteralToI32(21474.83648e5);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:46-85: error: floating-point value 2147483648*2^0 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:46
|
||||
// CHECK:STDERR: -> │ ...overflow_hex_med_mantissa: i32 = ConvertFloatLiteralToI32(0x8000.0000p16);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value
|
||||
// CHECK:STDERR: · ┃ 2147483648*2^0 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_hex_med_mantissa: i32 = ConvertFloatLiteralToI32(0x8000.0000p16);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-75: error: floating-point value 10*10^9 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:44
|
||||
// CHECK:STDERR: -> │ let literal_overflow_small_mantissa: i32 = ConvertFloatLiteralToI32(1.0e10);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value
|
||||
// CHECK:STDERR: · ┃ 10*10^9 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_small_mantissa: i32 = ConvertFloatLiteralToI32(1.0e10);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:48-81: error: floating-point value 16*2^27 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:48
|
||||
// CHECK:STDERR: -> │ ...ral_overflow_bin_small_mantissa: i32 = ConvertFloatLiteralToI32(0x1.0p31);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value
|
||||
// CHECK:STDERR: · ┃ 16*2^27 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_bin_small_mantissa: i32 = ConvertFloatLiteralToI32(0x1.0p31);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:42-72: error: floating-point value 50*10^8 too large for integer type `u32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:42
|
||||
// CHECK:STDERR: -> │ let literal_overflow_unsigned_neg: u32 = ConvertFloatLiteralToU32(5.0e9);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value
|
||||
// CHECK:STDERR: · ┃ 50*10^8 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `u32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_unsigned_neg: u32 = ConvertFloatLiteralToU32(5.0e9);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:46-79: error: floating-point value 16*2^28 too large for integer type `u32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:46
|
||||
// CHECK:STDERR: -> │ let literal_overflow_bin_unsigned_neg: u32 = ConvertFloatLiteralToU32(0x1.0p32);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: floating-point value
|
||||
// CHECK:STDERR: · ┃ 16*2^28 too large for
|
||||
// CHECK:STDERR: · ┃ integer type `u32`
|
||||
// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_bin_unsigned_neg: u32 = ConvertFloatLiteralToU32(0x1.0p32);
|
||||
//@dump-sem-ir-end
|
||||
@@ -173,11 +277,21 @@ library "[[@TEST_NAME]]";
|
||||
import library "float_to_int";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+2]]:20-49: error: cannot convert NaN to integer type `i32` [FloatNaNConvertedToInt]
|
||||
// CHECK:STDERR: ╭─┤ fail_nan_inf.carbon:[[@LINE+7]]:20
|
||||
// CHECK:STDERR: -> │ let nan_val: i32 = ConvertF64ToI32(Div(0.0, 0.0));
|
||||
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert NaN to integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [FloatNaNConvertedToInt]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let nan_val: i32 = ConvertF64ToI32(Div(0.0, 0.0));
|
||||
|
||||
// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+2]]:20-49: error: cannot convert infinity to integer type `i32` [FloatInfinityConvertedToInt]
|
||||
// CHECK:STDERR: ╭─┤ fail_nan_inf.carbon:[[@LINE+7]]:20
|
||||
// CHECK:STDERR: -> │ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDERR: · ━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert infinity to integer type `i32`
|
||||
// CHECK:STDERR: · ┃ [FloatInfinityConvertedToInt]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
//@dump-sem-ir-end
|
||||
@@ -290,114 +404,114 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %.loc7_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc7 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc7_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc7, %.loc7_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %overflow: %i32 = wrapper_binding overflow, %.loc7_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc13_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc13 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc13_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc13, %.loc13_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc13: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %overflow: %i32 = wrapper_binding overflow, %.loc13_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %overflow.patt: %pattern_type.d94 = value_binding_pattern overflow [concrete = constants.%overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc11_58.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc11 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc11_58.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc11, %.loc11_58.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc11: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %underflow: %i32 = wrapper_binding underflow, %.loc11_58.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc23_58.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc23 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc23_58.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc23, %.loc23_58.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %underflow: %i32 = wrapper_binding underflow, %.loc23_58.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %underflow.patt: %pattern_type.d94 = value_binding_pattern underflow [concrete = constants.%underflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc15_52.1: %u32 = value_of_initializer @__global_init.%ConvertF64ToU32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_52.2: %u32 = converted @__global_init.%ConvertF64ToU32.call, %.loc15_52.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc15: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %unsigned_neg: %u32 = wrapper_binding unsigned_neg, %.loc15_52.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc33_52.1: %u32 = value_of_initializer @__global_init.%ConvertF64ToU32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc33_52.2: %u32 = converted @__global_init.%ConvertF64ToU32.call, %.loc33_52.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc33: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %unsigned_neg: %u32 = wrapper_binding unsigned_neg, %.loc33_52.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %unsigned_neg.patt: %pattern_type.129 = value_binding_pattern unsigned_neg [concrete = constants.%unsigned_neg.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc19_66.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc19 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc19_66.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc19, %.loc19_66.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow: %i32 = wrapper_binding literal_overflow, %.loc19_66.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc43_66.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc43 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc43_66.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc43, %.loc43_66.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc43: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow: %i32 = wrapper_binding literal_overflow, %.loc43_66.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow.patt: %pattern_type.d94 = value_binding_pattern literal_overflow [concrete = constants.%literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc23_71.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc23 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc23_71.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc23, %.loc23_71.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %giant_literal_overflow: %i32 = wrapper_binding giant_literal_overflow, %.loc23_71.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc53_71.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc53 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc53_71.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc53, %.loc53_71.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc53: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %giant_literal_overflow: %i32 = wrapper_binding giant_literal_overflow, %.loc53_71.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %giant_literal_overflow.patt: %pattern_type.d94 = value_binding_pattern giant_literal_overflow [concrete = constants.%giant_literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc28_106.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc28 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc28_106.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc28, %.loc28_106.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc28_48: type = splice_block %IntLiteral.ref.loc28 [concrete = Core.IntLiteral] {
|
||||
// CHECK:STDOUT: %Core.ref.loc28: <namespace> = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1]
|
||||
// CHECK:STDOUT: %IntLiteral.ref.loc28: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: %.loc67_106.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc67 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc67_106.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc67, %.loc67_106.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc67_48: type = splice_block %IntLiteral.ref.loc67 [concrete = Core.IntLiteral] {
|
||||
// CHECK:STDOUT: %Core.ref.loc67: <namespace> = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1]
|
||||
// CHECK:STDOUT: %IntLiteral.ref.loc67: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %giant_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_literal_to_int_literal_overflow, %.loc28_106.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %giant_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_literal_to_int_literal_overflow, %.loc67_106.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %giant_literal_to_int_literal_overflow.patt: %pattern_type.dc0 = value_binding_pattern giant_literal_to_int_literal_overflow [concrete = constants.%giant_literal_to_int_literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc33_107.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc33 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc33_107.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc33, %.loc33_107.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %giant_exponent_literal_overflow: %i32 = wrapper_binding giant_exponent_literal_overflow, %.loc33_107.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc79_107.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc79 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc79_107.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc79, %.loc79_107.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc79: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %giant_exponent_literal_overflow: %i32 = wrapper_binding giant_exponent_literal_overflow, %.loc79_107.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %giant_exponent_literal_overflow.patt: %pattern_type.d94 = value_binding_pattern giant_exponent_literal_overflow [concrete = constants.%giant_exponent_literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc39_141.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc39 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc39_141.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc39, %.loc39_141.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc39_57: type = splice_block %IntLiteral.ref.loc39 [concrete = Core.IntLiteral] {
|
||||
// CHECK:STDOUT: %Core.ref.loc39: <namespace> = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1]
|
||||
// CHECK:STDOUT: %IntLiteral.ref.loc39: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: %.loc94_141.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc94 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc94_141.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc94, %.loc94_141.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc94_57: type = splice_block %IntLiteral.ref.loc94 [concrete = Core.IntLiteral] {
|
||||
// CHECK:STDOUT: %Core.ref.loc94: <namespace> = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1]
|
||||
// CHECK:STDOUT: %IntLiteral.ref.loc94: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_exponent_literal_to_int_literal_overflow, %.loc39_141.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_exponent_literal_to_int_literal_overflow, %.loc94_141.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow.patt: %pattern_type.dc0 = value_binding_pattern giant_exponent_literal_to_int_literal_overflow [concrete = constants.%giant_exponent_literal_to_int_literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc44_82.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc44 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc44_82.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc44, %.loc44_82.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc44: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_large_mantissa: %i32 = wrapper_binding literal_overflow_large_mantissa, %.loc44_82.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc106_82.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc106 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc106_82.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc106, %.loc106_82.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc106: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_large_mantissa: %i32 = wrapper_binding literal_overflow_large_mantissa, %.loc106_82.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_large_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_large_mantissa [concrete = constants.%literal_overflow_large_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc49_80.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc49 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc49_80.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc49, %.loc49_80.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc49: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_med_mantissa: %i32 = wrapper_binding literal_overflow_med_mantissa, %.loc49_80.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc118_80.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc118 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc118_80.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc118, %.loc118_80.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc118: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_med_mantissa: %i32 = wrapper_binding literal_overflow_med_mantissa, %.loc118_80.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_med_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_med_mantissa [concrete = constants.%literal_overflow_med_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc54_85.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc54 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc54_85.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc54, %.loc54_85.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc54: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_hex_med_mantissa: %i32 = wrapper_binding literal_overflow_hex_med_mantissa, %.loc54_85.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc130_85.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc130 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc130_85.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc130, %.loc130_85.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc130: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_hex_med_mantissa: %i32 = wrapper_binding literal_overflow_hex_med_mantissa, %.loc130_85.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_hex_med_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_hex_med_mantissa [concrete = constants.%literal_overflow_hex_med_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc59_75.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc59 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc59_75.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc59, %.loc59_75.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc59: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_small_mantissa: %i32 = wrapper_binding literal_overflow_small_mantissa, %.loc59_75.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc142_75.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc142 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc142_75.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc142, %.loc142_75.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc142: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_small_mantissa: %i32 = wrapper_binding literal_overflow_small_mantissa, %.loc142_75.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_small_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_small_mantissa [concrete = constants.%literal_overflow_small_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc64_81.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc64 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc64_81.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc64, %.loc64_81.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc64: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_bin_small_mantissa: %i32 = wrapper_binding literal_overflow_bin_small_mantissa, %.loc64_81.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc154_81.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc154 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc154_81.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc154, %.loc154_81.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc154: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_bin_small_mantissa: %i32 = wrapper_binding literal_overflow_bin_small_mantissa, %.loc154_81.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_bin_small_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_bin_small_mantissa [concrete = constants.%literal_overflow_bin_small_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc69_72.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc69 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc69_72.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc69, %.loc69_72.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc69: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %literal_overflow_unsigned_neg: %u32 = wrapper_binding literal_overflow_unsigned_neg, %.loc69_72.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc166_72.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc166 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc166_72.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc166, %.loc166_72.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc166: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %literal_overflow_unsigned_neg: %u32 = wrapper_binding literal_overflow_unsigned_neg, %.loc166_72.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_unsigned_neg.patt: %pattern_type.129 = value_binding_pattern literal_overflow_unsigned_neg [concrete = constants.%literal_overflow_unsigned_neg.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc74_79.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc74 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc74_79.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc74, %.loc74_79.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc74: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg: %u32 = wrapper_binding literal_overflow_bin_unsigned_neg, %.loc74_79.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc178_79.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc178 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc178_79.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc178, %.loc178_79.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc178: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg: %u32 = wrapper_binding literal_overflow_bin_unsigned_neg, %.loc178_79.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg.patt: %pattern_type.129 = value_binding_pattern literal_overflow_bin_unsigned_neg [concrete = constants.%literal_overflow_bin_unsigned_neg.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -405,80 +519,80 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc7: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %float.loc7: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.1]
|
||||
// CHECK:STDOUT: %impl.elem0.loc7: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc7_37.1: <bound method> = bound_method %float.loc7, %impl.elem0.loc7 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.9eb]
|
||||
// CHECK:STDOUT: %specific_fn.loc7: <specific function> = specific_function %impl.elem0.loc7, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc7_37.2: <bound method> = bound_method %float.loc7, %specific_fn.loc7 [concrete = constants.%bound_method.847]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7: init %f64.761 = call %bound_method.loc7_37.2(%float.loc7) [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %.loc7_37.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %.loc7_37.2: %f64.761 = converted %float.loc7, %.loc7_37.1 [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc7: init %i32 = call %ConvertF64ToI32.ref.loc7(%.loc7_37.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc11: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Negate.ref.loc11: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate]
|
||||
// CHECK:STDOUT: %float.loc11: Core.FloatLiteral = float_literal_value 21474836490e-1 [concrete = constants.%float.449]
|
||||
// CHECK:STDOUT: %impl.elem0.loc11: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc11_45.1: <bound method> = bound_method %float.loc11, %impl.elem0.loc11 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.00d]
|
||||
// CHECK:STDOUT: %specific_fn.loc11: <specific function> = specific_function %impl.elem0.loc11, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc11_45.2: <bound method> = bound_method %float.loc11, %specific_fn.loc11 [concrete = constants.%bound_method.a16]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11: init %f64.761 = call %bound_method.loc11_45.2(%float.loc11) [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %.loc11_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11 [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %.loc11_45.2: %f64.761 = converted %float.loc11, %.loc11_45.1 [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %Negate.call.loc11: init %f64.761 = call %Negate.ref.loc11(%.loc11_45.2) [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %.loc11_57.1: %f64.761 = value_of_initializer %Negate.call.loc11 [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %.loc11_57.2: %f64.761 = converted %Negate.call.loc11, %.loc11_57.1 [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc11: init %i32 = call %ConvertF64ToI32.ref.loc11(%.loc11_57.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc13: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %float.loc13: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.1]
|
||||
// CHECK:STDOUT: %impl.elem0.loc13: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc13_37.1: <bound method> = bound_method %float.loc13, %impl.elem0.loc13 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.9eb]
|
||||
// CHECK:STDOUT: %specific_fn.loc13: <specific function> = specific_function %impl.elem0.loc13, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc13_37.2: <bound method> = bound_method %float.loc13, %specific_fn.loc13 [concrete = constants.%bound_method.847]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc13: init %f64.761 = call %bound_method.loc13_37.2(%float.loc13) [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %.loc13_37.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc13 [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %.loc13_37.2: %f64.761 = converted %float.loc13, %.loc13_37.1 [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc13: init %i32 = call %ConvertF64ToI32.ref.loc13(%.loc13_37.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc23: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Negate.ref.loc23: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate]
|
||||
// CHECK:STDOUT: %float.loc23: Core.FloatLiteral = float_literal_value 21474836490e-1 [concrete = constants.%float.449]
|
||||
// CHECK:STDOUT: %impl.elem0.loc23: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc23_45.1: <bound method> = bound_method %float.loc23, %impl.elem0.loc23 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.00d]
|
||||
// CHECK:STDOUT: %specific_fn.loc23: <specific function> = specific_function %impl.elem0.loc23, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc23_45.2: <bound method> = bound_method %float.loc23, %specific_fn.loc23 [concrete = constants.%bound_method.a16]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %f64.761 = call %bound_method.loc23_45.2(%float.loc23) [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %.loc23_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %.loc23_45.2: %f64.761 = converted %float.loc23, %.loc23_45.1 [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %Negate.call.loc23: init %f64.761 = call %Negate.ref.loc23(%.loc23_45.2) [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %.loc23_57.1: %f64.761 = value_of_initializer %Negate.call.loc23 [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %.loc23_57.2: %f64.761 = converted %Negate.call.loc23, %.loc23_57.1 [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc23: init %i32 = call %ConvertF64ToI32.ref.loc23(%.loc23_57.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToU32.ref: %ConvertF64ToU32.type = name_ref ConvertF64ToU32, imports.%Main.ConvertF64ToU32 [concrete = constants.%ConvertF64ToU32]
|
||||
// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate]
|
||||
// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da]
|
||||
// CHECK:STDOUT: %impl.elem0.loc15: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc15_48.1: <bound method> = bound_method %float.loc15, %impl.elem0.loc15 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9]
|
||||
// CHECK:STDOUT: %specific_fn.loc15: <specific function> = specific_function %impl.elem0.loc15, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc15_48.2: <bound method> = bound_method %float.loc15, %specific_fn.loc15 [concrete = constants.%bound_method.04a]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15: init %f64.761 = call %bound_method.loc15_48.2(%float.loc15) [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc15_48.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc15_48.2: %f64.761 = converted %float.loc15, %.loc15_48.1 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %Negate.call.loc15: init %f64.761 = call %Negate.ref.loc15(%.loc15_48.2) [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %.loc15_51.1: %f64.761 = value_of_initializer %Negate.call.loc15 [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %.loc15_51.2: %f64.761 = converted %Negate.call.loc15, %.loc15_51.1 [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %ConvertF64ToU32.call: init %u32 = call %ConvertF64ToU32.ref(%.loc15_51.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc19: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc19: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc19: init %i32 = call %ConvertFloatLiteralToI32.ref.loc19(%float.loc19) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc23: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc23: Core.FloatLiteral = float_literal_value 10e999999 [concrete = constants.%float.53d]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc23: init %i32 = call %ConvertFloatLiteralToI32.ref.loc23(%float.loc23) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc28: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral]
|
||||
// CHECK:STDOUT: %float.loc28: Core.FloatLiteral = float_literal_value 10e9999999 [concrete = constants.%float.ef09]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc28: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc28(%float.loc28) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc33: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc33: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.1]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc33: init %i32 = call %ConvertFloatLiteralToI32.ref.loc33(%float.loc33) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc39: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral]
|
||||
// CHECK:STDOUT: %float.loc39: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc39: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc39(%float.loc39) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc44: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc44: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.1]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc44: init %i32 = call %ConvertFloatLiteralToI32.ref.loc44(%float.loc44) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc49: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc49: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc49: init %i32 = call %ConvertFloatLiteralToI32.ref.loc49(%float.loc49) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc54: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc54: Core.FloatLiteral = float_literal_value 2147483648p0 [concrete = constants.%float.ef03]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc54: init %i32 = call %ConvertFloatLiteralToI32.ref.loc54(%float.loc54) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc59: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc59: Core.FloatLiteral = float_literal_value 10e9 [concrete = constants.%float.9d5]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc59: init %i32 = call %ConvertFloatLiteralToI32.ref.loc59(%float.loc59) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc64: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc64: Core.FloatLiteral = float_literal_value 16p27 [concrete = constants.%float.c0c]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc64: init %i32 = call %ConvertFloatLiteralToI32.ref.loc64(%float.loc64) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc69: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32]
|
||||
// CHECK:STDOUT: %float.loc69: Core.FloatLiteral = float_literal_value 50e8 [concrete = constants.%float.4f4]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc69: init %u32 = call %ConvertFloatLiteralToU32.ref.loc69(%float.loc69) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc74: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32]
|
||||
// CHECK:STDOUT: %float.loc74: Core.FloatLiteral = float_literal_value 16p28 [concrete = constants.%float.97b]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc74: init %u32 = call %ConvertFloatLiteralToU32.ref.loc74(%float.loc74) [concrete = <error>]
|
||||
// CHECK:STDOUT: %Negate.ref.loc33: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate]
|
||||
// CHECK:STDOUT: %float.loc33: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da]
|
||||
// CHECK:STDOUT: %impl.elem0.loc33: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc33_48.1: <bound method> = bound_method %float.loc33, %impl.elem0.loc33 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9]
|
||||
// CHECK:STDOUT: %specific_fn.loc33: <specific function> = specific_function %impl.elem0.loc33, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc33_48.2: <bound method> = bound_method %float.loc33, %specific_fn.loc33 [concrete = constants.%bound_method.04a]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc33: init %f64.761 = call %bound_method.loc33_48.2(%float.loc33) [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc33_48.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc33 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc33_48.2: %f64.761 = converted %float.loc33, %.loc33_48.1 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %Negate.call.loc33: init %f64.761 = call %Negate.ref.loc33(%.loc33_48.2) [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %.loc33_51.1: %f64.761 = value_of_initializer %Negate.call.loc33 [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %.loc33_51.2: %f64.761 = converted %Negate.call.loc33, %.loc33_51.1 [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %ConvertF64ToU32.call: init %u32 = call %ConvertF64ToU32.ref(%.loc33_51.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc43: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc43: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc43: init %i32 = call %ConvertFloatLiteralToI32.ref.loc43(%float.loc43) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc53: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc53: Core.FloatLiteral = float_literal_value 10e999999 [concrete = constants.%float.53d]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc53: init %i32 = call %ConvertFloatLiteralToI32.ref.loc53(%float.loc53) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc67: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral]
|
||||
// CHECK:STDOUT: %float.loc67: Core.FloatLiteral = float_literal_value 10e9999999 [concrete = constants.%float.ef09]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc67: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc67(%float.loc67) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc79: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc79: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.1]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc79: init %i32 = call %ConvertFloatLiteralToI32.ref.loc79(%float.loc79) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc94: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral]
|
||||
// CHECK:STDOUT: %float.loc94: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc94: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc94(%float.loc94) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc106: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc106: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.1]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc106: init %i32 = call %ConvertFloatLiteralToI32.ref.loc106(%float.loc106) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc118: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc118: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc118: init %i32 = call %ConvertFloatLiteralToI32.ref.loc118(%float.loc118) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc130: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc130: Core.FloatLiteral = float_literal_value 2147483648p0 [concrete = constants.%float.ef03]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc130: init %i32 = call %ConvertFloatLiteralToI32.ref.loc130(%float.loc130) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc142: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc142: Core.FloatLiteral = float_literal_value 10e9 [concrete = constants.%float.9d5]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc142: init %i32 = call %ConvertFloatLiteralToI32.ref.loc142(%float.loc142) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc154: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc154: Core.FloatLiteral = float_literal_value 16p27 [concrete = constants.%float.c0c]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc154: init %i32 = call %ConvertFloatLiteralToI32.ref.loc154(%float.loc154) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc166: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32]
|
||||
// CHECK:STDOUT: %float.loc166: Core.FloatLiteral = float_literal_value 50e8 [concrete = constants.%float.4f4]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc166: init %u32 = call %ConvertFloatLiteralToU32.ref.loc166(%float.loc166) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc178: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32]
|
||||
// CHECK:STDOUT: %float.loc178: Core.FloatLiteral = float_literal_value 16p28 [concrete = constants.%float.97b]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc178: init %u32 = call %ConvertFloatLiteralToU32.ref.loc178(%float.loc178) [concrete = <error>]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -534,17 +648,17 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %.loc7_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc7 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc7_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc7, %.loc7_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %nan_val: %i32 = wrapper_binding nan_val, %.loc7_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc12_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc12 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc12_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc12, %.loc12_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc12: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %nan_val: %i32 = wrapper_binding nan_val, %.loc12_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %nan_val.patt: %pattern_type.d94 = value_binding_pattern nan_val [concrete = constants.%nan_val.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc11_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc11 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc11_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc11, %.loc11_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc11: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %inf_val: %i32 = wrapper_binding inf_val, %.loc11_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc21_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc21 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc21_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc21, %.loc21_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %inf_val: %i32 = wrapper_binding inf_val, %.loc21_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %inf_val.patt: %pattern_type.d94 = value_binding_pattern inf_val [concrete = constants.%inf_val.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -552,50 +666,50 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc7: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Div.ref.loc7: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div]
|
||||
// CHECK:STDOUT: %float.loc7_40: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.1]
|
||||
// CHECK:STDOUT: %float.loc7_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.2]
|
||||
// CHECK:STDOUT: %impl.elem0.loc7_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc7_40.1: <bound method> = bound_method %float.loc7_40, %impl.elem0.loc7_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.1]
|
||||
// CHECK:STDOUT: %specific_fn.loc7_40: <specific function> = specific_function %impl.elem0.loc7_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc7_40.2: <bound method> = bound_method %float.loc7_40, %specific_fn.loc7_40 [concrete = constants.%bound_method.49396d.1]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_40: init %f64.761 = call %bound_method.loc7_40.2(%float.loc7_40) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc7_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_40 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc7_40.2: %f64.761 = converted %float.loc7_40, %.loc7_40.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %impl.elem0.loc7_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc7_45.1: <bound method> = bound_method %float.loc7_45, %impl.elem0.loc7_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.2]
|
||||
// CHECK:STDOUT: %specific_fn.loc7_45: <specific function> = specific_function %impl.elem0.loc7_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc7_45.2: <bound method> = bound_method %float.loc7_45, %specific_fn.loc7_45 [concrete = constants.%bound_method.49396d.2]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_45: init %f64.761 = call %bound_method.loc7_45.2(%float.loc7_45) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc7_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_45 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc7_45.2: %f64.761 = converted %float.loc7_45, %.loc7_45.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %Div.call.loc7: init %f64.761 = call %Div.ref.loc7(%.loc7_40.2, %.loc7_45.2) [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %.loc7_48.1: %f64.761 = value_of_initializer %Div.call.loc7 [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %.loc7_48.2: %f64.761 = converted %Div.call.loc7, %.loc7_48.1 [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc7: init %i32 = call %ConvertF64ToI32.ref.loc7(%.loc7_48.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc11: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Div.ref.loc11: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div]
|
||||
// CHECK:STDOUT: %float.loc11_40: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da]
|
||||
// CHECK:STDOUT: %float.loc11_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.3]
|
||||
// CHECK:STDOUT: %impl.elem0.loc11_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc11_40.1: <bound method> = bound_method %float.loc11_40, %impl.elem0.loc11_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9]
|
||||
// CHECK:STDOUT: %specific_fn.loc11_40: <specific function> = specific_function %impl.elem0.loc11_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc11_40.2: <bound method> = bound_method %float.loc11_40, %specific_fn.loc11_40 [concrete = constants.%bound_method.04a]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_40: init %f64.761 = call %bound_method.loc11_40.2(%float.loc11_40) [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc11_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_40 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc11_40.2: %f64.761 = converted %float.loc11_40, %.loc11_40.1 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %impl.elem0.loc11_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc11_45.1: <bound method> = bound_method %float.loc11_45, %impl.elem0.loc11_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.3]
|
||||
// CHECK:STDOUT: %specific_fn.loc11_45: <specific function> = specific_function %impl.elem0.loc11_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc11_45.2: <bound method> = bound_method %float.loc11_45, %specific_fn.loc11_45 [concrete = constants.%bound_method.49396d.3]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_45: init %f64.761 = call %bound_method.loc11_45.2(%float.loc11_45) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc11_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_45 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc11_45.2: %f64.761 = converted %float.loc11_45, %.loc11_45.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %Div.call.loc11: init %f64.761 = call %Div.ref.loc11(%.loc11_40.2, %.loc11_45.2) [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %.loc11_48.1: %f64.761 = value_of_initializer %Div.call.loc11 [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %.loc11_48.2: %f64.761 = converted %Div.call.loc11, %.loc11_48.1 [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc11: init %i32 = call %ConvertF64ToI32.ref.loc11(%.loc11_48.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc12: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Div.ref.loc12: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div]
|
||||
// CHECK:STDOUT: %float.loc12_40: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.1]
|
||||
// CHECK:STDOUT: %float.loc12_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.2]
|
||||
// CHECK:STDOUT: %impl.elem0.loc12_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc12_40.1: <bound method> = bound_method %float.loc12_40, %impl.elem0.loc12_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.1]
|
||||
// CHECK:STDOUT: %specific_fn.loc12_40: <specific function> = specific_function %impl.elem0.loc12_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc12_40.2: <bound method> = bound_method %float.loc12_40, %specific_fn.loc12_40 [concrete = constants.%bound_method.49396d.1]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc12_40: init %f64.761 = call %bound_method.loc12_40.2(%float.loc12_40) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc12_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc12_40 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc12_40.2: %f64.761 = converted %float.loc12_40, %.loc12_40.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %impl.elem0.loc12_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc12_45.1: <bound method> = bound_method %float.loc12_45, %impl.elem0.loc12_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.2]
|
||||
// CHECK:STDOUT: %specific_fn.loc12_45: <specific function> = specific_function %impl.elem0.loc12_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc12_45.2: <bound method> = bound_method %float.loc12_45, %specific_fn.loc12_45 [concrete = constants.%bound_method.49396d.2]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc12_45: init %f64.761 = call %bound_method.loc12_45.2(%float.loc12_45) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc12_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc12_45 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc12_45.2: %f64.761 = converted %float.loc12_45, %.loc12_45.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %Div.call.loc12: init %f64.761 = call %Div.ref.loc12(%.loc12_40.2, %.loc12_45.2) [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %.loc12_48.1: %f64.761 = value_of_initializer %Div.call.loc12 [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %.loc12_48.2: %f64.761 = converted %Div.call.loc12, %.loc12_48.1 [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc12: init %i32 = call %ConvertF64ToI32.ref.loc12(%.loc12_48.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc21: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Div.ref.loc21: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div]
|
||||
// CHECK:STDOUT: %float.loc21_40: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da]
|
||||
// CHECK:STDOUT: %float.loc21_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.3]
|
||||
// CHECK:STDOUT: %impl.elem0.loc21_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc21_40.1: <bound method> = bound_method %float.loc21_40, %impl.elem0.loc21_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9]
|
||||
// CHECK:STDOUT: %specific_fn.loc21_40: <specific function> = specific_function %impl.elem0.loc21_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc21_40.2: <bound method> = bound_method %float.loc21_40, %specific_fn.loc21_40 [concrete = constants.%bound_method.04a]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21_40: init %f64.761 = call %bound_method.loc21_40.2(%float.loc21_40) [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc21_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21_40 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc21_40.2: %f64.761 = converted %float.loc21_40, %.loc21_40.1 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %impl.elem0.loc21_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc21_45.1: <bound method> = bound_method %float.loc21_45, %impl.elem0.loc21_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.3]
|
||||
// CHECK:STDOUT: %specific_fn.loc21_45: <specific function> = specific_function %impl.elem0.loc21_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc21_45.2: <bound method> = bound_method %float.loc21_45, %specific_fn.loc21_45 [concrete = constants.%bound_method.49396d.3]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21_45: init %f64.761 = call %bound_method.loc21_45.2(%float.loc21_45) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc21_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21_45 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc21_45.2: %f64.761 = converted %float.loc21_45, %.loc21_45.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %Div.call.loc21: init %f64.761 = call %Div.ref.loc21(%.loc21_40.2, %.loc21_45.2) [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %.loc21_48.1: %f64.761 = value_of_initializer %Div.call.loc21 [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %.loc21_48.2: %f64.761 = converted %Div.call.loc21, %.loc21_48.1 [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc21: init %i32 = call %ConvertF64ToI32.ref.loc21(%.loc21_48.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
+24
-4
@@ -30,7 +30,12 @@ let c: f64 = Div(0.0, 0.0);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew(a: f64) -> f64 = "float.div";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.div";
|
||||
|
||||
@@ -42,7 +47,12 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div";
|
||||
|
||||
@@ -54,7 +64,12 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn BadReturnType(a: f64, b: f64) -> bool = "float.div";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.div";
|
||||
|
||||
@@ -67,7 +82,12 @@ fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn DivLiteral(a: Literal(), b: Literal()) -> Literal() = "float.div";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn DivLiteral(a: Literal(), b: Literal()) -> Literal() = "float.div";
|
||||
|
||||
|
||||
+18
-3
@@ -24,11 +24,21 @@ fn Call(ref a: f64, b: f64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: f64, b: f64) = "float.div_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: f64, b: f64) = "float.div_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: f64, b: f32) = "float.div_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: f64, b: f32) = "float.div_assign";
|
||||
|
||||
@@ -37,6 +47,11 @@ fn MixedTypes(ref a: f64, b: f32) = "float.div_assign";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign";
|
||||
+12
-2
@@ -32,7 +32,12 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.eq"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
|
||||
|
||||
@@ -40,7 +45,12 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-59: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Eq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.eq";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.eq"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Eq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.eq";
|
||||
|
||||
|
||||
+6
-1
@@ -36,7 +36,12 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-63: error: invalid signature for builtin function "float.less_eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn LessEq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.less_eq";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.less_eq"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn LessEq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.less_eq";
|
||||
|
||||
|
||||
+12
-2
@@ -39,7 +39,12 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+2]]:20-29: error: unsupported floating-point bit width 931 [CompileTimeFloatBitWidth]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid_size.carbon:[[@LINE+7]]:20
|
||||
// CHECK:STDERR: -> │ var invalid_float: Float(931);
|
||||
// CHECK:STDERR: · ━━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: unsupported floating-point bit width 931
|
||||
// CHECK:STDERR: · ┃ [CompileTimeFloatBitWidth]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var invalid_float: Float(931);
|
||||
|
||||
@@ -50,7 +55,12 @@ library "[[@TEST_NAME]]";
|
||||
import library "types";
|
||||
|
||||
var dyn_size: i32 = 64;
|
||||
// CHECK:STDERR: fail_dyn_size.carbon:[[@LINE+2]]:10-24: error: cannot evaluate type expression [TypeExprEvaluationFailure]
|
||||
// CHECK:STDERR: ╭─┤ fail_dyn_size.carbon:[[@LINE+7]]:10
|
||||
// CHECK:STDERR: -> │ var dyn: Float(dyn_size);
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression
|
||||
// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var dyn: Float(dyn_size);
|
||||
|
||||
|
||||
+24
-4
@@ -28,7 +28,12 @@ var x: f64 = Mul(2.0, 0.5);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew(a: f64) -> f64 = "float.mul";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.mul";
|
||||
|
||||
@@ -40,7 +45,12 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
|
||||
|
||||
@@ -52,7 +62,12 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
|
||||
|
||||
@@ -65,7 +80,12 @@ fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MulLiteral(a: Literal(), b: Literal()) -> Literal() = "float.mul";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MulLiteral(a: Literal(), b: Literal()) -> Literal() = "float.mul";
|
||||
|
||||
|
||||
+18
-3
@@ -24,11 +24,21 @@ fn Call(ref a: f64, b: f64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: f64, b: f64) = "float.mul_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: f64, b: f64) = "float.mul_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign";
|
||||
|
||||
@@ -37,6 +47,11 @@ fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.mul_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.mul_assign";
|
||||
+18
-3
@@ -28,7 +28,12 @@ let a: f64 = Negate(1.5);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew() -> f64 = "float.negate";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.negate"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew() -> f64 = "float.negate";
|
||||
|
||||
@@ -40,7 +45,12 @@ fn RuntimeCallIsValidTooFew() -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.negate"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
|
||||
|
||||
@@ -52,7 +62,12 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn BadReturnType(a: f64) -> bool = "float.negate";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.negate"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64) -> bool = "float.negate";
|
||||
|
||||
|
||||
+6
-1
@@ -34,7 +34,12 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "float.neq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.neq"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn WrongResult(a: f64, b: f64) -> f64 = "float.neq";
|
||||
|
||||
|
||||
+18
-3
@@ -28,7 +28,12 @@ var x: f64 = Sub(2.0, 0.5);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew(a: f64) -> f64 = "float.sub";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.sub";
|
||||
|
||||
@@ -40,7 +45,12 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub";
|
||||
|
||||
@@ -52,7 +62,12 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn BadReturnType(a: f64, b: f64) -> bool = "float.sub";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.sub";
|
||||
|
||||
|
||||
+18
-3
@@ -24,11 +24,21 @@ fn Call(ref a: f64, b: f64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: f64, b: f64) = "float.sub_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: f64, b: f64) = "float.sub_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign";
|
||||
|
||||
@@ -37,6 +47,11 @@ fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.sub_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.sub_assign";
|
||||
@@ -42,7 +42,13 @@ library "[[@TEST_NAME]]";
|
||||
fn Add(a: Core.FloatLiteral, b: Core.FloatLiteral) -> Core.FloatLiteral = "float.add";
|
||||
|
||||
fn F(){
|
||||
// CHECK:STDERR: fail_too_large.carbon:[[@LINE+2]]:6-52: error: binary calculation `16*2^1023999999996 + 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_large.carbon:[[@LINE+8]]:6
|
||||
// CHECK:STDERR: -> │ Add(0x1.0p1024000000000, 0.0000000000000000001);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binary calculation `16*2^1023999999996 + 1*10^-19` would exceed
|
||||
// CHECK:STDERR: · ┃ the maximum supported integer width of 8388608
|
||||
// CHECK:STDERR: · ┃ [CompileTimeFloatLiteralBinaryOperationOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Add(0x1.0p1024000000000, 0.0000000000000000001);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,15 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn Sub(a: Core.FloatLiteral, b: Core.FloatLiteral) -> Core.FloatLiteral = "float.sub";
|
||||
|
||||
// CHECK:STDERR: fail_too_large.carbon:[[@LINE+2]]:29-75: error: binary calculation `16*2^1023999999996 - 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_large.carbon:[[@LINE+10]]:29
|
||||
// CHECK:STDERR: -> │ let v1: Core.FloatLiteral = Sub(0x1.0p1024000000000, 0.0000000000000000001);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binary calculation
|
||||
// CHECK:STDERR: · ┃ `16*2^1023999999996 - 1*10^-19` would
|
||||
// CHECK:STDERR: · ┃ exceed the maximum supported integer
|
||||
// CHECK:STDERR: · ┃ width of 8388608
|
||||
// CHECK:STDERR: · ┃ [CompileTimeFloatLiteralBinaryOperationOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let v1: Core.FloatLiteral = Sub(0x1.0p1024000000000, 0.0000000000000000001);
|
||||
|
||||
|
||||
@@ -36,7 +36,13 @@ alias IntLiteral = MakeIntLiteral();
|
||||
|
||||
fn AddIntChar(n: IntLiteral, c: CharLiteral) -> CharLiteral = "int.add_char_literal";
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-54: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let a: CharLiteral = AddIntChar(0x10000000000000, 'a');
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 4503599627370593 is
|
||||
// CHECK:STDERR: · ┃ not a valid Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = AddIntChar(0x10000000000000, 'a');
|
||||
|
||||
@@ -52,15 +58,33 @@ alias IntLiteral = MakeIntLiteral();
|
||||
fn AddIntChar(n: IntLiteral, c: CharLiteral) -> CharLiteral = "int.add_char_literal";
|
||||
fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-48: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let a: CharLiteral = AddIntChar(1, '\u{10FFFF}');
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 1114112 is not a
|
||||
// CHECK:STDERR: · ┃ valid Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = AddIntChar(1, '\u{10FFFF}');
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-46: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let b: CharLiteral = AddIntChar(1, '\u{D7FF}');
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 55296 is not a
|
||||
// CHECK:STDERR: · ┃ valid Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: CharLiteral = AddIntChar(1, '\u{D7FF}');
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-48: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let c: CharLiteral = AddIntChar(Negate(98), 'a');
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: character arithmetic result -1 is not a valid
|
||||
// CHECK:STDERR: · ┃ Unicode code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: CharLiteral = AddIntChar(Negate(98), 'a');
|
||||
|
||||
|
||||
+68
-12
@@ -52,8 +52,17 @@ library "[[@TEST_NAME]]";
|
||||
fn AndLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
|
||||
fn F(a: Core.IntLiteral) -> Core.IntLiteral {
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+3]]:10-21: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-4]]:1-70: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal_runtime.carbon:[[@LINE+12]]:10
|
||||
// CHECK:STDERR: │ fn AndLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "in...
|
||||
// CHECK:STDERR: · ───────────────────────────────────┬──────────────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ return AndLit(5, a);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return AndLit(5, a);
|
||||
}
|
||||
@@ -63,16 +72,36 @@ fn F(a: Core.IntLiteral) -> Core.IntLiteral {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// Heterogeneous "and" is not supported.
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedAnd1(a: i32, b: Core.IntLiteral) -> i32 = "int.and";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedAnd1(a: i32, b: Core.IntLiteral) -> i32 = "int.and";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedAnd2(a: Core.IntLiteral, b: i32) -> i32 = "int.and";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedAnd2(a: Core.IntLiteral, b: i32) -> i32 = "int.and";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedAnd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedAnd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedAnd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedAnd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.and";
|
||||
|
||||
@@ -85,16 +114,43 @@ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
fn Test(n: Core.IntLiteral) {
|
||||
// OK
|
||||
And(1, 1);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: · ─────────────────────────────────┬─────────────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ And(n, 1);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
And(n, 1);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: · ─────────────────────────────────┬─────────────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ And(1, n);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
And(1, n);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: · ─────────────────────────────────┬─────────────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ And(n, n);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
And(n, n);
|
||||
}
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign";
|
||||
|
||||
@@ -34,7 +39,12 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_ptr.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.and_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.and_assign";
|
||||
|
||||
@@ -44,7 +54,12 @@ fn NotRef(a: i32, b: i32) = "int.and_assign";
|
||||
//
|
||||
// library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_ptr.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.and_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.and_assign";
|
||||
|
||||
|
||||
+11
-2
@@ -52,8 +52,17 @@ library "[[@TEST_NAME]]";
|
||||
fn Complement(a: Core.IntLiteral) -> Core.IntLiteral = "int.complement";
|
||||
|
||||
fn F(a: Core.IntLiteral) -> Core.IntLiteral {
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+3]]:10-22: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-4]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal_runtime.carbon:[[@LINE+12]]:10
|
||||
// CHECK:STDERR: │ fn Complement(a: Core.IntLiteral) -> Core.IntLiteral = "int.complement";
|
||||
// CHECK:STDERR: · ───────────────────────────┬──────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ return Complement(a);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return Complement(a);
|
||||
}
|
||||
|
||||
+22
-4
@@ -76,8 +76,15 @@ import library "int_ops";
|
||||
|
||||
fn F() {
|
||||
// Ensure our testing machinery works.
|
||||
// CHECK:STDERR: fail_self_test.carbon:[[@LINE+3]]:3-43: error: cannot convert expression of type `Expect(0)` to `Expect(1)` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_self_test.carbon:[[@LINE+2]]:3-43: note: type `Expect(0)` does not implement interface `Core.As(Expect(1))` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_self_test.carbon:[[@LINE+10]]:3
|
||||
// CHECK:STDERR: -> │ Test(Int32ToInt32(0)) as Expect(1 as i32);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Expect(0)` to `Expect(1)` with
|
||||
// CHECK:STDERR: · │ ┃ `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `Expect(0)` does not implement interface `Core.As(Expect(1))`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Test(Int32ToInt32(0)) as Expect(1 as i32);
|
||||
}
|
||||
@@ -241,8 +248,19 @@ import library "int_ops";
|
||||
|
||||
let not_constant: Core.IntLiteral = 0;
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:33-63: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: int_ops.carbon:16:1-49: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:33
|
||||
// CHECK:STDERR: -> │ let convert_not_constant: i16 = IntLiteralToInt16(not_constant);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to
|
||||
// CHECK:STDERR: · ┃ compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ int_ops.carbon
|
||||
// CHECK:STDERR: │ fn IntLiteralToInt16(a: Core.IntLiteral) -> i16 = "int.convert";
|
||||
// CHECK:STDERR: · ────────────────────────┬────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant: i16 = IntLiteralToInt16(not_constant);
|
||||
|
||||
|
||||
@@ -40,15 +40,33 @@ alias IntLiteral = MakeIntLiteral();
|
||||
|
||||
fn ConvertFromIntLiteral(n: IntLiteral) -> CharLiteral = "int.convert_char_literal";
|
||||
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-46: error: integer value -1 is not a valid Unicode code point [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let a: CharLiteral = ConvertFromIntLiteral(-1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value -1 is not a valid Unicode code
|
||||
// CHECK:STDERR: · ┃ point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = ConvertFromIntLiteral(-1);
|
||||
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-50: error: integer value 55296 is not a valid Unicode code point [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let b: CharLiteral = ConvertFromIntLiteral(0xD800);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value 55296 is not a valid Unicode code
|
||||
// CHECK:STDERR: · ┃ point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: CharLiteral = ConvertFromIntLiteral(0xD800);
|
||||
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-52: error: integer value 1114112 is not a valid Unicode code point [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:22
|
||||
// CHECK:STDERR: -> │ let c: CharLiteral = ConvertFromIntLiteral(0x110000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value 1114112 is not a valid Unicode
|
||||
// CHECK:STDERR: · ┃ code point
|
||||
// CHECK:STDERR: · ┃ [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: CharLiteral = ConvertFromIntLiteral(0x110000);
|
||||
|
||||
|
||||
+97
-15
@@ -130,7 +130,12 @@ library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
let max_plus_one: i32 =
|
||||
// CHECK:STDERR: fail_too_large_u32_for_i32.carbon:[[@LINE+2]]:3-16: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_large_u32_for_i32.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ Uint32ToInt32(
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value 2147483648 too large for type `i32`
|
||||
// CHECK:STDERR: · ┃ [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Uint32ToInt32(
|
||||
AddU32(Int32ToUint32(0x7FFF_FFFF),
|
||||
@@ -141,7 +146,12 @@ let max_plus_one: i32 =
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_large_i32_for_i16.carbon:[[@LINE+2]]:25-44: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_large_i32_for_i16.carbon:[[@LINE+7]]:25
|
||||
// CHECK:STDERR: -> │ let max_plus_one: i16 = Int32ToInt16(0x8000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value 32768 too large for type `i16`
|
||||
// CHECK:STDERR: · ┃ [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let max_plus_one: i16 = Int32ToInt16(0x8000);
|
||||
|
||||
@@ -150,7 +160,12 @@ let max_plus_one: i16 = Int32ToInt16(0x8000);
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_large_i32_for_u16.carbon:[[@LINE+2]]:25-47: error: integer value 65536 too large for type `u16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_large_i32_for_u16.carbon:[[@LINE+7]]:25
|
||||
// CHECK:STDERR: -> │ let max_plus_one: u16 = Int32ToUint16(0x1_0000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value 65536 too large for type `u16`
|
||||
// CHECK:STDERR: · ┃ [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let max_plus_one: u16 = Int32ToUint16(0x1_0000);
|
||||
|
||||
@@ -159,7 +174,12 @@ let max_plus_one: u16 = Int32ToUint16(0x1_0000);
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_large_u32_for_i16.carbon:[[@LINE+2]]:25-60: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_large_u32_for_i16.carbon:[[@LINE+7]]:25
|
||||
// CHECK:STDERR: -> │ let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value 32768 too large for type `i16`
|
||||
// CHECK:STDERR: · ┃ [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000));
|
||||
|
||||
@@ -168,7 +188,12 @@ let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_large_u32_for_u16.carbon:[[@LINE+2]]:25-63: error: integer value 65536 too large for type `u16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_large_u32_for_u16.carbon:[[@LINE+7]]:25
|
||||
// CHECK:STDERR: -> │ let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value 65536 too large for type `u16`
|
||||
// CHECK:STDERR: · ┃ [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000));
|
||||
|
||||
@@ -177,7 +202,13 @@ let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_negative_i32_to_u16.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u16` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: ╭─┤ fail_negative_i32_to_u16.carbon:[[@LINE+8]]:29
|
||||
// CHECK:STDERR: -> │ let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to
|
||||
// CHECK:STDERR: · ┃ unsigned type `u16`
|
||||
// CHECK:STDERR: · ┃ [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1));
|
||||
|
||||
@@ -186,7 +217,13 @@ let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_negative_i32_to_u32.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: ╭─┤ fail_negative_i32_to_u32.carbon:[[@LINE+8]]:29
|
||||
// CHECK:STDERR: -> │ let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to
|
||||
// CHECK:STDERR: · ┃ unsigned type `u32`
|
||||
// CHECK:STDERR: · ┃ [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1));
|
||||
|
||||
@@ -195,7 +232,13 @@ let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_negative_i32_to_u64.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u64` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: ╭─┤ fail_negative_i32_to_u64.carbon:[[@LINE+8]]:29
|
||||
// CHECK:STDERR: -> │ let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to
|
||||
// CHECK:STDERR: · ┃ unsigned type `u64`
|
||||
// CHECK:STDERR: · ┃ [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1));
|
||||
|
||||
@@ -204,7 +247,13 @@ let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_small_i32_for_i16.carbon:[[@LINE+2]]:26-56: error: integer value -32769 too large for type `i16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_small_i32_for_i16.carbon:[[@LINE+8]]:26
|
||||
// CHECK:STDERR: -> │ let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value -32769 too large for type
|
||||
// CHECK:STDERR: · ┃ `i16`
|
||||
// CHECK:STDERR: · ┃ [IntTooLargeForType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001));
|
||||
|
||||
@@ -215,18 +264,51 @@ import library "int_ops";
|
||||
|
||||
let not_constant: i32 = 0;
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:40-65: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: int_ops.carbon:19:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:40
|
||||
// CHECK:STDERR: -> │ let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to
|
||||
// CHECK:STDERR: · ┃ compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ int_ops.carbon
|
||||
// CHECK:STDERR: │ fn Int32ToInt16(a: i32) -> i16 = "int.convert_checked";
|
||||
// CHECK:STDERR: · ────────────────┬───────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant);
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:38-63: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: int_ops.carbon:11:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:38
|
||||
// CHECK:STDERR: -> │ let convert_not_constant_same: i32 = Int32ToInt32(not_constant);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to
|
||||
// CHECK:STDERR: · ┃ compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ int_ops.carbon
|
||||
// CHECK:STDERR: │ fn Int32ToInt32(a: i32) -> i32 = "int.convert_checked";
|
||||
// CHECK:STDERR: · ────────────────┬───────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant_same: i32 = Int32ToInt32(not_constant);
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:39-64: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: int_ops.carbon:27:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:39
|
||||
// CHECK:STDERR: -> │ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to
|
||||
// CHECK:STDERR: · ┃ compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ int_ops.carbon
|
||||
// CHECK:STDERR: │ fn Int32ToInt64(a: i32) -> i64 = "int.convert_checked";
|
||||
// CHECK:STDERR: · ────────────────┬───────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant_widen: i64 = Int32ToInt64(not_constant);
|
||||
|
||||
|
||||
+12
-4
@@ -48,7 +48,15 @@ library "[[@TEST_NAME]]";
|
||||
import library "int_to_float";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:21-354: error: integer value 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 too large for floating-point type `f64` [IntTooLargeForFloatType]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+10]]:21
|
||||
// CHECK:STDERR: -> │ ...t overflow: f64 = ConvertIntLiteralToF64(100000000000000000000000000000000...
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
||||
// CHECK:STDERR: · ┃ error: integer value
|
||||
// CHECK:STDERR: · ┃ 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
// CHECK:STDERR: · ┃ too large for floating-point type `f64`
|
||||
// CHECK:STDERR: · ┃ [IntTooLargeForFloatType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let overflow: f64 = ConvertIntLiteralToF64(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
|
||||
//@dump-sem-ir-end
|
||||
@@ -71,10 +79,10 @@ let overflow: f64 = ConvertIntLiteralToF64(1000000000000000000000000000000000000
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %.loc7_354.1: %f64.761 = value_of_initializer @__global_init.%ConvertIntLiteralToF64.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc7_354.2: %f64.761 = converted @__global_init.%ConvertIntLiteralToF64.call, %.loc7_354.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_354.1: %f64.761 = value_of_initializer @__global_init.%ConvertIntLiteralToF64.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_354.2: %f64.761 = converted @__global_init.%ConvertIntLiteralToF64.call, %.loc15_354.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f64: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
|
||||
// CHECK:STDOUT: %overflow: %f64.761 = wrapper_binding overflow, %.loc7_354.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %overflow: %f64.761 = wrapper_binding overflow, %.loc15_354.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %overflow.patt: %pattern_type.667 = value_binding_pattern overflow [concrete = constants.%overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -36,7 +36,13 @@ library "[[@TEST_NAME]]";
|
||||
import library "int_to_float_checked";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_lossy.carbon:[[@LINE+2]]:18-50: error: integer value 123456789 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat]
|
||||
// CHECK:STDERR: ╭─┤ fail_lossy.carbon:[[@LINE+8]]:18
|
||||
// CHECK:STDERR: -> │ let lossy: f32 = ConvertIntLiteralToF32(123456789);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer value 123456789 cannot be represented
|
||||
// CHECK:STDERR: · ┃ exactly in floating-point type `f32`
|
||||
// CHECK:STDERR: · ┃ [IntLossyConversionToFloat]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let lossy: f32 = ConvertIntLiteralToF32(123456789);
|
||||
//@dump-sem-ir-end
|
||||
@@ -59,10 +65,10 @@ let lossy: f32 = ConvertIntLiteralToF32(123456789);
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %.loc7_50.1: %f32.3bc = value_of_initializer @__global_init.%ConvertIntLiteralToF32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc7_50.2: %f32.3bc = converted @__global_init.%ConvertIntLiteralToF32.call, %.loc7_50.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc13_50.1: %f32.3bc = value_of_initializer @__global_init.%ConvertIntLiteralToF32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc13_50.2: %f32.3bc = converted @__global_init.%ConvertIntLiteralToF32.call, %.loc13_50.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f32: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc]
|
||||
// CHECK:STDOUT: %lossy: %f32.3bc = wrapper_binding lossy, %.loc7_50.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %lossy: %f32.3bc = wrapper_binding lossy, %.loc13_50.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %lossy.patt: %pattern_type.239 = value_binding_pattern lossy [concrete = constants.%lossy.patt]
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+39
-7
@@ -34,7 +34,12 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> bool {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "int.eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.eq"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn WrongResult(a: i32, b: i32) -> i32 = "int.eq";
|
||||
|
||||
@@ -79,16 +84,43 @@ fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq";
|
||||
fn Test(n: Core.IntLiteral) {
|
||||
// OK
|
||||
Eq(1, 1);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-55: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq";
|
||||
// CHECK:STDERR: · ───────────────────────────┬───────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ Eq(n, 1);
|
||||
// CHECK:STDERR: · ━━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Eq(n, 1);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-55: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq";
|
||||
// CHECK:STDERR: · ───────────────────────────┬───────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ Eq(1, n);
|
||||
// CHECK:STDERR: · ━━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Eq(1, n);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-55: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq";
|
||||
// CHECK:STDERR: · ───────────────────────────┬───────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ Eq(n, n);
|
||||
// CHECK:STDERR: · ━━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Eq(n, n);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,28 @@ library "[[@TEST_NAME]]";
|
||||
// Initializing a binding whose type is an invalid integer type must not crash
|
||||
// constant evaluation (#7278). The type is diagnosed; the conversion of the
|
||||
// initializer should then produce an error value, not a CHECK failure.
|
||||
// CHECK:STDERR: fail_width_not_multiple_of_8.carbon:[[@LINE+5]]:10-17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(8388609)` instead [IntWidthNotMultipleOf8]
|
||||
// CHECK:STDERR: ╭─┤ fail_width_not_multiple_of_8.carbon:[[@LINE+23]]:10
|
||||
// CHECK:STDERR: -> │ let bad: i8388609 = 0;
|
||||
// CHECK:STDERR: · ┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple of 8;
|
||||
// CHECK:STDERR: · ┃ use `Core.Int(8388609)` instead
|
||||
// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_width_not_multiple_of_8.carbon:[[@LINE+3]]:10-17: error: binding pattern has incomplete type `i8388609` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9-18: note: integer type width of 8388609 is greater than the maximum supported width of 8388608 [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╭─┤ fail_width_not_multiple_of_8.carbon:[[@LINE+15]]:10
|
||||
// CHECK:STDERR: -> │ let bad: i8388609 = 0;
|
||||
// CHECK:STDERR: · ┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `i8388609` in name
|
||||
// CHECK:STDERR: · ┃ binding declaration
|
||||
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ {{.*}}/prelude/types/int.carbon
|
||||
// CHECK:STDERR: │ adapt MakeInt(N);
|
||||
// CHECK:STDERR: · ┬─────────
|
||||
// CHECK:STDERR: · ╰──┤ integer type width of 8388609 is greater than the maximum supported
|
||||
// CHECK:STDERR: · │ width of 8388608
|
||||
// CHECK:STDERR: · │ [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let bad: i8388609 = 0;
|
||||
|
||||
@@ -28,8 +46,20 @@ let bad: i8388609 = 0;
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_width_too_large.carbon:[[@LINE+3]]:10-18: error: binding pattern has incomplete type `i16777216` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9-18: note: integer type width of 16777216 is greater than the maximum supported width of 8388608 [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╭─┤ fail_width_too_large.carbon:[[@LINE+15]]:10
|
||||
// CHECK:STDERR: -> │ let bad: i16777216 = 0;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `i16777216` in name
|
||||
// CHECK:STDERR: · ┃ binding declaration
|
||||
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ {{.*}}/prelude/types/int.carbon
|
||||
// CHECK:STDERR: │ adapt MakeInt(N);
|
||||
// CHECK:STDERR: · ┬─────────
|
||||
// CHECK:STDERR: · ╰──┤ integer type width of 16777216 is greater than the maximum
|
||||
// CHECK:STDERR: · │ supported width of 8388608
|
||||
// CHECK:STDERR: · │ [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let bad: i16777216 = 0;
|
||||
|
||||
@@ -37,7 +67,19 @@ let bad: i16777216 = 0;
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_width_too_large_core_int.carbon:[[@LINE+3]]:10-26: error: binding pattern has incomplete type `i8388609` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9-18: note: integer type width of 8388609 is greater than the maximum supported width of 8388608 [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╭─┤ fail_width_too_large_core_int.carbon:[[@LINE+15]]:10
|
||||
// CHECK:STDERR: -> │ let bad: Core.Int(8388609) = 0;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `i8388609` in name
|
||||
// CHECK:STDERR: · ┃ binding declaration
|
||||
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ {{.*}}/prelude/types/int.carbon
|
||||
// CHECK:STDERR: │ adapt MakeInt(N);
|
||||
// CHECK:STDERR: · ┬─────────
|
||||
// CHECK:STDERR: · ╰──┤ integer type width of 8388609 is greater than the maximum supported
|
||||
// CHECK:STDERR: · │ width of 8388608
|
||||
// CHECK:STDERR: · │ [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let bad: Core.Int(8388609) = 0;
|
||||
+115
-18
@@ -111,36 +111,81 @@ fn LeftShiftLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.left_shift
|
||||
|
||||
// Shift greater than size is disallowed for sized types.
|
||||
let size_1: i32 = LeftShift(1, 31);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-34: error: shift distance >= type width of 32 in `1 << 32` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:19
|
||||
// CHECK:STDERR: -> │ let size_2: i32 = LeftShift(1, 32);
|
||||
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 << 32`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let size_2: i32 = LeftShift(1, 32);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-34: error: shift distance >= type width of 32 in `1 << 33` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:19
|
||||
// CHECK:STDERR: -> │ let size_3: i32 = LeftShift(1, 33);
|
||||
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 << 33`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let size_3: i32 = LeftShift(1, 33);
|
||||
|
||||
// Overflow is allowed if the shift distance is in bounds.
|
||||
let overflow_1: i32 = LeftShift(1000, 31);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:23-41: error: shift distance >= type width of 32 in `1000 << 32` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:23
|
||||
// CHECK:STDERR: -> │ let overflow_2: i32 = LeftShift(1000, 32);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in
|
||||
// CHECK:STDERR: · ┃ `1000 << 32`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let overflow_2: i32 = LeftShift(1000, 32);
|
||||
|
||||
// Oversize shifts aren't allowed even if there's no overflow.
|
||||
let no_overflow_1: i32 = LeftShift(0, 31);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:26-41: error: shift distance >= type width of 32 in `0 << 32` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:26
|
||||
// CHECK:STDERR: -> │ let no_overflow_2: i32 = LeftShift(0, 32);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in
|
||||
// CHECK:STDERR: · ┃ `0 << 32`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let no_overflow_2: i32 = LeftShift(0, 32);
|
||||
|
||||
// Negative shifts aren't allowed either, even for literals, even if the lhs is zero.
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:21-36: error: shift distance >= type width of 32 in `1 << -1` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:21
|
||||
// CHECK:STDERR: -> │ let negative: i32 = LeftShift(1, -1);
|
||||
// CHECK:STDERR: · ━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 << -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let negative: i32 = LeftShift(1, -1);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:26-41: error: shift distance >= type width of 32 in `0 << -1` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:26
|
||||
// CHECK:STDERR: -> │ let negative_zero: i32 = LeftShift(0, -1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in
|
||||
// CHECK:STDERR: · ┃ `0 << -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let negative_zero: i32 = LeftShift(0, -1);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:37-55: error: shift distance negative in `1 << -1` [CompileTimeShiftNegative]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:37
|
||||
// CHECK:STDERR: -> │ let negative_lit: Core.IntLiteral = LeftShiftLit(1, -1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance negative in
|
||||
// CHECK:STDERR: · ┃ `1 << -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftNegative]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let negative_lit: Core.IntLiteral = LeftShiftLit(1, -1);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:42-60: error: shift distance negative in `0 << -1` [CompileTimeShiftNegative]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:42
|
||||
// CHECK:STDERR: -> │ let negative_lit_zero: Core.IntLiteral = LeftShiftLit(0, -1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance negative in
|
||||
// CHECK:STDERR: · ┃ `0 << -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftNegative]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let negative_lit_zero: Core.IntLiteral = LeftShiftLit(0, -1);
|
||||
|
||||
@@ -150,11 +195,25 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn LeftShift(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift";
|
||||
|
||||
// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+2]]:16-42: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal_overflow.carbon:[[@LINE+9]]:16
|
||||
// CHECK:STDERR: -> │ let bad: i32 = LeftShift(1, 1_000_000_000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance of 1000000000 would result in an
|
||||
// CHECK:STDERR: · ┃ integer whose width is greater than the maximum
|
||||
// CHECK:STDERR: · ┃ supported width of 8388608
|
||||
// CHECK:STDERR: · ┃ [CompileTimeUnsizedShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let bad: i32 = LeftShift(1, 1_000_000_000);
|
||||
|
||||
// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+2]]:25-52: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_literal_overflow.carbon:[[@LINE+9]]:25
|
||||
// CHECK:STDERR: -> │ let bad_negative: i32 = LeftShift(-1, 1_000_000_000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance of 1000000000 would result in
|
||||
// CHECK:STDERR: · ┃ an integer whose width is greater than the
|
||||
// CHECK:STDERR: · ┃ maximum supported width of 8388608
|
||||
// CHECK:STDERR: · ┃ [CompileTimeUnsizedShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let bad_negative: i32 = LeftShift(-1, 1_000_000_000);
|
||||
|
||||
@@ -169,26 +228,64 @@ var a_lit: Core.IntLiteral = 12;
|
||||
var an_i32: i32 = 34;
|
||||
|
||||
// This can't be valid: we don't have a compile-time or runtime integer value for `a_lit`.
|
||||
// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:17-45: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-8]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_comp_time_only_shift.carbon:[[@LINE+12]]:17
|
||||
// CHECK:STDERR: │ fn LeftShiftByLit(a: i32, b: Core.IntLiteral) -> i32 = "int.left_shift";
|
||||
// CHECK:STDERR: · ───────────────────────────┬──────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ let bad1: i32 = LeftShiftByLit(an_i32, a_lit);
|
||||
// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let bad1: i32 = LeftShiftByLit(an_i32, a_lit);
|
||||
|
||||
// TODO: This could be valid because we don't actually need the return value at runtime.
|
||||
// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:29-57: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-13]]:1-66: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_comp_time_only_shift.carbon:[[@LINE+13]]:29
|
||||
// CHECK:STDERR: │ fn LeftShiftOfLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.le...
|
||||
// CHECK:STDERR: · ─────────────────────────────────┬────────────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ let bad2: Core.IntLiteral = LeftShiftOfLit(a_lit, an_i32);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only
|
||||
// CHECK:STDERR: · ┃ function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let bad2: Core.IntLiteral = LeftShiftOfLit(a_lit, an_i32);
|
||||
|
||||
// TODO: This could be valid because the literal argument has a constant value.
|
||||
// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:17-42: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-20]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_comp_time_only_shift.carbon:[[@LINE+12]]:17
|
||||
// CHECK:STDERR: │ fn LeftShiftByLit(a: i32, b: Core.IntLiteral) -> i32 = "int.left_shift";
|
||||
// CHECK:STDERR: · ───────────────────────────┬──────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ let bad3: i32 = LeftShiftByLit(an_i32, 12);
|
||||
// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let bad3: i32 = LeftShiftByLit(an_i32, 12);
|
||||
|
||||
// TODO: This could be valid because we don't actually need the return value at runtime.
|
||||
// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:29-54: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-25]]:1-66: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_comp_time_only_shift.carbon:[[@LINE+13]]:29
|
||||
// CHECK:STDERR: │ fn LeftShiftOfLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.le...
|
||||
// CHECK:STDERR: · ─────────────────────────────────┬────────────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ let bad4: Core.IntLiteral = LeftShiftOfLit(12, an_i32);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only
|
||||
// CHECK:STDERR: · ┃ function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let bad4: Core.IntLiteral = LeftShiftOfLit(12, an_i32);
|
||||
|
||||
|
||||
@@ -34,7 +34,12 @@ fn CallMixed(ref a: i32, b: i64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.left_shift_a...
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.left_shift_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.left_shift_assign";
|
||||
|
||||
@@ -42,7 +47,12 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.left_shift_assign"
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.left_shift_assign";
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.left_shift_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.left_shift_assign";
|
||||
|
||||
|
||||
+33
-6
@@ -79,16 +79,43 @@ fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq";
|
||||
fn Test(n: Core.IntLiteral) {
|
||||
// OK
|
||||
LessEq(1, 1);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-59: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq";
|
||||
// CHECK:STDERR: · ─────────────────────────────┬─────────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ LessEq(n, 1);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
LessEq(n, 1);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-59: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq";
|
||||
// CHECK:STDERR: · ─────────────────────────────┬─────────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ LessEq(1, n);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
LessEq(1, n);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-59: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq";
|
||||
// CHECK:STDERR: · ─────────────────────────────┬─────────────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
|
||||
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ LessEq(n, n);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
|
||||
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
LessEq(n, n);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,12 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+2]]:8-13: error: integer type width of 0 is not positive [IntWidthNotPositive]
|
||||
// CHECK:STDERR: ╭─┤ fail_zero_size.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ var n: Int(0);
|
||||
// CHECK:STDERR: · ━━━┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer type width of 0 is not positive
|
||||
// CHECK:STDERR: · ┃ [IntWidthNotPositive]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var n: Int(0);
|
||||
|
||||
@@ -83,7 +88,12 @@ import library "types";
|
||||
|
||||
fn Negate(a: IntLiteral) -> IntLiteral = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+2]]:8-21: error: integer type width of -1 is not positive [IntWidthNotPositive]
|
||||
// CHECK:STDERR: ╭─┤ fail_negative_size.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ var n: Int(Negate(1));
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer type width of -1 is not positive
|
||||
// CHECK:STDERR: · ┃ [IntWidthNotPositive]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var n: Int(Negate(1));
|
||||
|
||||
@@ -93,7 +103,13 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+2]]:8-22: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╭─┤ fail_oversized.carbon:[[@LINE+8]]:8
|
||||
// CHECK:STDERR: -> │ var m: Int(1000000000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer type width of 1000000000 is greater than the maximum
|
||||
// CHECK:STDERR: · ┃ supported width of 8388608
|
||||
// CHECK:STDERR: · ┃ [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var m: Int(1000000000);
|
||||
|
||||
|
||||
@@ -53,7 +53,12 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+2]]:8-14: error: integer type width of 0 is not positive [IntWidthNotPositive]
|
||||
// CHECK:STDERR: ╭─┤ fail_zero_size.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ var n: UInt(0);
|
||||
// CHECK:STDERR: · ━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer type width of 0 is not positive
|
||||
// CHECK:STDERR: · ┃ [IntWidthNotPositive]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var n: UInt(0);
|
||||
|
||||
@@ -65,7 +70,12 @@ import library "types";
|
||||
|
||||
fn Negate(n: i32) -> i32 = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+2]]:8-22: error: integer type width of -1 is not positive [IntWidthNotPositive]
|
||||
// CHECK:STDERR: ╭─┤ fail_negative_size.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ var n: UInt(Negate(1));
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer type width of -1 is not positive
|
||||
// CHECK:STDERR: · ┃ [IntWidthNotPositive]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var n: UInt(Negate(1));
|
||||
|
||||
@@ -75,7 +85,13 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+2]]:8-23: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╭─┤ fail_oversized.carbon:[[@LINE+8]]:8
|
||||
// CHECK:STDERR: -> │ var m: UInt(1000000000);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer type width of 1000000000 is greater than the maximum
|
||||
// CHECK:STDERR: · ┃ supported width of 8388608
|
||||
// CHECK:STDERR: · ┃ [IntWidthTooLarge]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var m: UInt(1000000000);
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.or_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.or_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.or_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.or_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.or_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.or_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.or_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.or_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.or_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.or_assign";
|
||||
|
||||
|
||||
+39
-6
@@ -99,24 +99,57 @@ fn RightShiftLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.right_shi
|
||||
|
||||
// Shift greater than size is disallowed for sized types.
|
||||
let size_1: i32 = RightShift(1, 31);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-35: error: shift distance >= type width of 32 in `1 >> 32` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:19
|
||||
// CHECK:STDERR: -> │ let size_2: i32 = RightShift(1, 32);
|
||||
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 >> 32`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let size_2: i32 = RightShift(1, 32);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-35: error: shift distance >= type width of 32 in `1 >> 33` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:19
|
||||
// CHECK:STDERR: -> │ let size_3: i32 = RightShift(1, 33);
|
||||
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 >> 33`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let size_3: i32 = RightShift(1, 33);
|
||||
|
||||
// Negative shifts aren't allowed either, even for literals, even if the lhs is zero.
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:21-37: error: shift distance >= type width of 32 in `1 >> -1` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:21
|
||||
// CHECK:STDERR: -> │ let negative: i32 = RightShift(1, -1);
|
||||
// CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 >> -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let negative: i32 = RightShift(1, -1);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:26-42: error: shift distance >= type width of 32 in `0 >> -1` [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:26
|
||||
// CHECK:STDERR: -> │ let negative_zero: i32 = RightShift(0, -1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in
|
||||
// CHECK:STDERR: · ┃ `0 >> -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let negative_zero: i32 = RightShift(0, -1);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:37-56: error: shift distance negative in `1 >> -1` [CompileTimeShiftNegative]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:37
|
||||
// CHECK:STDERR: -> │ let negative_lit: Core.IntLiteral = RightShiftLit(1, -1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance negative in
|
||||
// CHECK:STDERR: · ┃ `1 >> -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftNegative]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let negative_lit: Core.IntLiteral = RightShiftLit(1, -1);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:42-61: error: shift distance negative in `0 >> -1` [CompileTimeShiftNegative]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:42
|
||||
// CHECK:STDERR: -> │ let negative_lit_zero: Core.IntLiteral = RightShiftLit(0, -1);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: shift distance negative in
|
||||
// CHECK:STDERR: · ┃ `0 >> -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeShiftNegative]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let negative_lit_zero: Core.IntLiteral = RightShiftLit(0, -1);
|
||||
|
||||
|
||||
@@ -34,7 +34,12 @@ fn CallMixed(ref a: i32, b: i64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.right_shift_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.right_shift_...
|
||||
// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.right_shift_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.right_shift_assign";
|
||||
|
||||
@@ -42,7 +47,12 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.right_shift_assign
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.right_shift_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.right_shift_assign";
|
||||
// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.right_shift_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.right_shift_assign";
|
||||
|
||||
|
||||
+70
-12
@@ -57,11 +57,20 @@ fn F() {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew(a: i32) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: i32) -> i32 = "int.sadd";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:26-32: error: name `TooMany` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+6]]:26
|
||||
// CHECK:STDERR: -> │ var too_many: array(i32, TooMany(1, 2, 3));
|
||||
// CHECK:STDERR: · ━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `TooMany` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var too_many: array(i32, TooMany(1, 2, 3));
|
||||
|
||||
@@ -73,11 +82,21 @@ fn RuntimeCallIsValidTooFew(a: i32) -> i32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:33-45: error: name `BadReturnType` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:33
|
||||
// CHECK:STDERR: -> │ var bad_return_type: array(i32, BadReturnType(1, 2));
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `BadReturnType` not found
|
||||
// CHECK:STDERR: · ┃ [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var bad_return_type: array(i32, BadReturnType(1, 2));
|
||||
|
||||
@@ -89,11 +108,20 @@ fn RuntimeCallIsValidTooMany(a: i32, b: i32, c: i32) -> i32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:25-30: error: name `TooFew` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+6]]:25
|
||||
// CHECK:STDERR: -> │ var too_few: array(i32, TooFew(1));
|
||||
// CHECK:STDERR: · ━━━┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `TooFew` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var too_few: array(i32, TooFew(1));
|
||||
|
||||
@@ -105,7 +133,12 @@ fn RuntimeCallIsValidBadReturnType(a: i32, b: i32) -> bool {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+2]]:26-34: error: name `JustRight` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_call.carbon:[[@LINE+7]]:26
|
||||
// CHECK:STDERR: -> │ var bad_call: array(i32, JustRight(1, 2, 3));
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `JustRight` not found
|
||||
// CHECK:STDERR: · ┃ [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var bad_call: array(i32, JustRight(1, 2, 3));
|
||||
|
||||
@@ -113,16 +146,36 @@ var bad_call: array(i32, JustRight(1, 2, 3));
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_mixed_add.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedAdd1(a: i32, b: Core.IntLiteral) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedAdd1(a: i32, b: Core.IntLiteral) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_mixed_add.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedAdd2(a: Core.IntLiteral, b: i32) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedAdd2(a: Core.IntLiteral, b: i32) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_mixed_add.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedAdd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.sadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedAdd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.sadd";
|
||||
// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_mixed_add.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedAdd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.sadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedAdd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.sadd";
|
||||
|
||||
@@ -133,7 +186,12 @@ library "[[@TEST_NAME]]";
|
||||
fn Add(a: i32, b: i32) -> i32 = "int.sadd";
|
||||
|
||||
let a: i32 = Add(0x7FFFFFFF, 0);
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-31: error: integer overflow in calculation `2147483647 + 1` [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14
|
||||
// CHECK:STDERR: -> │ let b: i32 = Add(0x7FFFFFFF, 1);
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `2147483647 + 1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: i32 = Add(0x7FFFFFFF, 1);
|
||||
|
||||
|
||||
+18
-3
@@ -24,7 +24,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sadd_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sadd_assign";
|
||||
|
||||
@@ -32,10 +37,20 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sadd_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.sadd_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.sadd_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.sadd_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.sadd_assign";
|
||||
+28
-5
@@ -40,7 +40,12 @@ let a: i32 = Div(-0x7FFF_FFFF, -1);
|
||||
let b: i32 = Div(-0x8000_0000, 1);
|
||||
|
||||
// -0x8000_0000 / -1 overflows.
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-34: error: integer overflow in calculation `-2147483648 / -1` [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14
|
||||
// CHECK:STDERR: -> │ let c: i32 = Div(-0x8000_0000, -1);
|
||||
// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `-2147483648 / -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: i32 = Div(-0x8000_0000, -1);
|
||||
|
||||
@@ -65,20 +70,38 @@ library "[[@TEST_NAME]]";
|
||||
fn Div(a: i32, b: i32) -> i32 = "int.sdiv";
|
||||
fn DivLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.sdiv";
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14
|
||||
// CHECK:STDERR: -> │ let a: i32 = Div(1, 0);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: i32 = Div(1, 0);
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14
|
||||
// CHECK:STDERR: -> │ let b: i32 = Div(0, 0);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: i32 = Div(0, 0);
|
||||
|
||||
// IntLiteral allows "overflow" by widening its representation, but not overflow to infinity.
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:26-37: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+7]]:26
|
||||
// CHECK:STDERR: -> │ let c: Core.IntLiteral = DivLit(1, 0);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero
|
||||
// CHECK:STDERR: · ┃ [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: Core.IntLiteral = DivLit(1, 0);
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:26-37: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+7]]:26
|
||||
// CHECK:STDERR: -> │ let d: Core.IntLiteral = DivLit(0, 0);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero
|
||||
// CHECK:STDERR: · ┃ [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let d: Core.IntLiteral = DivLit(0, 0);
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sdiv_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sdiv_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sdiv_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sdiv_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.sdiv_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sdiv_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.sdiv_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.sdiv_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sdiv_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.sdiv_assign";
|
||||
|
||||
|
||||
+16
-3
@@ -41,7 +41,12 @@ let b: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), 1);
|
||||
|
||||
// -0x8000_0000 / -1 overflows, so -0x8000_0000 % -1 is disallowed, even though
|
||||
// its result is representable.
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-56: error: integer overflow in calculation `-2147483648 % -1` [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14
|
||||
// CHECK:STDERR: -> │ let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1));
|
||||
// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `-2147483648 % -1`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1));
|
||||
|
||||
@@ -53,11 +58,19 @@ fn Mod(a: i32, b: i32) -> i32 = "int.smod";
|
||||
|
||||
// Remainder of division by zero is not defined.
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14
|
||||
// CHECK:STDERR: -> │ let a: i32 = Mod(1, 0);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: i32 = Mod(1, 0);
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14
|
||||
// CHECK:STDERR: -> │ let b: i32 = Mod(0, 0);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: i32 = Mod(0, 0);
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smod_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smod_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smod_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smod_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.smod_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smod_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.smod_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.smod_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smod_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.smod_assign";
|
||||
|
||||
|
||||
+6
-1
@@ -68,7 +68,12 @@ library "[[@TEST_NAME]]";
|
||||
fn Mul(a: i32, b: i32) -> i32 = "int.smul";
|
||||
|
||||
let a: i32 = Mul(0x7FFF, 0x10000);
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-33: error: integer overflow in calculation `32768 * 65536` [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14
|
||||
// CHECK:STDERR: -> │ let b: i32 = Mul(0x8000, 0x10000);
|
||||
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `32768 * 65536`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: i32 = Mul(0x8000, 0x10000);
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smul_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smul_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smul_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smul_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.smul_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smul_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.smul_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.smul_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smul_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.smul_assign";
|
||||
|
||||
|
||||
+53
-9
@@ -47,11 +47,21 @@ fn F() {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew() -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.snegate"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew() -> i32 = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:25-32: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:25
|
||||
// CHECK:STDERR: -> │ var too_few: array(i32, TooFew());
|
||||
// CHECK:STDERR: · ━━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
|
||||
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var too_few: array(i32, TooFew());
|
||||
|
||||
@@ -63,11 +73,21 @@ fn RuntimeCallIsValidTooFew() -> i32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: i32, b: i32) -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.snegate"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: i32, b: i32) -> i32 = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:26-38: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:26
|
||||
// CHECK:STDERR: -> │ var too_many: array(i32, TooMany(1, 2));
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
|
||||
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var too_many: array(i32, TooMany(1, 2));
|
||||
|
||||
@@ -79,11 +99,21 @@ fn RuntimeCallIsValidTooMany(a: i32, b: i32) -> i32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn BadReturnType(a: i32) -> bool = "int.snegate";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.snegate"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: i32) -> bool = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:33-48: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:33
|
||||
// CHECK:STDERR: -> │ var bad_return_type: array(i32, BadReturnType(1));
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
|
||||
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var bad_return_type: array(i32, BadReturnType(1));
|
||||
|
||||
@@ -97,8 +127,17 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn Negate(a: i32) -> i32 = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+3]]:26-37: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch]
|
||||
// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-3]]:1-26: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_call.carbon:[[@LINE+12]]:26
|
||||
// CHECK:STDERR: │ fn Negate(a: i32) -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var bad_call: array(i32, Negate(1, 2));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: 2 arguments passed to function expecting 1
|
||||
// CHECK:STDERR: · ┃ argument
|
||||
// CHECK:STDERR: · ┃ [CallArgCountMismatch]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var bad_call: array(i32, Negate(1, 2));
|
||||
|
||||
@@ -113,7 +152,12 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub";
|
||||
let a: i32 = Negate(Negate(0x7FFF_FFFF));
|
||||
|
||||
// -INT_MIN is too large for i32.
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-33: error: integer overflow in negation of -2147483648 [CompileTimeIntegerNegateOverflow]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14
|
||||
// CHECK:STDERR: -> │ let b: i32 = Negate(-0x8000_0000);
|
||||
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer overflow in negation of -2147483648
|
||||
// CHECK:STDERR: · ┃ [CompileTimeIntegerNegateOverflow]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: i32 = Negate(-0x8000_0000);
|
||||
|
||||
|
||||
+6
-1
@@ -33,7 +33,12 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub";
|
||||
|
||||
let a: i32 = Sub(0, 0x7FFFFFFF);
|
||||
let b: i32 = Sub(Sub(0, 0x7FFFFFFF), 1);
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-39: error: integer overflow in calculation `-2147483647 - 2` [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14
|
||||
// CHECK:STDERR: -> │ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `-2147483647 - 2`
|
||||
// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2);
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.ssub_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.ssub_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.ssub_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.ssub_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.ssub_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.ssub_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.ssub_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.ssub_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.ssub_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.ssub_assign";
|
||||
|
||||
|
||||
+47
-8
@@ -29,11 +29,21 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> i32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew(a: i32) -> i32 = "int.uadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: i32) -> i32 = "int.uadd";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:25-33: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:25
|
||||
// CHECK:STDERR: -> │ var too_few: array(i32, TooFew(1));
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
|
||||
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var too_few: array(i32, TooFew(1));
|
||||
|
||||
@@ -45,11 +55,21 @@ fn RuntimeCallIsValidTooFew(a: i32) -> i32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:26-41: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:26
|
||||
// CHECK:STDERR: -> │ var too_many: array(i32, TooMany(1, 2, 3));
|
||||
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
|
||||
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var too_many: array(i32, TooMany(1, 2, 3));
|
||||
|
||||
@@ -61,11 +81,21 @@ fn RuntimeCallIsValidTooMany(a: i32, b: i32, c: i32) -> i32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:33-51: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:33
|
||||
// CHECK:STDERR: -> │ var bad_return_type: array(i32, BadReturnType(1, 2));
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
|
||||
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var bad_return_type: array(i32, BadReturnType(1, 2));
|
||||
|
||||
@@ -79,8 +109,17 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn Add(a: i32, b: i32) -> i32 = "int.uadd";
|
||||
|
||||
// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+3]]:26-37: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-3]]:1-31: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_call.carbon:[[@LINE+12]]:26
|
||||
// CHECK:STDERR: │ fn Add(a: i32, b: i32) -> i32 = "int.uadd";
|
||||
// CHECK:STDERR: · ───────────────┬───────────────
|
||||
// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var bad_call: array(i32, Add(1, 2, 3));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: 3 arguments passed to function expecting 2
|
||||
// CHECK:STDERR: · ┃ arguments
|
||||
// CHECK:STDERR: · ┃ [CallArgCountMismatch]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var bad_call: array(i32, Add(1, 2, 3));
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.uadd_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.uadd_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.uadd_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.uadd_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.uadd_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.uadd_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.uadd_assign";
|
||||
|
||||
|
||||
+10
-2
@@ -48,11 +48,19 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn Div(a: i32, b: i32) -> i32 = "int.udiv";
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14
|
||||
// CHECK:STDERR: -> │ let a: i32 = Div(1, 0);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: i32 = Div(1, 0);
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14
|
||||
// CHECK:STDERR: -> │ let b: i32 = Div(0, 0);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: i32 = Div(0, 0);
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.udiv_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.udiv_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.udiv_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.udiv_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.udiv_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.udiv_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.udiv_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.udiv_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.udiv_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.udiv_assign";
|
||||
|
||||
|
||||
+10
-2
@@ -50,11 +50,19 @@ fn Mod(a: i32, b: i32) -> i32 = "int.umod";
|
||||
|
||||
// Remainder of division by zero is not defined.
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14
|
||||
// CHECK:STDERR: -> │ let a: i32 = Mod(1, 0);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let a: i32 = Mod(1, 0);
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14
|
||||
// CHECK:STDERR: -> │ let b: i32 = Mod(0, 0);
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let b: i32 = Mod(0, 0);
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umod_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umod_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umod_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umod_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.umod_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umod_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.umod_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.umod_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umod_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.umod_assign";
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umul_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umul_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umul_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umul_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.umul_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umul_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.umul_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.umul_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umul_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.umul_assign";
|
||||
|
||||
|
||||
+47
-8
@@ -31,11 +31,21 @@ fn RuntimeCallIsValid(a: u32, unused b: u32) -> u32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew() -> u32 = "int.unegate";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.unegate"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew() -> u32 = "int.unegate";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:25-32: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:25
|
||||
// CHECK:STDERR: -> │ var too_few: array(u32, TooFew());
|
||||
// CHECK:STDERR: · ━━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
|
||||
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var too_few: array(u32, TooFew());
|
||||
|
||||
@@ -47,11 +57,21 @@ fn RuntimeCallIsValidTooFew() -> u32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: u32, b: u32) -> u32 = "int.unegate";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.unegate"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: u32, b: u32) -> u32 = "int.unegate";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:26-38: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:26
|
||||
// CHECK:STDERR: -> │ var too_many: array(u32, TooMany(1, 2));
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
|
||||
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var too_many: array(u32, TooMany(1, 2));
|
||||
|
||||
@@ -63,11 +83,21 @@ fn RuntimeCallIsValidTooMany(a: u32, b: u32) -> u32 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn BadReturnType(a: u32) -> bool = "int.unegate";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.unegate"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: u32) -> bool = "int.unegate";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:33-48: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:33
|
||||
// CHECK:STDERR: -> │ var bad_return_type: array(u32, BadReturnType(1));
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
|
||||
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var bad_return_type: array(u32, BadReturnType(1));
|
||||
|
||||
@@ -81,8 +111,17 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn Negate(a: u32) -> u32 = "int.unegate";
|
||||
|
||||
// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+3]]:26-37: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch]
|
||||
// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-3]]:1-26: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_call.carbon:[[@LINE+12]]:26
|
||||
// CHECK:STDERR: │ fn Negate(a: u32) -> u32 = "int.unegate";
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var bad_call: array(u32, Negate(1, 2));
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: 2 arguments passed to function expecting 1
|
||||
// CHECK:STDERR: · ┃ argument
|
||||
// CHECK:STDERR: · ┃ [CallArgCountMismatch]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var bad_call: array(u32, Negate(1, 2));
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.usub_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.usub_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.usub_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.usub_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.usub_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.usub_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.usub_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.usub_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.usub_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.usub_assign";
|
||||
|
||||
|
||||
+18
-3
@@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.xor_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.xor_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.xor_assign";
|
||||
|
||||
@@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.xor_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.xor_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.xor_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.xor_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.xor_assign";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.xor_assign"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.xor_assign";
|
||||
|
||||
|
||||
@@ -41,11 +41,21 @@ let u: type = Make(t);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-22: error: invalid signature for builtin function "maybe_unformed.make_type" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NoParam() -> type = "maybe_unformed.make_type";
|
||||
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "maybe_unformed.make_type"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NoParam() -> type = "maybe_unformed.make_type";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-44: error: invalid signature for builtin function "maybe_unformed.make_type" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn ColonBangParam(generic T: type) -> type = "maybe_unformed.make_type";
|
||||
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "maybe_unformed.make_type"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn ColonBangParam(generic T: type) -> type = "maybe_unformed.make_type";
|
||||
|
||||
|
||||
+6
-1
@@ -60,7 +60,12 @@ var x: () = NoOp();
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_signature.carbon:[[@LINE+2]]:1-17: error: invalid signature for builtin function "no_op" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_signature.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NoOp() -> {} = "no_op";
|
||||
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "no_op"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NoOp() -> {} = "no_op";
|
||||
|
||||
|
||||
+30
-5
@@ -55,23 +55,48 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn MakeUnformed(t: type) -> type = "maybe_unformed.make_type";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-22: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NoParam() -> bool = "pointer.is_null";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NoParam() -> bool = "pointer.is_null";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-36: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NoRetType(p: MakeUnformed({}*)) = "pointer.is_null";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NoRetType(p: MakeUnformed({}*)) = "pointer.is_null";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-45: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn WrongRetType(p: MakeUnformed({}*)) -> {} = "pointer.is_null";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn WrongRetType(p: MakeUnformed({}*)) -> {} = "pointer.is_null";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-31: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NoUnformed(p: {}*) -> bool = "pointer.is_null";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NoUnformed(p: {}*) -> bool = "pointer.is_null";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-44: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotPointer(p: MakeUnformed({})) -> bool = "pointer.is_null";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotPointer(p: MakeUnformed({})) -> bool = "pointer.is_null";
|
||||
|
||||
|
||||
+18
-3
@@ -45,15 +45,30 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn MakeUnformed(t: type) -> type = "maybe_unformed.make_type";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-16: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NoRetType() = "pointer.make_null";
|
||||
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.make_null"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NoRetType() = "pointer.make_null";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-24: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NoUnformed() -> {}* = "pointer.make_null";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.make_null"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NoUnformed() -> {}* = "pointer.make_null";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-37: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn NotPointer() -> MakeUnformed({}) = "pointer.make_null";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.make_null"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn NotPointer() -> MakeUnformed({}) = "pointer.make_null";
|
||||
|
||||
|
||||
+52
-9
@@ -50,12 +50,30 @@ class JustJ {
|
||||
}
|
||||
|
||||
fn Call() {
|
||||
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+3]]:3-15: error: cannot convert type `JustI` into type implementing `I & J` [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-12]]:26-41: note: initializing generic parameter `T` declared here [InitializingGenericParam]
|
||||
// CHECK:STDERR: ╭─┤ fail_combine_facets_bad_call.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn TakeIJ(unused generic T: TypeAnd(I, J)) {}
|
||||
// CHECK:STDERR: · ──┬─────────────
|
||||
// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here
|
||||
// CHECK:STDERR: · │ [InitializingGenericParam]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ TakeIJ(JustI);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `JustI` into type implementing `I & J`
|
||||
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
TakeIJ(JustI);
|
||||
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+3]]:3-15: error: cannot convert type `JustJ` into type implementing `I & J` [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-16]]:26-41: note: initializing generic parameter `T` declared here [InitializingGenericParam]
|
||||
// CHECK:STDERR: ╭─┤ fail_combine_facets_bad_call.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ fn TakeIJ(unused generic T: TypeAnd(I, J)) {}
|
||||
// CHECK:STDERR: · ──┬─────────────
|
||||
// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here
|
||||
// CHECK:STDERR: · │ [InitializingGenericParam]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ TakeIJ(JustJ);
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `JustJ` into type implementing `I & J`
|
||||
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
TakeIJ(JustJ);
|
||||
}
|
||||
@@ -64,22 +82,47 @@ fn Call() {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-28: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooFew(a: type) -> type = "type.and";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: type) -> type = "type.and";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-47: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn TooMany(a: type, b: type, c: type) -> type = "type.and";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: type, b: type, c: type) -> type = "type.and";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn ParamNotType(a: {}, b: {}) -> type = "type.and";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn ParamNotType(a: {}, b: {}) -> type = "type.and";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn ResultNotType(a: type, b: type) -> {} = "type.and";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn ResultNotType(a: type, b: type) -> {} = "type.and";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-41: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1
|
||||
// CHECK:STDERR: -> │ fn ResultNotSpecified(a: type, b: type) = "type.and";
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and"
|
||||
// CHECK:STDERR: · ┃ [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn ResultNotSpecified(a: type, b: type) = "type.and";
|
||||
+7
-1
@@ -66,7 +66,13 @@ library "[[@TEST_NAME]]";
|
||||
choice Never {}
|
||||
|
||||
// TODO: Can we produce a better diagnostic?
|
||||
// CHECK:STDERR: fail_no_alternative_construct.carbon:[[@LINE+2]]:20-21: error: missing value for field `discriminant` in struct initialization [StructInitMissingFieldInLiteral]
|
||||
// CHECK:STDERR: ╭─┤ fail_no_alternative_construct.carbon:[[@LINE+8]]:20
|
||||
// CHECK:STDERR: -> │ let never: Never = {};
|
||||
// CHECK:STDERR: · ┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: missing value for field `discriminant` in struct
|
||||
// CHECK:STDERR: · ┃ initialization
|
||||
// CHECK:STDERR: · ┃ [StructInitMissingFieldInLiteral]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let never: Never = {};
|
||||
|
||||
|
||||
+28
-4
@@ -14,7 +14,13 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
choice Always {
|
||||
// CHECK:STDERR: fail_todo_empty_params.carbon:[[@LINE+2]]:8-9: error: semantics TODO: `empty parameter list should make a member function` [SemanticsTodo]
|
||||
// CHECK:STDERR: ╭─┤ fail_todo_empty_params.carbon:[[@LINE+8]]:8
|
||||
// CHECK:STDERR: -> │ Sunny()
|
||||
// CHECK:STDERR: · ┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
|
||||
// CHECK:STDERR: · ┃ `empty parameter list should make a member function`
|
||||
// CHECK:STDERR: · ┃ [SemanticsTodo]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Sunny()
|
||||
}
|
||||
@@ -26,7 +32,13 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
choice C {
|
||||
Alt1,
|
||||
// CHECK:STDERR: fail_todo_params.carbon:[[@LINE+2]]:7-22: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
|
||||
// CHECK:STDERR: ╭─┤ fail_todo_params.carbon:[[@LINE+8]]:7
|
||||
// CHECK:STDERR: -> │ Alt2(a: i32, b: i64),
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
|
||||
// CHECK:STDERR: · ┃ `choice alternatives with parameters are not yet supported`
|
||||
// CHECK:STDERR: · ┃ [SemanticsTodo]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Alt2(a: i32, b: i64),
|
||||
Alt3,
|
||||
@@ -36,7 +48,13 @@ choice C {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
choice C(T: type) {
|
||||
// CHECK:STDERR: fail_todo_generic_params.carbon:[[@LINE+2]]:6-11: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
|
||||
// CHECK:STDERR: ╭─┤ fail_todo_generic_params.carbon:[[@LINE+8]]:6
|
||||
// CHECK:STDERR: -> │ Alt(a: T)
|
||||
// CHECK:STDERR: · ┳━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
|
||||
// CHECK:STDERR: · ┃ `choice alternatives with parameters are not yet supported`
|
||||
// CHECK:STDERR: · ┃ [SemanticsTodo]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Alt(a: T)
|
||||
}
|
||||
@@ -45,7 +63,13 @@ choice C(T: type) {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
choice C {
|
||||
// CHECK:STDERR: fail_todo_self_param.carbon:[[@LINE+2]]:6-15: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
|
||||
// CHECK:STDERR: ╭─┤ fail_todo_self_param.carbon:[[@LINE+8]]:6
|
||||
// CHECK:STDERR: -> │ Alt(a: Self*)
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
|
||||
// CHECK:STDERR: · ┃ `choice alternatives with parameters are not yet supported`
|
||||
// CHECK:STDERR: · ┃ [SemanticsTodo]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Alt(a: Self*)
|
||||
}
|
||||
+137
-49
@@ -19,8 +19,17 @@ abstract class Abstract {
|
||||
}
|
||||
|
||||
class Contains {
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-17: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-5]]:1-25: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_field.carbon:[[@LINE+12]]:10
|
||||
// CHECK:STDERR: │ abstract class Abstract {
|
||||
// CHECK:STDERR: · ────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var a: Abstract;
|
||||
// CHECK:STDERR: · ┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `Abstract` in `var`
|
||||
// CHECK:STDERR: · ┃ pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: Abstract;
|
||||
}
|
||||
@@ -32,8 +41,17 @@ abstract class Abstract {
|
||||
}
|
||||
|
||||
fn Var() {
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:17-24: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-5]]:1-25: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_var.carbon:[[@LINE+12]]:17
|
||||
// CHECK:STDERR: │ abstract class Abstract {
|
||||
// CHECK:STDERR: · ────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var unused v: Abstract;
|
||||
// CHECK:STDERR: · ┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `Abstract` in
|
||||
// CHECK:STDERR: · ┃ `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused v: Abstract;
|
||||
}
|
||||
@@ -44,8 +62,17 @@ library "[[@TEST_NAME]]";
|
||||
abstract class Abstract {
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_abstract_var_function_param.carbon:[[@LINE+3]]:13-20: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_var_function_param.carbon:[[@LINE-4]]:1-25: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_var_function_param.carbon:[[@LINE+12]]:13
|
||||
// CHECK:STDERR: │ abstract class Abstract {
|
||||
// CHECK:STDERR: · ────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ fn F(var _: Abstract) {
|
||||
// CHECK:STDERR: · ┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `Abstract` in `var`
|
||||
// CHECK:STDERR: · ┃ pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn F(var _: Abstract) {
|
||||
}
|
||||
@@ -68,8 +95,16 @@ abstract class Abstract {
|
||||
|
||||
class Adapter {
|
||||
// TODO(#4387): This should probably be valid
|
||||
// CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE+3]]:3-17: error: adapted type `Abstract` is an abstract type [AbstractTypeInAdaptDecl]
|
||||
// CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE-6]]:1-25: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_adapter.carbon:[[@LINE+11]]:3
|
||||
// CHECK:STDERR: │ abstract class Abstract {
|
||||
// CHECK:STDERR: · ────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ adapt Abstract;
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: adapted type `Abstract` is an abstract type
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInAdaptDecl]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
adapt Abstract;
|
||||
}
|
||||
@@ -114,8 +149,16 @@ class Derived {
|
||||
var d: {};
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE+3]]:24-34: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE-10]]:1-25: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_return_abstract.carbon:[[@LINE+11]]:24
|
||||
// CHECK:STDERR: │ abstract class Abstract {
|
||||
// CHECK:STDERR: · ────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ fn Return(a: Abstract) -> Abstract {
|
||||
// CHECK:STDERR: · ━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: function returns abstract type `Abstract`
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn Return(a: Abstract) -> Abstract {
|
||||
return a;
|
||||
@@ -149,10 +192,27 @@ abstract class Abstract {
|
||||
}
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+5]]:28-29: error: initialization of abstract class `Abstract` [AbstractTypeInInit]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+22]]:28
|
||||
// CHECK:STDERR: -> │ let unused l: Abstract = {};
|
||||
// CHECK:STDERR: · ┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: initialization of abstract class
|
||||
// CHECK:STDERR: · ┃ `Abstract`
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInInit]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+3]]:28-29: error: cannot convert type `Abstract` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: {{.*}}/prelude/destroy.carbon:36:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+14]]:28
|
||||
// CHECK:STDERR: -> │ let unused l: Abstract = {};
|
||||
// CHECK:STDERR: · ┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Abstract` into type
|
||||
// CHECK:STDERR: · ┃ implementing `Core.Destroy`
|
||||
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ {{.*}}/prelude/destroy.carbon
|
||||
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
|
||||
// CHECK:STDERR: · ───────────────────┬───────────────────
|
||||
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
|
||||
// CHECK:STDERR: · │ [DeductionGenericHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused l: Abstract = {};
|
||||
}
|
||||
@@ -170,8 +230,19 @@ class Derived {
|
||||
fn F() {
|
||||
// TODO: support destroying classes that derive from abstract types.
|
||||
//
|
||||
// CHECK:STDERR: fail_todo_abstract_let_temporary.carbon:[[@LINE+3]]:28-50: error: cannot convert type `Derived` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: {{.*}}/prelude/destroy.carbon:36:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_todo_abstract_let_temporary.carbon:[[@LINE+14]]:28
|
||||
// CHECK:STDERR: -> │ let unused l: Abstract = {.base = {}} as Derived;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Derived` into type
|
||||
// CHECK:STDERR: · ┃ implementing `Core.Destroy`
|
||||
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: ├─┤ {{.*}}/prelude/destroy.carbon
|
||||
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
|
||||
// CHECK:STDERR: · ───────────────────┬───────────────────
|
||||
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
|
||||
// CHECK:STDERR: · │ [DeductionGenericHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused l: Abstract = {.base = {}} as Derived;
|
||||
}
|
||||
@@ -185,9 +256,21 @@ abstract class Abstract {
|
||||
fn ReturnAbstract() -> Abstract;
|
||||
|
||||
fn CallReturnAbstract() {
|
||||
// CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE+4]]:3-18: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-7]]:1-25: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-5]]:21-31: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_call_abstract_return.carbon:[[@LINE+16]]:3
|
||||
// CHECK:STDERR: │ abstract class Abstract {
|
||||
// CHECK:STDERR: · ────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: │ fn ReturnAbstract() -> Abstract;
|
||||
// CHECK:STDERR: · ─────┬─────
|
||||
// CHECK:STDERR: · ╰──┤ return type declared here
|
||||
// CHECK:STDERR: · │ [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ ReturnAbstract();
|
||||
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: function returns abstract type `Abstract`
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
ReturnAbstract();
|
||||
}
|
||||
@@ -199,8 +282,13 @@ abstract class Abstract {
|
||||
}
|
||||
|
||||
fn Assign(ref a: Abstract) {
|
||||
// CHECK:STDERR: fail_assign_to_abstract_ref.carbon:[[@LINE+3]]:7: error: cannot copy value of type `Abstract` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_assign_to_abstract_ref.carbon:[[@LINE+2]]:7: note: type `Abstract` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_assign_to_abstract_ref.carbon:[[@LINE+8]]:7
|
||||
// CHECK:STDERR: -> │ a = a;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `Abstract` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰────┤ type `Abstract` does not implement interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
a = a;
|
||||
}
|
||||
@@ -677,12 +765,12 @@ fn Assign(ref a: Abstract) {
|
||||
// CHECK:STDOUT: %a.param_patt: %pattern_type.169 = value_param_pattern [concrete = constants.%a.param_patt]
|
||||
// CHECK:STDOUT: %a.patt: %pattern_type.169 = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.169 = out_param_pattern [concrete = constants.%return.param_patt]
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.169 = return_slot_pattern %return.param_patt, %Abstract.ref.loc15_27 [concrete = constants.%return.patt]
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.169 = return_slot_pattern %return.param_patt, %Abstract.ref.loc23_27 [concrete = constants.%return.patt]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %Abstract.ref.loc15_27: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract]
|
||||
// CHECK:STDOUT: %.loc15: Core.Form = init_form %Abstract.ref.loc15_27 [concrete = constants.%.749]
|
||||
// CHECK:STDOUT: %Abstract.ref.loc23_27: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract]
|
||||
// CHECK:STDOUT: %.loc23: Core.Form = init_form %Abstract.ref.loc23_27 [concrete = constants.%.749]
|
||||
// CHECK:STDOUT: %a.param: %Abstract = value_param call_param0
|
||||
// CHECK:STDOUT: %Abstract.ref.loc15_14: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract]
|
||||
// CHECK:STDOUT: %Abstract.ref.loc23_14: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract]
|
||||
// CHECK:STDOUT: %a: %Abstract = wrapper_binding a, %a.param
|
||||
// CHECK:STDOUT: %return.param: ref %Abstract = out_param call_param1
|
||||
// CHECK:STDOUT: %return: ref %Abstract = return_slot %return.param
|
||||
@@ -906,14 +994,14 @@ fn Assign(ref a: Abstract) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc12_29.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc12_29.2: ref %Abstract = temporary_storage
|
||||
// CHECK:STDOUT: %.loc12_29.3: init %Abstract to %.loc12_29.2 = class_init () [concrete = constants.%Abstract.val]
|
||||
// CHECK:STDOUT: %.loc12_29.4: init %Abstract = converted %.loc12_29.1, %.loc12_29.3 [concrete = constants.%Abstract.val]
|
||||
// CHECK:STDOUT: %.loc12_29.5: ref %Abstract = temporary %.loc12_29.2, %.loc12_29.4 [concrete = constants.%.69a]
|
||||
// CHECK:STDOUT: %.loc12_29.6: %Abstract = acquire_value %.loc12_29.5 [concrete = constants.%Abstract.val]
|
||||
// CHECK:STDOUT: %.loc29_29.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc29_29.2: ref %Abstract = temporary_storage
|
||||
// CHECK:STDOUT: %.loc29_29.3: init %Abstract to %.loc29_29.2 = class_init () [concrete = constants.%Abstract.val]
|
||||
// CHECK:STDOUT: %.loc29_29.4: init %Abstract = converted %.loc29_29.1, %.loc29_29.3 [concrete = constants.%Abstract.val]
|
||||
// CHECK:STDOUT: %.loc29_29.5: ref %Abstract = temporary %.loc29_29.2, %.loc29_29.4 [concrete = constants.%.69a]
|
||||
// CHECK:STDOUT: %.loc29_29.6: %Abstract = acquire_value %.loc29_29.5 [concrete = constants.%Abstract.val]
|
||||
// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract]
|
||||
// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc12_29.6
|
||||
// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc29_29.6
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %l.patt: %pattern_type.169 = value_binding_pattern l [concrete = constants.%l.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -993,22 +1081,22 @@ fn Assign(ref a: Abstract) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc16_38.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
|
||||
// CHECK:STDOUT: %.loc16_39.1: %struct_type.base.f5e = struct_literal (%.loc16_38.1) [concrete = constants.%struct]
|
||||
// CHECK:STDOUT: %.loc27_38.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
|
||||
// CHECK:STDOUT: %.loc27_39.1: %struct_type.base.f5e = struct_literal (%.loc27_38.1) [concrete = constants.%struct]
|
||||
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
|
||||
// CHECK:STDOUT: %.loc16_39.2: ref %Derived = temporary_storage
|
||||
// CHECK:STDOUT: %.loc16_39.3: ref %.79f = class_element_access %.loc16_39.2, element0
|
||||
// CHECK:STDOUT: %.loc16_38.2: init %.79f to %.loc16_39.3 = class_init () [concrete = constants.%empty_struct.5e0]
|
||||
// CHECK:STDOUT: %.loc16_39.4: init %.79f = converted %.loc16_38.1, %.loc16_38.2 [concrete = constants.%empty_struct.5e0]
|
||||
// CHECK:STDOUT: %.loc16_39.5: init %Abstract = as_compatible %.loc16_39.4 [concrete = constants.%Abstract.val]
|
||||
// CHECK:STDOUT: %.loc16_39.6: init %Derived to %.loc16_39.2 = class_init (%.loc16_39.5) [concrete = constants.%Derived.val]
|
||||
// CHECK:STDOUT: %.loc16_41.1: init %Derived = converted %.loc16_39.1, %.loc16_39.6 [concrete = constants.%Derived.val]
|
||||
// CHECK:STDOUT: %.loc16_41.2: ref %Derived = temporary %.loc16_39.2, %.loc16_41.1 [concrete = constants.%.521]
|
||||
// CHECK:STDOUT: %.loc16_41.3: ref %Abstract = class_element_access %.loc16_41.2, element0 [concrete = constants.%.5d3]
|
||||
// CHECK:STDOUT: %.loc16_41.4: ref %Abstract = converted %.loc16_41.1, %.loc16_41.3 [concrete = constants.%.5d3]
|
||||
// CHECK:STDOUT: %.loc16_41.5: %Abstract = acquire_value %.loc16_41.4
|
||||
// CHECK:STDOUT: %.loc27_39.2: ref %Derived = temporary_storage
|
||||
// CHECK:STDOUT: %.loc27_39.3: ref %.79f = class_element_access %.loc27_39.2, element0
|
||||
// CHECK:STDOUT: %.loc27_38.2: init %.79f to %.loc27_39.3 = class_init () [concrete = constants.%empty_struct.5e0]
|
||||
// CHECK:STDOUT: %.loc27_39.4: init %.79f = converted %.loc27_38.1, %.loc27_38.2 [concrete = constants.%empty_struct.5e0]
|
||||
// CHECK:STDOUT: %.loc27_39.5: init %Abstract = as_compatible %.loc27_39.4 [concrete = constants.%Abstract.val]
|
||||
// CHECK:STDOUT: %.loc27_39.6: init %Derived to %.loc27_39.2 = class_init (%.loc27_39.5) [concrete = constants.%Derived.val]
|
||||
// CHECK:STDOUT: %.loc27_41.1: init %Derived = converted %.loc27_39.1, %.loc27_39.6 [concrete = constants.%Derived.val]
|
||||
// CHECK:STDOUT: %.loc27_41.2: ref %Derived = temporary %.loc27_39.2, %.loc27_41.1 [concrete = constants.%.521]
|
||||
// CHECK:STDOUT: %.loc27_41.3: ref %Abstract = class_element_access %.loc27_41.2, element0 [concrete = constants.%.5d3]
|
||||
// CHECK:STDOUT: %.loc27_41.4: ref %Abstract = converted %.loc27_41.1, %.loc27_41.3 [concrete = constants.%.5d3]
|
||||
// CHECK:STDOUT: %.loc27_41.5: %Abstract = acquire_value %.loc27_41.4
|
||||
// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract]
|
||||
// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc16_41.5
|
||||
// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc27_41.5
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %l.patt: %pattern_type.169 = value_binding_pattern l [concrete = constants.%l.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -1129,10 +1217,10 @@ fn Assign(ref a: Abstract) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Assign(%a.param: ref %Abstract) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %a.ref.loc10_3: ref %Abstract = name_ref a, %a
|
||||
// CHECK:STDOUT: %a.ref.loc10_7: ref %Abstract = name_ref a, %a
|
||||
// CHECK:STDOUT: %.loc10: %Abstract = acquire_value %a.ref.loc10_7
|
||||
// CHECK:STDOUT: assign %a.ref.loc10_3, <error>
|
||||
// CHECK:STDOUT: %a.ref.loc15_3: ref %Abstract = name_ref a, %a
|
||||
// CHECK:STDOUT: %a.ref.loc15_7: ref %Abstract = name_ref a, %a
|
||||
// CHECK:STDOUT: %.loc15: %Abstract = acquire_value %a.ref.loc15_7
|
||||
// CHECK:STDOUT: assign %a.ref.loc15_3, <error>
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -18,8 +18,17 @@ library "[[@TEST_NAME]]";
|
||||
abstract class Abstract1 {}
|
||||
|
||||
class Contains {
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-25: error: binding pattern has abstract type `{.m1: Abstract1}` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_field.carbon:[[@LINE+12]]:10
|
||||
// CHECK:STDERR: │ abstract class Abstract1 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var a: {.m1: Abstract1};
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `{.m1: Abstract1}` in
|
||||
// CHECK:STDERR: · ┃ `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: {.m1: Abstract1};
|
||||
}
|
||||
@@ -29,8 +38,17 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
abstract class Abstract2 {}
|
||||
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:8-23: error: binding pattern has abstract type `{.m2: Abstract2}` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-3]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_var.carbon:[[@LINE+12]]:8
|
||||
// CHECK:STDERR: │ abstract class Abstract2 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var v: {.m2: Abstract2};
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `{.m2: Abstract2}` in `var`
|
||||
// CHECK:STDERR: · ┃ pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var v: {.m2: Abstract2};
|
||||
|
||||
@@ -50,8 +68,17 @@ library "[[@TEST_NAME]]";
|
||||
abstract class Abstract4 {}
|
||||
abstract class Abstract5 {}
|
||||
|
||||
// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE+3]]:9-40: error: binding pattern has abstract type `{.m4: Abstract4, .m5: Abstract5}` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_twice.carbon:[[@LINE+12]]:9
|
||||
// CHECK:STDERR: │ abstract class Abstract4 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var v2: {.m4: Abstract4, .m5: Abstract5};
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type
|
||||
// CHECK:STDERR: · ┃ `{.m4: Abstract4, .m5: Abstract5}` in `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var v2: {.m4: Abstract4, .m5: Abstract5};
|
||||
|
||||
@@ -60,8 +87,17 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
abstract class Abstract6 {}
|
||||
|
||||
// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE+3]]:9-33: error: binding pattern has abstract type `{.m6: Abstract6, .c1: ()}` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE-3]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_first.carbon:[[@LINE+12]]:9
|
||||
// CHECK:STDERR: │ abstract class Abstract6 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var v3: {.m6: Abstract6, .c1: ()};
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type
|
||||
// CHECK:STDERR: · ┃ `{.m6: Abstract6, .c1: ()}` in `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var v3: {.m6: Abstract6, .c1: ()};
|
||||
|
||||
@@ -70,8 +106,17 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
abstract class Abstract7 {}
|
||||
|
||||
// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE+3]]:9-33: error: binding pattern has abstract type `{.c2: (), .m7: Abstract7}` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE-3]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_second.carbon:[[@LINE+12]]:9
|
||||
// CHECK:STDERR: │ abstract class Abstract7 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var v4: {.c2: (), .m7: Abstract7};
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type
|
||||
// CHECK:STDERR: · ┃ `{.c2: (), .m7: Abstract7}` in `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var v4: {.c2: (), .m7: Abstract7};
|
||||
|
||||
@@ -85,9 +130,19 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "lib";
|
||||
|
||||
// CHECK:STDERR: fail_import.carbon:[[@LINE+4]]:9-22: error: binding pattern has abstract type `{.m: Abstract}` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: imported from: fail_import.carbon:[[@LINE-3]]:1 [InImport]
|
||||
// CHECK:STDERR: lib.carbon:3:1-25: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_import.carbon:[[@LINE+14]]:9
|
||||
// CHECK:STDERR: -> │ var v5: {.m: Abstract};
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `{.m: Abstract}` in `var`
|
||||
// CHECK:STDERR: · ┃ pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: │ ╭── imported from: fail_import.carbon [InImport]
|
||||
// CHECK:STDERR: ├─┤ lib.carbon
|
||||
// CHECK:STDERR: │ abstract class Abstract {}
|
||||
// CHECK:STDERR: · ────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var v5: {.m: Abstract};
|
||||
|
||||
@@ -150,7 +205,7 @@ var v5: {.m: Abstract};
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Abstract2.decl: type = class_decl @Abstract2 [concrete = constants.%Abstract2] {} {}
|
||||
// CHECK:STDOUT: %v.var: ref <error> = var_storage %v.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc8: type = splice_block %struct_type.m2 [concrete = constants.%struct_type.m2.bb3] {
|
||||
// CHECK:STDOUT: %.loc17: type = splice_block %struct_type.m2 [concrete = constants.%struct_type.m2.bb3] {
|
||||
// CHECK:STDOUT: %Abstract2.ref: type = name_ref Abstract2, %Abstract2.decl [concrete = constants.%Abstract2]
|
||||
// CHECK:STDOUT: %struct_type.m2: type = struct_type {.m2: %Abstract2} [concrete = constants.%struct_type.m2.bb3]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -253,7 +308,7 @@ var v5: {.m: Abstract};
|
||||
// CHECK:STDOUT: %Abstract4.decl: type = class_decl @Abstract4 [concrete = constants.%Abstract4] {} {}
|
||||
// CHECK:STDOUT: %Abstract5.decl: type = class_decl @Abstract5 [concrete = constants.%Abstract5] {} {}
|
||||
// CHECK:STDOUT: %v2.var: ref <error> = var_storage %v2.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc9: type = splice_block %struct_type.m4.m5 [concrete = constants.%struct_type.m4.m5.5e1] {
|
||||
// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.m4.m5 [concrete = constants.%struct_type.m4.m5.5e1] {
|
||||
// CHECK:STDOUT: %Abstract4.ref: type = name_ref Abstract4, %Abstract4.decl [concrete = constants.%Abstract4]
|
||||
// CHECK:STDOUT: %Abstract5.ref: type = name_ref Abstract5, %Abstract5.decl [concrete = constants.%Abstract5]
|
||||
// CHECK:STDOUT: %struct_type.m4.m5: type = struct_type {.m4: %Abstract4, .m5: %Abstract5} [concrete = constants.%struct_type.m4.m5.5e1]
|
||||
@@ -306,10 +361,10 @@ var v5: {.m: Abstract};
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Abstract6.decl: type = class_decl @Abstract6 [concrete = constants.%Abstract6] {} {}
|
||||
// CHECK:STDOUT: %v3.var: ref <error> = var_storage %v3.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc8_33: type = splice_block %struct_type.m6.c1 [concrete = constants.%struct_type.m6.c1.a63] {
|
||||
// CHECK:STDOUT: %.loc17_33: type = splice_block %struct_type.m6.c1 [concrete = constants.%struct_type.m6.c1.a63] {
|
||||
// CHECK:STDOUT: %Abstract6.ref: type = name_ref Abstract6, %Abstract6.decl [concrete = constants.%Abstract6]
|
||||
// CHECK:STDOUT: %.loc8_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc8_32.2: type = converted %.loc8_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
||||
// CHECK:STDOUT: %.loc17_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc17_32.2: type = converted %.loc17_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
||||
// CHECK:STDOUT: %struct_type.m6.c1: type = struct_type {.m6: %Abstract6, .c1: %empty_tuple.type} [concrete = constants.%struct_type.m6.c1.a63]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v3: <error> = wrapper_binding v3, <error> [concrete = <error>]
|
||||
@@ -352,9 +407,9 @@ var v5: {.m: Abstract};
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Abstract7.decl: type = class_decl @Abstract7 [concrete = constants.%Abstract7] {} {}
|
||||
// CHECK:STDOUT: %v4.var: ref <error> = var_storage %v4.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc8_33: type = splice_block %struct_type.c2.m7 [concrete = constants.%struct_type.c2.m7.518] {
|
||||
// CHECK:STDOUT: %.loc8_16.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc8_16.2: type = converted %.loc8_16.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
||||
// CHECK:STDOUT: %.loc17_33: type = splice_block %struct_type.c2.m7 [concrete = constants.%struct_type.c2.m7.518] {
|
||||
// CHECK:STDOUT: %.loc17_16.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc17_16.2: type = converted %.loc17_16.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
||||
// CHECK:STDOUT: %Abstract7.ref: type = name_ref Abstract7, %Abstract7.decl [concrete = constants.%Abstract7]
|
||||
// CHECK:STDOUT: %struct_type.c2.m7: type = struct_type {.c2: %empty_tuple.type, .m7: %Abstract7} [concrete = constants.%struct_type.c2.m7.518]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -426,7 +481,7 @@ var v5: {.m: Abstract};
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %default.import = import <none>
|
||||
// CHECK:STDOUT: %v5.var: ref <error> = var_storage %v5.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc9: type = splice_block %struct_type.m [concrete = constants.%struct_type.m.b92] {
|
||||
// CHECK:STDOUT: %.loc19: type = splice_block %struct_type.m [concrete = constants.%struct_type.m.b92] {
|
||||
// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, imports.%Main.Abstract [concrete = constants.%Abstract]
|
||||
// CHECK:STDOUT: %struct_type.m: type = struct_type {.m: %Abstract} [concrete = constants.%struct_type.m.b92]
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -18,8 +18,17 @@ library "[[@TEST_NAME]]";
|
||||
abstract class Abstract1 {}
|
||||
|
||||
class Contains {
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-21: error: binding pattern has abstract type `(Abstract1,)` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_field.carbon:[[@LINE+12]]:10
|
||||
// CHECK:STDERR: │ abstract class Abstract1 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var a: (Abstract1,);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `(Abstract1,)` in `var`
|
||||
// CHECK:STDERR: · ┃ pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var a: (Abstract1,);
|
||||
}
|
||||
@@ -30,8 +39,17 @@ library "[[@TEST_NAME]]";
|
||||
abstract class Abstract2 {}
|
||||
|
||||
fn Var() {
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:17-28: error: binding pattern has abstract type `(Abstract2,)` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_var.carbon:[[@LINE+12]]:17
|
||||
// CHECK:STDERR: │ abstract class Abstract2 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var unused v: (Abstract2,);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `(Abstract2,)` in
|
||||
// CHECK:STDERR: · ┃ `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused v: (Abstract2,);
|
||||
}
|
||||
@@ -53,8 +71,17 @@ abstract class Abstract4 {}
|
||||
abstract class Abstract5 {}
|
||||
|
||||
fn Var2() {
|
||||
// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE+3]]:18-39: error: binding pattern has abstract type `(Abstract4, Abstract5)` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE-5]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_twice.carbon:[[@LINE+12]]:18
|
||||
// CHECK:STDERR: │ abstract class Abstract4 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var unused v2: (Abstract4, Abstract5);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type
|
||||
// CHECK:STDERR: · ┃ `(Abstract4, Abstract5)` in `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused v2: (Abstract4, Abstract5);
|
||||
}
|
||||
@@ -65,8 +92,17 @@ library "[[@TEST_NAME]]";
|
||||
abstract class Abstract6 {}
|
||||
|
||||
fn Var3() {
|
||||
// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE+3]]:18-32: error: binding pattern has abstract type `(Abstract6, {})` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_first.carbon:[[@LINE+12]]:18
|
||||
// CHECK:STDERR: │ abstract class Abstract6 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var unused v3: (Abstract6, {});
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `(Abstract6, {})`
|
||||
// CHECK:STDERR: · ┃ in `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused v3: (Abstract6, {});
|
||||
}
|
||||
@@ -77,8 +113,17 @@ library "[[@TEST_NAME]]";
|
||||
abstract class Abstract7 {}
|
||||
|
||||
fn Var4() {
|
||||
// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE+3]]:18-32: error: binding pattern has abstract type `({}, Abstract7)` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_abstract_second.carbon:[[@LINE+12]]:18
|
||||
// CHECK:STDERR: │ abstract class Abstract7 {}
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ var unused v4: ({}, Abstract7);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `({}, Abstract7)`
|
||||
// CHECK:STDERR: · ┃ in `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused v4: ({}, Abstract7);
|
||||
}
|
||||
@@ -94,9 +139,19 @@ library "[[@TEST_NAME]]";
|
||||
import library "lib";
|
||||
|
||||
fn Var5() {
|
||||
// CHECK:STDERR: fail_import.carbon:[[@LINE+4]]:18-28: error: binding pattern has abstract type `(Abstract,)` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: imported from: fail_import.carbon:[[@LINE-4]]:1 [InImport]
|
||||
// CHECK:STDERR: lib.carbon:3:1-25: note: uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╭─┤ fail_import.carbon:[[@LINE+14]]:18
|
||||
// CHECK:STDERR: -> │ var unused v5: (Abstract,);
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `(Abstract,)` in
|
||||
// CHECK:STDERR: · ┃ `var` pattern
|
||||
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: │ ╭── imported from: fail_import.carbon [InImport]
|
||||
// CHECK:STDERR: ├─┤ lib.carbon
|
||||
// CHECK:STDERR: │ abstract class Abstract {}
|
||||
// CHECK:STDERR: · ────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var unused v5: (Abstract,);
|
||||
}
|
||||
@@ -141,10 +196,10 @@ fn Var5() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @Contains {
|
||||
// CHECK:STDOUT: %field_decl: <error> = field_decl a, element0, %.loc9_21.2 in [concrete] {
|
||||
// CHECK:STDOUT: %field_decl: <error> = field_decl a, element0, %.loc18_21.2 in [concrete] {
|
||||
// CHECK:STDOUT: %Abstract1.ref: type = name_ref Abstract1, file.%Abstract1.decl [concrete = constants.%Abstract1]
|
||||
// CHECK:STDOUT: %.loc9_21.1: %tuple.type.135 = tuple_literal (%Abstract1.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc9_21.2: type = converted %.loc9_21.1, constants.%tuple.type.b06 [concrete = constants.%tuple.type.b06]
|
||||
// CHECK:STDOUT: %.loc18_21.1: %tuple.type.135 = tuple_literal (%Abstract1.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc18_21.2: type = converted %.loc18_21.1, constants.%tuple.type.b06 [concrete = constants.%tuple.type.b06]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
@@ -203,10 +258,10 @@ fn Var5() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %v.var: ref <error> = var_storage %v.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: assign %v.var, <error>
|
||||
// CHECK:STDOUT: %.loc9_28.1: type = splice_block %.loc9_28.3 [concrete = constants.%tuple.type.ea9] {
|
||||
// CHECK:STDOUT: %.loc18_28.1: type = splice_block %.loc18_28.3 [concrete = constants.%tuple.type.ea9] {
|
||||
// CHECK:STDOUT: %Abstract2.ref: type = name_ref Abstract2, file.%Abstract2.decl [concrete = constants.%Abstract2]
|
||||
// CHECK:STDOUT: %.loc9_28.2: %tuple.type.135 = tuple_literal (%Abstract2.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc9_28.3: type = converted %.loc9_28.2, constants.%tuple.type.ea9 [concrete = constants.%tuple.type.ea9]
|
||||
// CHECK:STDOUT: %.loc18_28.2: %tuple.type.135 = tuple_literal (%Abstract2.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc18_28.3: type = converted %.loc18_28.2, constants.%tuple.type.ea9 [concrete = constants.%tuple.type.ea9]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v: <error> = wrapper_binding v, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
@@ -345,11 +400,11 @@ fn Var5() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %v2.var: ref <error> = var_storage %v2.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: assign %v2.var, <error>
|
||||
// CHECK:STDOUT: %.loc10_39.1: type = splice_block %.loc10_39.3 [concrete = constants.%tuple.type.417] {
|
||||
// CHECK:STDOUT: %.loc19_39.1: type = splice_block %.loc19_39.3 [concrete = constants.%tuple.type.417] {
|
||||
// CHECK:STDOUT: %Abstract4.ref: type = name_ref Abstract4, file.%Abstract4.decl [concrete = constants.%Abstract4]
|
||||
// CHECK:STDOUT: %Abstract5.ref: type = name_ref Abstract5, file.%Abstract5.decl [concrete = constants.%Abstract5]
|
||||
// CHECK:STDOUT: %.loc10_39.2: %tuple.type.693 = tuple_literal (%Abstract4.ref, %Abstract5.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc10_39.3: type = converted %.loc10_39.2, constants.%tuple.type.417 [concrete = constants.%tuple.type.417]
|
||||
// CHECK:STDOUT: %.loc19_39.2: %tuple.type.693 = tuple_literal (%Abstract4.ref, %Abstract5.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc19_39.3: type = converted %.loc19_39.2, constants.%tuple.type.417 [concrete = constants.%tuple.type.417]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v2: <error> = wrapper_binding v2, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
@@ -408,12 +463,12 @@ fn Var5() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %v3.var: ref <error> = var_storage %v3.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: assign %v3.var, <error>
|
||||
// CHECK:STDOUT: %.loc9_32.1: type = splice_block %.loc9_32.4 [concrete = constants.%tuple.type.427] {
|
||||
// CHECK:STDOUT: %.loc18_32.1: type = splice_block %.loc18_32.4 [concrete = constants.%tuple.type.427] {
|
||||
// CHECK:STDOUT: %Abstract6.ref: type = name_ref Abstract6, file.%Abstract6.decl [concrete = constants.%Abstract6]
|
||||
// CHECK:STDOUT: %.loc9_31: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc9_32.2: %tuple.type.4d1 = tuple_literal (%Abstract6.ref, %.loc9_31) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc9_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %.loc9_32.4: type = converted %.loc9_32.2, constants.%tuple.type.427 [concrete = constants.%tuple.type.427]
|
||||
// CHECK:STDOUT: %.loc18_31: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc18_32.2: %tuple.type.4d1 = tuple_literal (%Abstract6.ref, %.loc18_31) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc18_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %.loc18_32.4: type = converted %.loc18_32.2, constants.%tuple.type.427 [concrete = constants.%tuple.type.427]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v3: <error> = wrapper_binding v3, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
@@ -472,12 +527,12 @@ fn Var5() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %v4.var: ref <error> = var_storage %v4.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: assign %v4.var, <error>
|
||||
// CHECK:STDOUT: %.loc9_32.1: type = splice_block %.loc9_32.4 [concrete = constants.%tuple.type.9db] {
|
||||
// CHECK:STDOUT: %.loc9_20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc18_32.1: type = splice_block %.loc18_32.4 [concrete = constants.%tuple.type.9db] {
|
||||
// CHECK:STDOUT: %.loc18_20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Abstract7.ref: type = name_ref Abstract7, file.%Abstract7.decl [concrete = constants.%Abstract7]
|
||||
// CHECK:STDOUT: %.loc9_32.2: %tuple.type.12a = tuple_literal (%.loc9_20, %Abstract7.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc9_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %.loc9_32.4: type = converted %.loc9_32.2, constants.%tuple.type.9db [concrete = constants.%tuple.type.9db]
|
||||
// CHECK:STDOUT: %.loc18_32.2: %tuple.type.12a = tuple_literal (%.loc18_20, %Abstract7.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc18_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %.loc18_32.4: type = converted %.loc18_32.2, constants.%tuple.type.9db [concrete = constants.%tuple.type.9db]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v4: <error> = wrapper_binding v4, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
@@ -570,10 +625,10 @@ fn Var5() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %v5.var: ref <error> = var_storage %v5.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: assign %v5.var, <error>
|
||||
// CHECK:STDOUT: %.loc10_28.1: type = splice_block %.loc10_28.3 [concrete = constants.%tuple.type.763] {
|
||||
// CHECK:STDOUT: %.loc20_28.1: type = splice_block %.loc20_28.3 [concrete = constants.%tuple.type.763] {
|
||||
// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, imports.%Main.Abstract [concrete = constants.%Abstract]
|
||||
// CHECK:STDOUT: %.loc10_28.2: %tuple.type.135 = tuple_literal (%Abstract.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc10_28.3: type = converted %.loc10_28.2, constants.%tuple.type.763 [concrete = constants.%tuple.type.763]
|
||||
// CHECK:STDOUT: %.loc20_28.2: %tuple.type.135 = tuple_literal (%Abstract.ref) [concrete = constants.%tuple]
|
||||
// CHECK:STDOUT: %.loc20_28.3: type = converted %.loc20_28.2, constants.%tuple.type.763 [concrete = constants.%tuple.type.763]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v5: <error> = wrapper_binding v5, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
|
||||
+84
-25
@@ -31,21 +31,56 @@ class Circle {
|
||||
fn Run() {
|
||||
//@dump-sem-ir-begin
|
||||
let circle: Circle = Circle.Make();
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:28-40: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-18]]:15-25: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_private_field_access.carbon:[[@LINE+12]]:28
|
||||
// CHECK:STDERR: │ private var radius: i32;
|
||||
// CHECK:STDERR: · ─────┬─────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ let unused radius: i32 = circle.radius;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `radius` of
|
||||
// CHECK:STDERR: · ┃ type `Circle`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused radius: i32 = circle.radius;
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:3-15: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-22]]:15-25: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_private_field_access.carbon:[[@LINE+11]]:3
|
||||
// CHECK:STDERR: │ private var radius: i32;
|
||||
// CHECK:STDERR: · ─────┬─────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ circle.radius = 5;
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `radius` of type `Circle`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
circle.radius = 5;
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:3-31: error: cannot access private member `SOME_INTERNAL_CONSTANT` of type `Circle` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-25]]:15-41: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_private_field_access.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ private let SOME_INTERNAL_CONSTANT: i32 = 5;
|
||||
// CHECK:STDERR: · ─────────────┬─────────────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ circle.SOME_INTERNAL_CONSTANT;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `SOME_INTERNAL_CONSTANT` of type
|
||||
// CHECK:STDERR: · ┃ `Circle`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
circle.SOME_INTERNAL_CONSTANT;
|
||||
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:3-29: error: cannot access private member `SomeInternalFunction` of type `Circle` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-28]]:3-44: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_private_field_access.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ private fn SomeInternalFunction() -> i32 {
|
||||
// CHECK:STDERR: · ─────────────────────┬────────────────────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ circle.SomeInternalFunction();
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `SomeInternalFunction` of type
|
||||
// CHECK:STDERR: · ┃ `Circle`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
circle.SomeInternalFunction();
|
||||
//@dump-sem-ir-end
|
||||
@@ -60,8 +95,16 @@ class A {
|
||||
|
||||
fn Run() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE+3]]:23-25: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_protected_field_access.carbon:[[@LINE+11]]:23
|
||||
// CHECK:STDERR: │ protected var x: i32;
|
||||
// CHECK:STDERR: · ───┬──
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ let unused x: i32 = A.x;
|
||||
// CHECK:STDERR: · ┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access protected member `x` of type `A`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused x: i32 = A.x;
|
||||
//@dump-sem-ir-end
|
||||
@@ -137,12 +180,28 @@ class A {
|
||||
}
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+3]]:14-16: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_global_access.carbon:[[@LINE+11]]:14
|
||||
// CHECK:STDERR: │ protected let x: i32 = 5;
|
||||
// CHECK:STDERR: · ───┬──
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ let x: i32 = A.x;
|
||||
// CHECK:STDERR: · ━┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access protected member `x` of type `A`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let x: i32 = A.x;
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+3]]:14-16: error: cannot access private member `y` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-9]]:15-20: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_global_access.carbon:[[@LINE+11]]:14
|
||||
// CHECK:STDERR: │ private let y: i32 = 5;
|
||||
// CHECK:STDERR: · ───┬──
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ let y: i32 = A.y;
|
||||
// CHECK:STDERR: · ━┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `y` of type `A`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let y: i32 = A.y;
|
||||
//@dump-sem-ir-end
|
||||
@@ -261,20 +320,20 @@ class A {
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %circle.patt: %pattern_type.f70 = value_binding_pattern circle [concrete = constants.%circle.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %circle.ref.loc24: %Circle = name_ref circle, %circle
|
||||
// CHECK:STDOUT: %radius.ref.loc24: <error> = name_ref radius, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %circle.ref.loc33: %Circle = name_ref circle, %circle
|
||||
// CHECK:STDOUT: %radius.ref.loc33: <error> = name_ref radius, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %radius: %i32 = wrapper_binding radius, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %radius.patt: %pattern_type.d94 = value_binding_pattern radius [concrete = constants.%radius.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %circle.ref.loc28: %Circle = name_ref circle, %circle
|
||||
// CHECK:STDOUT: %radius.ref.loc28: <error> = name_ref radius, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %circle.ref.loc45: %Circle = name_ref circle, %circle
|
||||
// CHECK:STDOUT: %radius.ref.loc45: <error> = name_ref radius, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5.64b]
|
||||
// CHECK:STDOUT: assign %radius.ref.loc28, <error>
|
||||
// CHECK:STDOUT: %circle.ref.loc32: %Circle = name_ref circle, %circle
|
||||
// CHECK:STDOUT: assign %radius.ref.loc45, <error>
|
||||
// CHECK:STDOUT: %circle.ref.loc58: %Circle = name_ref circle, %circle
|
||||
// CHECK:STDOUT: %SOME_INTERNAL_CONSTANT.ref: <error> = name_ref SOME_INTERNAL_CONSTANT, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %circle.ref.loc37: %Circle = name_ref circle, %circle
|
||||
// CHECK:STDOUT: %circle.ref.loc72: %Circle = name_ref circle, %circle
|
||||
// CHECK:STDOUT: %SomeInternalFunction.ref: <error> = name_ref SomeInternalFunction, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc20_36.1: %Destroy.type = facet_value constants.%Circle, (constants.%DestroyImpl.impl_witness.60b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.4b3]
|
||||
// CHECK:STDOUT: %.loc20_36.4: %Destroy.type = converted constants.%Circle, %Destroy.facet.loc20_36.1 [concrete = constants.%Destroy.facet.4b3]
|
||||
@@ -486,12 +545,12 @@ class A {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %i32.loc12: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %x: %i32 = wrapper_binding x, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %x.patt: %pattern_type.d94 = value_binding_pattern x [concrete = constants.%x.patt.ea2]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %i32.loc16: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %i32.loc32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %y: %i32 = wrapper_binding y, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %y.patt: %pattern_type.d94 = value_binding_pattern y [concrete = constants.%y.patt.cd5]
|
||||
@@ -500,9 +559,9 @@ class A {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %A.ref.loc12: type = name_ref A, file.%A.decl [concrete = constants.%A]
|
||||
// CHECK:STDOUT: %A.ref.loc20: type = name_ref A, file.%A.decl [concrete = constants.%A]
|
||||
// CHECK:STDOUT: %x.ref: <error> = name_ref x, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %A.ref.loc16: type = name_ref A, file.%A.decl [concrete = constants.%A]
|
||||
// CHECK:STDOUT: %A.ref.loc32: type = name_ref A, file.%A.decl [concrete = constants.%A]
|
||||
// CHECK:STDOUT: %y.ref: <error> = name_ref y, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+34
-6
@@ -18,8 +18,16 @@ class C {
|
||||
}
|
||||
|
||||
fn F(c: C) -> i32 {
|
||||
// CHECK:STDERR: fail_non_friend.carbon:[[@LINE+3]]:10-12: error: cannot access private member `i` of type `C` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_non_friend.carbon:[[@LINE-5]]:15-20: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_non_friend.carbon:[[@LINE+11]]:10
|
||||
// CHECK:STDERR: │ private var i: i32;
|
||||
// CHECK:STDERR: · ───┬──
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ return c.i;
|
||||
// CHECK:STDERR: · ━┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `i` of type `C`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return c.i;
|
||||
}
|
||||
@@ -33,7 +41,12 @@ fn F(c: C) -> i32;
|
||||
|
||||
class C {
|
||||
private var i: i32;
|
||||
// CHECK:STDERR: fail_todo_friend_function.carbon:[[@LINE+2]]:3-11: error: semantics TODO: `befriending a function not yet implemented` [SemanticsTodo]
|
||||
// CHECK:STDERR: ╭─┤ fail_todo_friend_function.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ friend F;
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `befriending a function not yet implemented`
|
||||
// CHECK:STDERR: · ┃ [SemanticsTodo]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
friend F;
|
||||
}
|
||||
@@ -134,7 +147,12 @@ var v: i32;
|
||||
|
||||
class C {
|
||||
private var i: i32;
|
||||
// CHECK:STDERR: fail_friend_var.carbon:[[@LINE+2]]:10: error: friend declaration names entity that is not a name scope [FriendNotNameScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_friend_var.carbon:[[@LINE+7]]:10
|
||||
// CHECK:STDERR: -> │ friend v;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: friend declaration names entity that is not a name scope
|
||||
// CHECK:STDERR: · ┃ [FriendNotNameScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
friend v;
|
||||
}
|
||||
@@ -161,7 +179,12 @@ library "[[@TEST_NAME]]";
|
||||
class C;
|
||||
|
||||
interface I {
|
||||
// CHECK:STDERR: fail_friend_not_in_class.carbon:[[@LINE+2]]:3-11: error: `friend` declaration in non-class scope [FriendNotAllowedInScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_friend_not_in_class.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ friend C;
|
||||
// CHECK:STDERR: · ━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: `friend` declaration in non-class scope
|
||||
// CHECK:STDERR: · ┃ [FriendNotAllowedInScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
friend C;
|
||||
}
|
||||
@@ -171,7 +194,12 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class C {
|
||||
var v: i32;
|
||||
// CHECK:STDERR: fail_friend_not_constant.carbon:[[@LINE+2]]:10: error: friend declaration names entity that is not a name scope [FriendNotNameScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_friend_not_constant.carbon:[[@LINE+7]]:10
|
||||
// CHECK:STDERR: -> │ friend v;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: friend declaration names entity that is not a name scope
|
||||
// CHECK:STDERR: · ┃ [FriendNotNameScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
friend v;
|
||||
}
|
||||
+33
-6
@@ -50,7 +50,11 @@ package Test library "[[@TEST_NAME]]";
|
||||
|
||||
import library "def";
|
||||
|
||||
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:8-10: error: name `Def` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_local_def.carbon:[[@LINE+6]]:8
|
||||
// CHECK:STDERR: -> │ var c: Def = {};
|
||||
// CHECK:STDERR: · ━┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `Def` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var c: Def = {};
|
||||
|
||||
@@ -60,7 +64,12 @@ package Other library "[[@TEST_NAME]]";
|
||||
|
||||
import Test library "def";
|
||||
|
||||
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:8-15: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_other_def.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ var c: Test.Def = {};
|
||||
// CHECK:STDERR: · ━━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: member name `Def` not found in `Test`
|
||||
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var c: Test.Def = {};
|
||||
|
||||
@@ -76,7 +85,11 @@ package Test library "[[@TEST_NAME]]";
|
||||
|
||||
import library "forward_with_def";
|
||||
|
||||
// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+2]]:8-21: error: name `ForwardWithDef` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_local_forward_with_def.carbon:[[@LINE+6]]:8
|
||||
// CHECK:STDERR: -> │ var c: ForwardWithDef = {};
|
||||
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `ForwardWithDef` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var c: ForwardWithDef = {};
|
||||
|
||||
@@ -86,7 +99,12 @@ package Other library "[[@TEST_NAME]]";
|
||||
|
||||
import Test library "forward_with_def";
|
||||
|
||||
// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+2]]:8-26: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_other_forward_with_def.carbon:[[@LINE+7]]:8
|
||||
// CHECK:STDERR: -> │ var c: Test.ForwardWithDef = {};
|
||||
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: member name `ForwardWithDef` not found in `Test`
|
||||
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var c: Test.ForwardWithDef = {};
|
||||
|
||||
@@ -104,7 +122,11 @@ package Test library "[[@TEST_NAME]]";
|
||||
|
||||
import library "forward";
|
||||
|
||||
// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+2]]:16-22: error: name `Forward` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╭─┤ fail_local_forward.carbon:[[@LINE+6]]:16
|
||||
// CHECK:STDERR: -> │ fn F(unused c: Forward*) {}
|
||||
// CHECK:STDERR: · ━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: name `Forward` not found [NameNotFound]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn F(unused c: Forward*) {}
|
||||
|
||||
@@ -114,7 +136,12 @@ package Other library "[[@TEST_NAME]]";
|
||||
|
||||
import Test library "forward";
|
||||
|
||||
// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+2]]:16-27: error: member name `Forward` not found in `Test` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_other_forward.carbon:[[@LINE+7]]:16
|
||||
// CHECK:STDERR: -> │ fn F(unused c: Test.Forward*) {}
|
||||
// CHECK:STDERR: · ━━━━━━┳━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: member name `Forward` not found in `Test`
|
||||
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn F(unused c: Test.Forward*) {}
|
||||
|
||||
|
||||
+120
-24
@@ -81,8 +81,16 @@ class Square {
|
||||
extend base: Shape;
|
||||
|
||||
fn GetPosition(self) -> i32 {
|
||||
// CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE+3]]:12-17: error: cannot access private member `y` of type `Shape` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE-8]]:15-20: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_inherited_private_field_access.carbon:[[@LINE+11]]:12
|
||||
// CHECK:STDERR: │ private var y: i32;
|
||||
// CHECK:STDERR: · ───┬──
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ return self.y;
|
||||
// CHECK:STDERR: · ━━━┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `y` of type `Shape`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return self.y;
|
||||
}
|
||||
@@ -122,8 +130,16 @@ base class B {
|
||||
|
||||
class C {
|
||||
extend base: B;
|
||||
// CHECK:STDERR: fail_noninstance_private_on_parent_qualified.carbon:[[@LINE+3]]:12-17: error: cannot access private member `F` of type `B` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_noninstance_private_on_parent_qualified.carbon:[[@LINE-6]]:3-18: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_noninstance_private_on_parent_qualified.carbon:[[@LINE+11]]:12
|
||||
// CHECK:STDERR: │ private fn F() {}
|
||||
// CHECK:STDERR: · ────────┬───────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ fn G() { Self.F(); }
|
||||
// CHECK:STDERR: · ━━━┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `F` of type `B`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn G() { Self.F(); }
|
||||
}
|
||||
@@ -146,18 +162,43 @@ base class B {
|
||||
class C {
|
||||
extend base: B;
|
||||
|
||||
// CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+3]]:27-47: error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `B` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-8]]:15-40: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+12]]:27
|
||||
// CHECK:STDERR: │ private let SOME_PRIVATE_CONSTANT: i32 = 86;
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ fn G1() -> i32 { return SOME_PRIVATE_CONSTANT; }
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member
|
||||
// CHECK:STDERR: · ┃ `SOME_PRIVATE_CONSTANT` of type `B`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn G1() -> i32 { return SOME_PRIVATE_CONSTANT; }
|
||||
|
||||
// CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+3]]:13-14: error: cannot access private member `Fa` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-19]]:3-19: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+11]]:13
|
||||
// CHECK:STDERR: │ private fn Fa() {}
|
||||
// CHECK:STDERR: · ────────┬────────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ fn G2() { Fa(); }
|
||||
// CHECK:STDERR: · ━┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `Fa` of type `A`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn G2() { Fa(); }
|
||||
|
||||
// CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+3]]:13-14: error: cannot access private member `Fb` of type `B` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-17]]:3-19: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+11]]:13
|
||||
// CHECK:STDERR: │ private fn Fb() {}
|
||||
// CHECK:STDERR: · ────────┬────────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ fn G3() { Fb(); }
|
||||
// CHECK:STDERR: · ━┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `Fb` of type `B`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
fn G3() { Fb(); }
|
||||
}
|
||||
@@ -192,20 +233,46 @@ class B {
|
||||
private var internal: Internal;
|
||||
|
||||
fn G() -> i32 {
|
||||
// CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+3]]:5-27: error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-12]]:15-40: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_non_inherited_access.carbon:[[@LINE+11]]:5
|
||||
// CHECK:STDERR: │ private let SOME_PRIVATE_CONSTANT: i32 = 5;
|
||||
// CHECK:STDERR: · ─────────────┬────────────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ A.SOME_PRIVATE_CONSTANT;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `A`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
A.SOME_PRIVATE_CONSTANT;
|
||||
|
||||
// CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+3]]:12-36: error: cannot access protected member `SOME_PROTECTED_CONSTANT` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-18]]:17-44: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_non_inherited_access.carbon:[[@LINE+12]]:12
|
||||
// CHECK:STDERR: │ protected let SOME_PROTECTED_CONSTANT: i32 = 5;
|
||||
// CHECK:STDERR: · ──────────────┬─────────────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ return A.SOME_PROTECTED_CONSTANT;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access protected member `SOME_PROTECTED_CONSTANT`
|
||||
// CHECK:STDERR: · ┃ of type `A`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return A.SOME_PROTECTED_CONSTANT;
|
||||
}
|
||||
|
||||
fn SomeFunc(self) -> i32{
|
||||
// CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+3]]:12-42: error: cannot access protected member `INTERNAL_CONSTANT` of type `Internal` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-20]]:17-38: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_non_inherited_access.carbon:[[@LINE+12]]:12
|
||||
// CHECK:STDERR: │ protected let INTERNAL_CONSTANT: i32 = 5;
|
||||
// CHECK:STDERR: · ───────────┬──────────
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ return self.internal.INTERNAL_CONSTANT;
|
||||
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access protected member `INTERNAL_CONSTANT` of
|
||||
// CHECK:STDERR: · ┃ type `Internal`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return self.internal.INTERNAL_CONSTANT;
|
||||
}
|
||||
@@ -222,8 +289,16 @@ base class A {
|
||||
class B {
|
||||
extend base: A;
|
||||
fn F(self) {
|
||||
// CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE+3]]:11-13: error: cannot access private member `x` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE-7]]:15-20: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_compound_member_access.carbon:[[@LINE+11]]:11
|
||||
// CHECK:STDERR: │ private var x: i32;
|
||||
// CHECK:STDERR: · ───┬──
|
||||
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ self.(A.x);
|
||||
// CHECK:STDERR: · ━┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `x` of type `A`
|
||||
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
self.(A.x);
|
||||
}
|
||||
@@ -269,13 +344,34 @@ fn G() {
|
||||
var d: C(i32) = {
|
||||
.base = Cpp.B.B(),
|
||||
};
|
||||
// CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE+8]]:13: error: cannot access private member `X` of type `Cpp.B` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE+7]]:13: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╭─┤ fail_access_private_parent_in_generic.carbon:[[@LINE+29]]:13
|
||||
// CHECK:STDERR: -> │ Cpp.F(&d);
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `X` of type `Cpp.B`
|
||||
// CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE-15]]:8: error: 'X' is a private member of 'A' [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE+4]]:13: note: in instantiation of function template specialization 'F<Carbon::Main::C<int>>' requested here [CppInteropParseNote]
|
||||
// CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE-21]]:12-20: note: constrained by private inheritance here [CppInteropParseNote]
|
||||
// CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE-24]]:8: note: member is declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: ╭─┤ fail_access_private_parent_in_generic.carbon:[[@LINE-20]]:8
|
||||
// CHECK:STDERR: │ bool X() const;
|
||||
// CHECK:STDERR: · ┬
|
||||
// CHECK:STDERR: · ╰──┤ member is declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: │ };
|
||||
// CHECK:STDERR: │ struct B : private A {};
|
||||
// CHECK:STDERR: · ────┬────
|
||||
// CHECK:STDERR: · ╰──┤ constrained by private inheritance here
|
||||
// CHECK:STDERR: · │ [CppInteropParseNote]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ t->X();
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: 'X' is a private member of 'A' [CppInteropParseError]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: │ Cpp.F(&d);
|
||||
// CHECK:STDERR: · ┬
|
||||
// CHECK:STDERR: · ╰──┤ in instantiation of function template specialization
|
||||
// CHECK:STDERR: · │ 'F<Carbon::Main::C<int>>' requested here
|
||||
// CHECK:STDERR: · │ [CppInteropParseNote]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Cpp.F(&d);
|
||||
}
|
||||
@@ -18,7 +18,13 @@ class X {
|
||||
|
||||
fn G(x: X) {
|
||||
// TODO: Produce a better diagnostic for this case.
|
||||
// CHECK:STDERR: fail_multiple_bindings.carbon:[[@LINE+2]]:3-9: error: member name of type `<bound method>` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase]
|
||||
// CHECK:STDERR: ╭─┤ fail_multiple_bindings.carbon:[[@LINE+8]]:3
|
||||
// CHECK:STDERR: -> │ x.(x.F)();
|
||||
// CHECK:STDERR: · ┳━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: member name of type `<bound method>` in compound member access is
|
||||
// CHECK:STDERR: · ┃ not an instance member or an interface member
|
||||
// CHECK:STDERR: · ┃ [CompoundMemberAccessDoesNotUseBase]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
x.(x.F)();
|
||||
}
|
||||
+18
-3
@@ -43,7 +43,12 @@ class AdaptNotExtend {
|
||||
|
||||
fn F(a: AdaptNotExtend) {
|
||||
// `Adapted` is not extended, so lookup for `F` finds nothing.
|
||||
// CHECK:STDERR: fail_not_extend.carbon:[[@LINE+2]]:3-5: error: member name `F` not found in `AdaptNotExtend` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_not_extend.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ a.F();
|
||||
// CHECK:STDERR: · ━┳━
|
||||
// CHECK:STDERR: · ┗━━┫ error: member name `F` not found in `AdaptNotExtend`
|
||||
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
a.F();
|
||||
}
|
||||
@@ -53,13 +58,23 @@ fn F(a: AdaptNotExtend) {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_misplaced.carbon:[[@LINE+2]]:3-12: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass]
|
||||
// CHECK:STDERR: ╭─┤ fail_misplaced.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ adapt i32;
|
||||
// CHECK:STDERR: · ━━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: `adapt` declaration outside class
|
||||
// CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
adapt i32;
|
||||
}
|
||||
|
||||
interface I {
|
||||
// CHECK:STDERR: fail_misplaced.carbon:[[@LINE+2]]:3-12: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass]
|
||||
// CHECK:STDERR: ╭─┤ fail_misplaced.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ adapt i32;
|
||||
// CHECK:STDERR: · ━━━━━┳━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: `adapt` declaration outside class
|
||||
// CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
adapt i32;
|
||||
}
|
||||
|
||||
+183
-126
@@ -24,23 +24,50 @@ class AdaptCopyable {
|
||||
}
|
||||
|
||||
fn F(c: AdaptCopyable) -> AdaptCopyable {
|
||||
// CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:26: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:26: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_adapt_copyable.carbon:[[@LINE+10]]:26
|
||||
// CHECK:STDERR: -> │ var d: AdaptCopyable = c;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AdaptCopyable`
|
||||
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰────┤ type `AdaptCopyable` does not implement
|
||||
// CHECK:STDERR: · │ interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var d: AdaptCopyable = c;
|
||||
// CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_adapt_copyable.carbon:[[@LINE+9]]:10
|
||||
// CHECK:STDERR: -> │ return d;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AdaptCopyable`
|
||||
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰────┤ type `AdaptCopyable` does not implement interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return d;
|
||||
}
|
||||
|
||||
fn InTuple(c: (AdaptCopyable, u32)) -> (AdaptCopyable, u32) {
|
||||
// CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:33: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:33: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_adapt_copyable.carbon:[[@LINE+11]]:33
|
||||
// CHECK:STDERR: -> │ var d: (AdaptCopyable, u32) = c;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type
|
||||
// CHECK:STDERR: · │ ┃ `AdaptCopyable`
|
||||
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰────┤ type `AdaptCopyable` does not implement
|
||||
// CHECK:STDERR: · │ interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var d: (AdaptCopyable, u32) = c;
|
||||
// CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_adapt_copyable.carbon:[[@LINE+9]]:10
|
||||
// CHECK:STDERR: -> │ return d;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AdaptCopyable`
|
||||
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰────┤ type `AdaptCopyable` does not implement interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return d;
|
||||
}
|
||||
@@ -76,12 +103,26 @@ class AdaptNoncopyable {
|
||||
}
|
||||
|
||||
fn G(a: AdaptNoncopyable) -> AdaptNoncopyable {
|
||||
// CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+3]]:29: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+2]]:29: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_adapt_not_copyable.carbon:[[@LINE+11]]:29
|
||||
// CHECK:STDERR: -> │ var b: AdaptNoncopyable = a;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type
|
||||
// CHECK:STDERR: · │ ┃ `AdaptNoncopyable`
|
||||
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰────┤ type `AdaptNoncopyable` does not implement
|
||||
// CHECK:STDERR: · │ interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var b: AdaptNoncopyable = a;
|
||||
// CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+2]]:10: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_adapt_not_copyable.carbon:[[@LINE+9]]:10
|
||||
// CHECK:STDERR: -> │ return b;
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AdaptNoncopyable`
|
||||
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰────┤ type `AdaptNoncopyable` does not implement interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return b;
|
||||
}
|
||||
@@ -99,14 +140,30 @@ class AdaptNoncopyableIndirect {
|
||||
}
|
||||
|
||||
fn H(a: AdaptNoncopyableIndirect) -> AdaptNoncopyableIndirect {
|
||||
// CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:3-33: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+3]]:3-33: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+2]]:37: note: in copy of `AdaptNoncopyableIndirect` [InCopy]
|
||||
// CHECK:STDERR: ╭─┤ fail_adapt_not_copyable_indirect.carbon:[[@LINE+14]]:3
|
||||
// CHECK:STDERR: -> │ var b: AdaptNoncopyableIndirect = a;
|
||||
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ ┬
|
||||
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━┫ error: cannot copy value of type
|
||||
// CHECK:STDERR: · │ │ ┃ `Noncopyable`
|
||||
// CHECK:STDERR: · │ │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰───────────────────────┤ type `Noncopyable` does not implement
|
||||
// CHECK:STDERR: · │ │ interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: · ╰──────┤ in copy of
|
||||
// CHECK:STDERR: · │ `AdaptNoncopyableIndirect`
|
||||
// CHECK:STDERR: · │ [InCopy]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
var b: AdaptNoncopyableIndirect = a;
|
||||
// CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:3-11: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+3]]:3-11: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+2]]:10: note: in copy of `AdaptNoncopyableIndirect` [InCopy]
|
||||
// CHECK:STDERR: ╭─┤ fail_adapt_not_copyable_indirect.carbon:[[@LINE+10]]:3
|
||||
// CHECK:STDERR: -> │ return b;
|
||||
// CHECK:STDERR: · ━━━━┳━━┯━
|
||||
// CHECK:STDERR: · ┗━━━━━┫ error: cannot copy value of type `Noncopyable`
|
||||
// CHECK:STDERR: · │ │ ┃ [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: · ╰───────┤ type `Noncopyable` does not implement interface `Core.Copy`
|
||||
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: · ╰──────┤ in copy of `AdaptNoncopyableIndirect` [InCopy]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
return b;
|
||||
}
|
||||
@@ -159,7 +216,7 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// 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.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc12_3.2 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc19_3.2 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.b80ef6.2: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.facet.f53: %SubobjectDestroy.type = facet_value %AdaptCopyable, (%custom_witness.b80ef6.2) [concrete]
|
||||
@@ -182,10 +239,10 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// CHECK:STDOUT: %InTuple: %InTuple.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %d.patt.883: %pattern_type.848 = ref_binding_pattern d [concrete]
|
||||
// CHECK:STDOUT: %d.var_patt.66d: %pattern_type.848 = var_pattern %d.patt.883 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc23_3.1 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc44_3.1 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.b80ef6.3: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc23_3.2 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc44_3.2 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.4: %SubobjectDestroy.WithSelf.Op.type.6870fd.4 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.facet.439: %SubobjectDestroy.type = facet_value %u32, (%custom_witness.b80ef6.3) [concrete]
|
||||
@@ -244,19 +301,19 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// CHECK:STDOUT: %c.param_patt: %pattern_type.848 = value_param_pattern [concrete = constants.%c.param_patt.47e]
|
||||
// CHECK:STDOUT: %c.patt: %pattern_type.848 = wrapper_binding_pattern c, %c.param_patt [concrete = constants.%c.patt.fe5]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.848 = out_param_pattern [concrete = constants.%return.param_patt.117]
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.848 = return_slot_pattern %return.param_patt, %.loc19_59.2 [concrete = constants.%return.patt.77a]
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.848 = return_slot_pattern %return.param_patt, %.loc32_59.2 [concrete = constants.%return.patt.77a]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %AdaptCopyable.ref.loc19_41: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
|
||||
// CHECK:STDOUT: %u32.loc19_56: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %.loc19_59.1: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc19_41, %u32.loc19_56) [concrete = constants.%tuple.0f9]
|
||||
// CHECK:STDOUT: %.loc19_59.2: type = converted %.loc19_59.1, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35]
|
||||
// CHECK:STDOUT: %.loc19_59.3: Core.Form = init_form %.loc19_59.2 [concrete = constants.%.70b]
|
||||
// CHECK:STDOUT: %AdaptCopyable.ref.loc32_41: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
|
||||
// CHECK:STDOUT: %u32.loc32_56: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %.loc32_59.1: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc32_41, %u32.loc32_56) [concrete = constants.%tuple.0f9]
|
||||
// CHECK:STDOUT: %.loc32_59.2: type = converted %.loc32_59.1, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35]
|
||||
// CHECK:STDOUT: %.loc32_59.3: Core.Form = init_form %.loc32_59.2 [concrete = constants.%.70b]
|
||||
// CHECK:STDOUT: %c.param: %tuple.type.c35 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc19_34.1: type = splice_block %.loc19_34.3 [concrete = constants.%tuple.type.c35] {
|
||||
// CHECK:STDOUT: %AdaptCopyable.ref.loc19_16: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
|
||||
// CHECK:STDOUT: %u32.loc19_31: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %.loc19_34.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc19_16, %u32.loc19_31) [concrete = constants.%tuple.0f9]
|
||||
// CHECK:STDOUT: %.loc19_34.3: type = converted %.loc19_34.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35]
|
||||
// CHECK:STDOUT: %.loc32_34.1: type = splice_block %.loc32_34.3 [concrete = constants.%tuple.type.c35] {
|
||||
// CHECK:STDOUT: %AdaptCopyable.ref.loc32_16: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
|
||||
// CHECK:STDOUT: %u32.loc32_31: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %.loc32_34.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc32_16, %u32.loc32_31) [concrete = constants.%tuple.0f9]
|
||||
// CHECK:STDOUT: %.loc32_34.3: type = converted %.loc32_34.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %c: %tuple.type.c35 = wrapper_binding c, %c.param
|
||||
// CHECK:STDOUT: %return.param: ref %tuple.type.c35 = out_param call_param1
|
||||
@@ -279,38 +336,38 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// CHECK:STDOUT: %d.var: ref %AdaptCopyable = var_storage %d.var_patt
|
||||
// CHECK:STDOUT: %c.ref: %AdaptCopyable = name_ref c, %c
|
||||
// CHECK:STDOUT: assign %d.var, <error>
|
||||
// CHECK:STDOUT: %AdaptCopyable.ref.loc12: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
|
||||
// CHECK:STDOUT: %AdaptCopyable.ref.loc19: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
|
||||
// CHECK:STDOUT: %d: ref %AdaptCopyable = wrapper_binding d, %d.var
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %d.patt: %pattern_type.3b9 = ref_binding_pattern d [concrete = constants.%d.patt.467]
|
||||
// CHECK:STDOUT: %d.var_patt: %pattern_type.3b9 = var_pattern %d.patt [concrete = constants.%d.var_patt.b13]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %d.ref: ref %AdaptCopyable = name_ref d, %d
|
||||
// CHECK:STDOUT: %.loc16: %AdaptCopyable = acquire_value %d.ref
|
||||
// CHECK:STDOUT: %Destroy.facet.loc12_3.1: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %.loc12_3.1: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc12_3.1 [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc12_3.2: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %.loc12_3.2: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc12_3.2 [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %.loc29: %AdaptCopyable = acquire_value %d.ref
|
||||
// CHECK:STDOUT: %Destroy.facet.loc19_3.1: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %.loc19_3.1: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc19_3.1 [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc19_3.2: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %.loc19_3.2: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc19_3.2 [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn: <specific function> = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.11a) [concrete = constants.%SelfDestruct.specific_fn.97c]
|
||||
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%d.var)
|
||||
// CHECK:STDOUT: return <error>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc12_3.1(%self.param: ref %i32) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc19_3.1(%self.param: ref %i32) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc12_3.2(%self.param: ref %AdaptCopyable) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc19_3.2(%self.param: ref %AdaptCopyable) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @InTuple(%c.param: %tuple.type.c35) -> out %return.param: %tuple.type.c35 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %d.var: ref %tuple.type.c35 = var_storage %d.var_patt
|
||||
// CHECK:STDOUT: %c.ref: %tuple.type.c35 = name_ref c, %c
|
||||
// CHECK:STDOUT: %tuple.elem0.loc23: %AdaptCopyable = tuple_access %c.ref, element0
|
||||
// CHECK:STDOUT: %tuple.elem0.loc44: %AdaptCopyable = tuple_access %c.ref, element0
|
||||
// CHECK:STDOUT: assign %d.var, <error>
|
||||
// CHECK:STDOUT: %.loc23_29.1: type = splice_block %.loc23_29.3 [concrete = constants.%tuple.type.c35] {
|
||||
// CHECK:STDOUT: %AdaptCopyable.ref.loc23: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
|
||||
// CHECK:STDOUT: %u32.loc23: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %.loc23_29.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc23, %u32.loc23) [concrete = constants.%tuple.0f9]
|
||||
// CHECK:STDOUT: %.loc23_29.3: type = converted %.loc23_29.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35]
|
||||
// CHECK:STDOUT: %.loc44_29.1: type = splice_block %.loc44_29.3 [concrete = constants.%tuple.type.c35] {
|
||||
// CHECK:STDOUT: %AdaptCopyable.ref.loc44: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
|
||||
// CHECK:STDOUT: %u32.loc44: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %.loc44_29.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc44, %u32.loc44) [concrete = constants.%tuple.0f9]
|
||||
// CHECK:STDOUT: %.loc44_29.3: type = converted %.loc44_29.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %d: ref %tuple.type.c35 = wrapper_binding d, %d.var
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
@@ -318,37 +375,37 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// CHECK:STDOUT: %d.var_patt: %pattern_type.848 = var_pattern %d.patt [concrete = constants.%d.var_patt.66d]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %d.ref: ref %tuple.type.c35 = name_ref d, %d
|
||||
// CHECK:STDOUT: %tuple.elem0.loc27: ref %AdaptCopyable = tuple_access %d.ref, element0
|
||||
// CHECK:STDOUT: %.loc27: %AdaptCopyable = acquire_value %tuple.elem0.loc27
|
||||
// CHECK:STDOUT: %Destroy.facet.loc23_3.1: %Destroy.type = facet_value constants.%tuple.type.c35, (constants.%DestroyImpl.impl_witness.2ab, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.aca]
|
||||
// CHECK:STDOUT: %.loc23_3.1: %Destroy.type = converted constants.%tuple.type.c35, %Destroy.facet.loc23_3.1 [concrete = constants.%Destroy.facet.aca]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc23_3.2: %Destroy.type = facet_value constants.%tuple.type.c35, (constants.%DestroyImpl.impl_witness.2ab, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.aca]
|
||||
// CHECK:STDOUT: %.loc23_3.2: %Destroy.type = converted constants.%tuple.type.c35, %Destroy.facet.loc23_3.2 [concrete = constants.%Destroy.facet.aca]
|
||||
// CHECK:STDOUT: %tuple.elem0.loc54: ref %AdaptCopyable = tuple_access %d.ref, element0
|
||||
// CHECK:STDOUT: %.loc54: %AdaptCopyable = acquire_value %tuple.elem0.loc54
|
||||
// CHECK:STDOUT: %Destroy.facet.loc44_3.1: %Destroy.type = facet_value constants.%tuple.type.c35, (constants.%DestroyImpl.impl_witness.2ab, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.aca]
|
||||
// CHECK:STDOUT: %.loc44_3.1: %Destroy.type = converted constants.%tuple.type.c35, %Destroy.facet.loc44_3.1 [concrete = constants.%Destroy.facet.aca]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc44_3.2: %Destroy.type = facet_value constants.%tuple.type.c35, (constants.%DestroyImpl.impl_witness.2ab, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.aca]
|
||||
// CHECK:STDOUT: %.loc44_3.2: %Destroy.type = converted constants.%tuple.type.c35, %Destroy.facet.loc44_3.2 [concrete = constants.%Destroy.facet.aca]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn: <specific function> = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.aca) [concrete = constants.%SelfDestruct.specific_fn.f48]
|
||||
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%d.var)
|
||||
// CHECK:STDOUT: return <error> to %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc23_3.1(%self.param: ref %u32) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc44_3.1(%self.param: ref %u32) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc23_3.2(%self.param: ref %tuple.type.c35) {
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc44_3.2(%self.param: ref %tuple.type.c35) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
|
||||
// CHECK:STDOUT: %tuple.elem1: ref %u32 = tuple_access %self.param, element1
|
||||
// CHECK:STDOUT: %Destroy.facet.loc23_3.1: %Destroy.type = facet_value constants.%u32, (constants.%DestroyImpl.impl_witness.ee7, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.35c]
|
||||
// CHECK:STDOUT: %.loc23_3.1: %Destroy.type = converted constants.%u32, %Destroy.facet.loc23_3.1 [concrete = constants.%Destroy.facet.35c]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc23_3.2: %Destroy.type = facet_value constants.%u32, (constants.%DestroyImpl.impl_witness.ee7, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.35c]
|
||||
// CHECK:STDOUT: %.loc23_3.2: %Destroy.type = converted constants.%u32, %Destroy.facet.loc23_3.2 [concrete = constants.%Destroy.facet.35c]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc44_3.1: %Destroy.type = facet_value constants.%u32, (constants.%DestroyImpl.impl_witness.ee7, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.35c]
|
||||
// CHECK:STDOUT: %.loc44_3.1: %Destroy.type = converted constants.%u32, %Destroy.facet.loc44_3.1 [concrete = constants.%Destroy.facet.35c]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc44_3.2: %Destroy.type = facet_value constants.%u32, (constants.%DestroyImpl.impl_witness.ee7, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.35c]
|
||||
// CHECK:STDOUT: %.loc44_3.2: %Destroy.type = converted constants.%u32, %Destroy.facet.loc44_3.2 [concrete = constants.%Destroy.facet.35c]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn.1: <specific function> = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.35c) [concrete = constants.%SelfDestruct.specific_fn.a73]
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc23_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem1)
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc44_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem1)
|
||||
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
|
||||
// CHECK:STDOUT: %tuple.elem0: ref %AdaptCopyable = tuple_access %self.param, element0
|
||||
// CHECK:STDOUT: %Destroy.facet.loc23_3.3: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %.loc23_3.3: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc23_3.3 [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc23_3.4: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %.loc23_3.4: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc23_3.4 [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc44_3.3: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %.loc44_3.3: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc44_3.3 [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc44_3.4: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %.loc44_3.4: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc44_3.4 [concrete = constants.%Destroy.facet.11a]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn.2: <specific function> = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.11a) [concrete = constants.%SelfDestruct.specific_fn.97c]
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc23_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem0)
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc44_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem0)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -766,7 +823,7 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// 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.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc16_3.3 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc24_3.3 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.b80ef6.3: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.facet.7fa: %SubobjectDestroy.type = facet_value %AdaptNoncopyable, (%custom_witness.b80ef6.3) [concrete]
|
||||
@@ -838,28 +895,28 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// CHECK:STDOUT: %b.var: ref %AdaptNoncopyable = var_storage %b.var_patt
|
||||
// CHECK:STDOUT: %a.ref: %AdaptNoncopyable = name_ref a, %a
|
||||
// CHECK:STDOUT: assign %b.var, <error>
|
||||
// CHECK:STDOUT: %AdaptNoncopyable.ref.loc16: type = name_ref AdaptNoncopyable, file.%AdaptNoncopyable.decl [concrete = constants.%AdaptNoncopyable]
|
||||
// CHECK:STDOUT: %AdaptNoncopyable.ref.loc24: type = name_ref AdaptNoncopyable, file.%AdaptNoncopyable.decl [concrete = constants.%AdaptNoncopyable]
|
||||
// CHECK:STDOUT: %b: ref %AdaptNoncopyable = wrapper_binding b, %b.var
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %b.patt: %pattern_type.d14 = ref_binding_pattern b [concrete = constants.%b.patt]
|
||||
// CHECK:STDOUT: %b.var_patt: %pattern_type.d14 = var_pattern %b.patt [concrete = constants.%b.var_patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %b.ref: ref %AdaptNoncopyable = name_ref b, %b
|
||||
// CHECK:STDOUT: %.loc20: %AdaptNoncopyable = acquire_value %b.ref
|
||||
// CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%AdaptNoncopyable, (constants.%DestroyImpl.impl_witness.9f4, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %.loc16_3.1: %Destroy.type = converted constants.%AdaptNoncopyable, %Destroy.facet.loc16_3.1 [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc16_3.2: %Destroy.type = facet_value constants.%AdaptNoncopyable, (constants.%DestroyImpl.impl_witness.9f4, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %.loc16_3.2: %Destroy.type = converted constants.%AdaptNoncopyable, %Destroy.facet.loc16_3.2 [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %.loc34: %AdaptNoncopyable = acquire_value %b.ref
|
||||
// CHECK:STDOUT: %Destroy.facet.loc24_3.1: %Destroy.type = facet_value constants.%AdaptNoncopyable, (constants.%DestroyImpl.impl_witness.9f4, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %.loc24_3.1: %Destroy.type = converted constants.%AdaptNoncopyable, %Destroy.facet.loc24_3.1 [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc24_3.2: %Destroy.type = facet_value constants.%AdaptNoncopyable, (constants.%DestroyImpl.impl_witness.9f4, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %.loc24_3.2: %Destroy.type = converted constants.%AdaptNoncopyable, %Destroy.facet.loc24_3.2 [concrete = constants.%Destroy.facet]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn: <specific function> = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn]
|
||||
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%b.var)
|
||||
// CHECK:STDOUT: return <error> to %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.1(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc24_3.1(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.2(%self.param: ref %Noncopyable) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc24_3.2(%self.param: ref %Noncopyable) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.3(%self.param: ref %AdaptNoncopyable) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc24_3.3(%self.param: ref %AdaptNoncopyable) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_adapt_not_copyable_indirect.carbon
|
||||
// CHECK:STDOUT:
|
||||
@@ -906,10 +963,10 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// 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.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.1 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc27_3.1 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.1: %SubobjectDestroy.WithSelf.Op.type.6870fd.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.b80ef6.1: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.1), @SubobjectDestroy [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.3 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc27_3.3 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.b80ef6.3: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete]
|
||||
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
|
||||
@@ -923,7 +980,7 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// CHECK:STDOUT: %Destroy.facet.6f5: %Destroy.type = facet_value %Noncopyable, (%DestroyImpl.impl_witness.59b, %custom_witness.b80ef6.3) [concrete]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn.20b: <specific function> = specific_function %SelfDestruct, @SelfDestruct(%Destroy.facet.6f5) [concrete]
|
||||
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.5: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.5 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.5: type = fn_type @SubobjectDestroy.WithSelf.Op.loc27_3.5 [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.5: %SubobjectDestroy.WithSelf.Op.type.6870fd.5 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.b80ef6.5: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.5), @SubobjectDestroy [concrete]
|
||||
// CHECK:STDOUT: %SubobjectDestroy.facet.e5e: %SubobjectDestroy.type = facet_value %AdaptNoncopyableIndirect, (%custom_witness.b80ef6.5) [concrete]
|
||||
@@ -1002,83 +1059,83 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %b.var: ref %AdaptNoncopyableIndirect = var_storage %b.var_patt
|
||||
// CHECK:STDOUT: %a.ref: %AdaptNoncopyableIndirect = name_ref a, %a
|
||||
// CHECK:STDOUT: %.loc17_3.1: %tuple.type.71d = as_compatible %a.ref
|
||||
// CHECK:STDOUT: %tuple.elem0.loc17_3.1: %i32 = tuple_access %.loc17_3.1, element0
|
||||
// CHECK:STDOUT: %impl.elem0.loc17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae]
|
||||
// CHECK:STDOUT: %bound_method.loc17_3.1: <bound method> = bound_method %tuple.elem0.loc17_3.1, %impl.elem0.loc17
|
||||
// CHECK:STDOUT: %specific_fn.loc17: <specific function> = specific_function %impl.elem0.loc17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc17_3.2: <bound method> = bound_method %tuple.elem0.loc17_3.1, %specific_fn.loc17
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc17: init %i32 = call %bound_method.loc17_3.2(%tuple.elem0.loc17_3.1)
|
||||
// CHECK:STDOUT: %.loc17_3.2: ref %tuple.type.71d = as_compatible %b.var
|
||||
// CHECK:STDOUT: %tuple.elem0.loc17_3.2: ref %i32 = tuple_access %.loc17_3.2, element0
|
||||
// CHECK:STDOUT: %.loc17_3.3: init %i32 to %tuple.elem0.loc17_3.2 = in_place_init %Int.as.Copy.impl.Op.call.loc17
|
||||
// CHECK:STDOUT: %tuple.elem1.loc17: %Noncopyable = tuple_access %.loc17_3.1, element1
|
||||
// CHECK:STDOUT: %.loc27_3.1: %tuple.type.71d = as_compatible %a.ref
|
||||
// CHECK:STDOUT: %tuple.elem0.loc27_3.1: %i32 = tuple_access %.loc27_3.1, element0
|
||||
// CHECK:STDOUT: %impl.elem0.loc27: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae]
|
||||
// CHECK:STDOUT: %bound_method.loc27_3.1: <bound method> = bound_method %tuple.elem0.loc27_3.1, %impl.elem0.loc27
|
||||
// CHECK:STDOUT: %specific_fn.loc27: <specific function> = specific_function %impl.elem0.loc27, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc27_3.2: <bound method> = bound_method %tuple.elem0.loc27_3.1, %specific_fn.loc27
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc27: init %i32 = call %bound_method.loc27_3.2(%tuple.elem0.loc27_3.1)
|
||||
// CHECK:STDOUT: %.loc27_3.2: ref %tuple.type.71d = as_compatible %b.var
|
||||
// CHECK:STDOUT: %tuple.elem0.loc27_3.2: ref %i32 = tuple_access %.loc27_3.2, element0
|
||||
// CHECK:STDOUT: %.loc27_3.3: init %i32 to %tuple.elem0.loc27_3.2 = in_place_init %Int.as.Copy.impl.Op.call.loc27
|
||||
// CHECK:STDOUT: %tuple.elem1.loc27: %Noncopyable = tuple_access %.loc27_3.1, element1
|
||||
// CHECK:STDOUT: assign %b.var, <error>
|
||||
// CHECK:STDOUT: %AdaptNoncopyableIndirect.ref.loc17: type = name_ref AdaptNoncopyableIndirect, file.%AdaptNoncopyableIndirect.decl [concrete = constants.%AdaptNoncopyableIndirect]
|
||||
// CHECK:STDOUT: %AdaptNoncopyableIndirect.ref.loc27: type = name_ref AdaptNoncopyableIndirect, file.%AdaptNoncopyableIndirect.decl [concrete = constants.%AdaptNoncopyableIndirect]
|
||||
// CHECK:STDOUT: %b: ref %AdaptNoncopyableIndirect = wrapper_binding b, %b.var
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %b.patt: %pattern_type.be3 = ref_binding_pattern b [concrete = constants.%b.patt]
|
||||
// CHECK:STDOUT: %b.var_patt: %pattern_type.be3 = var_pattern %b.patt [concrete = constants.%b.var_patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %b.ref: ref %AdaptNoncopyableIndirect = name_ref b, %b
|
||||
// CHECK:STDOUT: %.loc22_11.1: ref %tuple.type.71d = as_compatible %b.ref
|
||||
// CHECK:STDOUT: %tuple.elem0.loc22_11.1: ref %i32 = tuple_access %.loc22_11.1, element0
|
||||
// CHECK:STDOUT: %.loc22_11.2: %i32 = acquire_value %tuple.elem0.loc22_11.1
|
||||
// CHECK:STDOUT: %impl.elem0.loc22: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae]
|
||||
// CHECK:STDOUT: %bound_method.loc22_11.1: <bound method> = bound_method %.loc22_11.2, %impl.elem0.loc22
|
||||
// CHECK:STDOUT: %specific_fn.loc22: <specific function> = specific_function %impl.elem0.loc22, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc22_11.2: <bound method> = bound_method %.loc22_11.2, %specific_fn.loc22
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc22: init %i32 = call %bound_method.loc22_11.2(%.loc22_11.2)
|
||||
// CHECK:STDOUT: %.loc22_11.3: ref %tuple.type.71d = as_compatible %return.param
|
||||
// CHECK:STDOUT: %tuple.elem0.loc22_11.2: ref %i32 = tuple_access %.loc22_11.3, element0
|
||||
// CHECK:STDOUT: %.loc22_11.4: init %i32 to %tuple.elem0.loc22_11.2 = in_place_init %Int.as.Copy.impl.Op.call.loc22
|
||||
// CHECK:STDOUT: %tuple.elem1.loc22: ref %Noncopyable = tuple_access %.loc22_11.1, element1
|
||||
// CHECK:STDOUT: %.loc22_11.5: %Noncopyable = acquire_value %tuple.elem1.loc22
|
||||
// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%AdaptNoncopyableIndirect, (constants.%DestroyImpl.impl_witness.860, constants.%custom_witness.b80ef6.5) [concrete = constants.%Destroy.facet.1f2]
|
||||
// CHECK:STDOUT: %.loc17_3.4: %Destroy.type = converted constants.%AdaptNoncopyableIndirect, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.1f2]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%AdaptNoncopyableIndirect, (constants.%DestroyImpl.impl_witness.860, constants.%custom_witness.b80ef6.5) [concrete = constants.%Destroy.facet.1f2]
|
||||
// CHECK:STDOUT: %.loc17_3.5: %Destroy.type = converted constants.%AdaptNoncopyableIndirect, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.1f2]
|
||||
// CHECK:STDOUT: %.loc38_11.1: ref %tuple.type.71d = as_compatible %b.ref
|
||||
// CHECK:STDOUT: %tuple.elem0.loc38_11.1: ref %i32 = tuple_access %.loc38_11.1, element0
|
||||
// CHECK:STDOUT: %.loc38_11.2: %i32 = acquire_value %tuple.elem0.loc38_11.1
|
||||
// CHECK:STDOUT: %impl.elem0.loc38: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae]
|
||||
// CHECK:STDOUT: %bound_method.loc38_11.1: <bound method> = bound_method %.loc38_11.2, %impl.elem0.loc38
|
||||
// CHECK:STDOUT: %specific_fn.loc38: <specific function> = specific_function %impl.elem0.loc38, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc38_11.2: <bound method> = bound_method %.loc38_11.2, %specific_fn.loc38
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc38: init %i32 = call %bound_method.loc38_11.2(%.loc38_11.2)
|
||||
// CHECK:STDOUT: %.loc38_11.3: ref %tuple.type.71d = as_compatible %return.param
|
||||
// CHECK:STDOUT: %tuple.elem0.loc38_11.2: ref %i32 = tuple_access %.loc38_11.3, element0
|
||||
// CHECK:STDOUT: %.loc38_11.4: init %i32 to %tuple.elem0.loc38_11.2 = in_place_init %Int.as.Copy.impl.Op.call.loc38
|
||||
// CHECK:STDOUT: %tuple.elem1.loc38: ref %Noncopyable = tuple_access %.loc38_11.1, element1
|
||||
// CHECK:STDOUT: %.loc38_11.5: %Noncopyable = acquire_value %tuple.elem1.loc38
|
||||
// CHECK:STDOUT: %Destroy.facet.loc27_3.1: %Destroy.type = facet_value constants.%AdaptNoncopyableIndirect, (constants.%DestroyImpl.impl_witness.860, constants.%custom_witness.b80ef6.5) [concrete = constants.%Destroy.facet.1f2]
|
||||
// CHECK:STDOUT: %.loc27_3.4: %Destroy.type = converted constants.%AdaptNoncopyableIndirect, %Destroy.facet.loc27_3.1 [concrete = constants.%Destroy.facet.1f2]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc27_3.2: %Destroy.type = facet_value constants.%AdaptNoncopyableIndirect, (constants.%DestroyImpl.impl_witness.860, constants.%custom_witness.b80ef6.5) [concrete = constants.%Destroy.facet.1f2]
|
||||
// CHECK:STDOUT: %.loc27_3.5: %Destroy.type = converted constants.%AdaptNoncopyableIndirect, %Destroy.facet.loc27_3.2 [concrete = constants.%Destroy.facet.1f2]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn: <specific function> = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.1f2) [concrete = constants.%SelfDestruct.specific_fn.0b6]
|
||||
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%b.var)
|
||||
// CHECK:STDOUT: return <error> to %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.1(%self.param: ref %i32) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.1(%self.param: ref %i32) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.2(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.2(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.3(%self.param: ref %Noncopyable) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.3(%self.param: ref %Noncopyable) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.4(%self.param: ref %tuple.type.71d) {
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.4(%self.param: ref %tuple.type.71d) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
|
||||
// CHECK:STDOUT: %tuple.elem2: ref %i32 = tuple_access %self.param, element2
|
||||
// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %.loc17_3.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc27_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %.loc27_3.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.1 [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc27_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %.loc27_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.2 [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn.1: <specific function> = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.c2b) [concrete = constants.%SelfDestruct.specific_fn.845]
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc17_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem2)
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc27_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem2)
|
||||
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
|
||||
// CHECK:STDOUT: %tuple.elem1: ref %Noncopyable = tuple_access %self.param, element1
|
||||
// CHECK:STDOUT: %Destroy.facet.loc17_3.3: %Destroy.type = facet_value constants.%Noncopyable, (constants.%DestroyImpl.impl_witness.59b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.6f5]
|
||||
// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%Noncopyable, %Destroy.facet.loc17_3.3 [concrete = constants.%Destroy.facet.6f5]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc17_3.4: %Destroy.type = facet_value constants.%Noncopyable, (constants.%DestroyImpl.impl_witness.59b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.6f5]
|
||||
// CHECK:STDOUT: %.loc17_3.4: %Destroy.type = converted constants.%Noncopyable, %Destroy.facet.loc17_3.4 [concrete = constants.%Destroy.facet.6f5]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc27_3.3: %Destroy.type = facet_value constants.%Noncopyable, (constants.%DestroyImpl.impl_witness.59b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.6f5]
|
||||
// CHECK:STDOUT: %.loc27_3.3: %Destroy.type = converted constants.%Noncopyable, %Destroy.facet.loc27_3.3 [concrete = constants.%Destroy.facet.6f5]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc27_3.4: %Destroy.type = facet_value constants.%Noncopyable, (constants.%DestroyImpl.impl_witness.59b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.6f5]
|
||||
// CHECK:STDOUT: %.loc27_3.4: %Destroy.type = converted constants.%Noncopyable, %Destroy.facet.loc27_3.4 [concrete = constants.%Destroy.facet.6f5]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn.2: <specific function> = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.6f5) [concrete = constants.%SelfDestruct.specific_fn.20b]
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc17_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem1)
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc27_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem1)
|
||||
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
|
||||
// CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %self.param, element0
|
||||
// CHECK:STDOUT: %Destroy.facet.loc17_3.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %.loc17_3.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.5 [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc17_3.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %.loc17_3.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.6 [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc27_3.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %.loc27_3.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.5 [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc27_3.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %.loc27_3.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.6 [concrete = constants.%Destroy.facet.c2b]
|
||||
// CHECK:STDOUT: %SelfDestruct.specific_fn.3: <specific function> = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.c2b) [concrete = constants.%SelfDestruct.specific_fn.845]
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc17_3.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%tuple.elem0)
|
||||
// CHECK:STDOUT: %SelfDestruct.call.loc27_3.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%tuple.elem0)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.5(%self.param: ref %AdaptNoncopyableIndirect) = "no_op";
|
||||
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.5(%self.param: ref %AdaptNoncopyableIndirect) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- adapt_copyable_struct.carbon
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -52,8 +52,16 @@ class Adapter(T: type);
|
||||
class X {}
|
||||
|
||||
fn F(p: Adapter(X)*) {
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:22-29: error: cannot convert expression of type `Adapter(X)` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:22-29: note: type `Adapter(X)` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+11]]:22
|
||||
// CHECK:STDERR: -> │ let unused x: X* = *p as X*;
|
||||
// CHECK:STDERR: · ┳━━━━━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Adapter(X)`
|
||||
// CHECK:STDERR: · │ ┃ to `X*` with `as`
|
||||
// CHECK:STDERR: · │ ┃ [ConversionFailure]
|
||||
// CHECK:STDERR: · ╰────┤ type `Adapter(X)` does not implement interface
|
||||
// CHECK:STDERR: · │ `Core.As(X*)`
|
||||
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
let unused x: X* = *p as X*;
|
||||
}
|
||||
Loaded 100 of 888 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user