Replace :! binding syntax with phase keywords and contextual defaults (#7479)

Implement the toolchain side of proposal #7254, removing the `:!`
binding
syntax for generic and template parameters in favor of the keywords
`generic`,
`template`, and `runtime` plus contextual defaults for phase.

For valid programs this is semantics-preserving: each binding resolves
to the
same phase, and produces the same SemIR, as it did under `:!`/`:`. The
parser
derives a binding's phase from its syntactic context plus any explicit
phase
keyword; new diagnostics and error recovery for misused keywords are
described
below.

Implementation details for each component:

- Lexer: remove the `:!` (`ColonExclaim`) token, move its virtual
parse-node
  budget onto `:`, and add the `generic` and `runtime` keywords.
- Parser: thread a `BindingContext` (`ExplicitParam`, `DeducedParam`, or
`CompileTimeEntityParam`) from declaration introducers down through
parameter
lists to each binding pattern, using a one-token lookahead to
distinguish a
name-qualifier parameter list from a declaration's own final list.
Parameters
of a compile-time entity (`class`, `interface`, `constraint`, `choice`,
`alias`, `export`, `namespace`) and deduced `[]` parameters default to
checked
generic; explicit function parameters and local bindings default to
runtime.
`HandleBindingPattern` resolves the phase from that context plus the
keyword: a
`generic` keyword needs no node of its own (the phase is carried by the
  binding's node kind), while a `runtime` keyword is preserved as a
`RuntimeBindingName` node so `check` can name it in a diagnostic. A
phase
keyword that is merely redundant with the contextual default is
diagnosed
  here, without invalidating the parse tree.
- Check: a phase keyword that is invalid for its context (for example
`runtime`
on a checked-generic parameter) is diagnosed here, and recovers by
building an
error binding that still introduces the name so that later uses of it do
not
  produce cascading errors.

The removed `:!` syntax is now rejected as an ordinary parse error.

The `form`/`:?`/`->?` ("extended types") portion of proposal #7254 is
left for a
separate change.

Assisted-by: Claude Code
This commit is contained in:
Chandler Carruth
2026-07-11 01:22:44 +00:00
committed by GitHub
parent bf106c3b4b
commit 8be274cf60
482 changed files with 16917 additions and 16226 deletions
+5 -5
View File
@@ -19,7 +19,7 @@ private alias FloatLiteral = MakeFloatLiteral();
private fn MakeIntLiteral() -> type = "int_literal.make_type";
private alias IntLiteral = MakeIntLiteral();
impl forall [T:! Copy] const T as Copy {
impl forall [T: Copy] const T as Copy {
fn Op(self) -> Self { return (self as T).(Copy.Op)() as const T; }
}
@@ -43,7 +43,7 @@ impl type as Copy {
fn Op(self) -> Self = "primitive_copy";
}
impl forall [T:! type] T* as Copy {
impl forall [T: type] T* as Copy {
fn Op(self) -> Self = "primitive_copy";
}
@@ -52,19 +52,19 @@ impl () as Copy {
fn Op(self) -> Self = "no_op";
}
impl forall [T:! Copy] (T,) as Copy {
impl forall [T: Copy] (T,) as Copy {
fn Op(self) -> Self {
return (self.0.Op(),);
}
}
impl forall [T:! Copy, U:! Copy] (T, U) as Copy {
impl forall [T: Copy, U: Copy] (T, U) as Copy {
fn Op(self) -> Self {
return (self.0.Op(), self.1.Op());
}
}
impl forall [T:! Copy, U:! Copy, V:! Copy] (T, U, V) as Copy {
impl forall [T: Copy, U: Copy, V: Copy] (T, U, V) as Copy {
fn Op(self) -> Self {
return (self.0.Op(), self.1.Op(), self.2.Op());
}
+5 -5
View File
@@ -17,7 +17,7 @@ interface Default { fn Op() -> Self; }
// other operations on the object except for reinitialization are permitted.
interface UnformedInit {
// TODO: This should probably be:
// let StructT:! type;
// let StructT: type;
// fn Op() -> StructT;
// and should be able to initialize a subset of the fields. For now we always
// leave the object uninitialized when it is in an unformed state.
@@ -28,8 +28,8 @@ interface UnformedInit {
// orphan rule because these builtin types have no associated library of their
// own.
impl bool as UnformedInit {}
impl forall [T:! type] T* as UnformedInit {}
impl forall [T:! UnformedInit, N:! IntLiteral] array(T, N) as UnformedInit {}
impl forall [T: type] T* as UnformedInit {}
impl forall [T: UnformedInit, N: IntLiteral] array(T, N) as UnformedInit {}
// TODO: Generalize these to apply to tuples and structs containing only
// `UnformedInit` types.
impl () as UnformedInit {}
@@ -43,12 +43,12 @@ interface DefaultOrUnformed {
fn Op() -> Self;
}
final impl forall [T:! Default] T as DefaultOrUnformed {
final impl forall [T: Default] T as DefaultOrUnformed {
fn Op() -> Self {
return T.(Default.Op)();
}
}
impl forall [T:! UnformedInit] T as DefaultOrUnformed {
impl forall [T: UnformedInit] T as DefaultOrUnformed {
fn Op() -> Self = "make_uninitialized";
}
+6 -6
View File
@@ -11,13 +11,13 @@ export import library "prelude/operators";
interface Iterate {
// TODO: Support iterating ranges of non-copyable values.
let ElementType:! Copy & Destroy;
let CursorType:! Destroy;
let ElementType: Copy & Destroy;
let CursorType: Destroy;
fn NewCursor(self) -> CursorType;
fn Next(self, cursor: CursorType*) -> Optional(ElementType);
}
impl forall [T:! Copy & Destroy, N:! IntLiteral]
impl forall [T: Copy & Destroy, N: IntLiteral]
array(T, N) as Iterate
where .ElementType = T and .CursorType = i32 {
fn NewCursor(unused self) -> i32 { return 0; }
@@ -32,8 +32,8 @@ impl forall [T:! Copy & Destroy, N:! IntLiteral]
}
interface CppRangeForIterate {
let Iterator:! type;
let Sentinel:! type;
let Iterator: type;
let Sentinel: type;
// TODO: self must be ref-qualified
fn Begin(self) -> Iterator;
@@ -41,7 +41,7 @@ interface CppRangeForIterate {
}
impl forall [
R:! CppRangeForIterate where
R: CppRangeForIterate where
.Iterator impls Copy & Destroy & CppUnsafeDeref & Inc & EqWith(.Sentinel) and
.Iterator.(CppUnsafeDeref.Result) impls Copy & Destroy and
.Sentinel impls Copy & Destroy
+17 -17
View File
@@ -10,7 +10,7 @@ import library "prelude/types/int_literal";
// TODO: Per the design, the associated type `Result` in each of these
// interfaces should have a default value of `Self`:
//
// default let Result:! type = Self;
// default let Result: type = Self;
// TODO: Per the design, for each *With interface there should also be a
// non-With named constraint, such as:
@@ -20,13 +20,13 @@ import library "prelude/types/int_literal";
// }
// Addition: `a + b`.
interface AddWith(Other:! type) {
let Result:! type;
interface AddWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Addition with assignment: `a += b`.
interface AddAssignWith(Other:! type) {
interface AddAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
@@ -37,18 +37,18 @@ interface Inc {
// Negation: `-a`.
interface Negate {
let Result:! type;
let Result: type;
fn Op(self) -> Result;
}
// Subtraction: `a - b`.
interface SubWith(Other:! type) {
let Result:! type;
interface SubWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Subtraction with assignment: `a -= b`.
interface SubAssignWith(Other:! type) {
interface SubAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
@@ -58,35 +58,35 @@ interface Dec {
}
// Multiplication: `a * b`.
interface MulWith(Other:! type) {
let Result:! type;
interface MulWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Multiplication with assignment: `a *= b`.
interface MulAssignWith(Other:! type) {
interface MulAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
// Division: `a / b`.
interface DivWith(Other:! type) {
let Result:! type;
interface DivWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Division with assignment: `a /= b`.
interface DivAssignWith(Other:! type) {
interface DivAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
// Modulo: `a % b`.
interface ModWith(Other:! type) {
let Result:! type;
interface ModWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Modulo with assignment: `a %= b`.
interface ModAssignWith(Other:! type) {
interface ModAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
+13 -13
View File
@@ -9,58 +9,58 @@ import library "prelude/types/char_literal";
import library "prelude/types/int_literal";
import library "prelude/types/float_literal";
interface UnsafeAs(Dest:! type) {
interface UnsafeAs(Dest: type) {
fn Convert(self) -> Dest;
}
interface As(Dest:! type) {
interface As(Dest: type) {
// TODO: extend UnsafeAs(Dest);
fn Convert(self) -> Dest;
}
interface ImplicitAs(Dest:! type) {
interface ImplicitAs(Dest: type) {
// TODO: extend As(Dest);
fn Convert(self) -> Dest;
}
// Workaround: ImplicitAs extends As.
impl forall [U:! type, T:! ImplicitAs(U)] T as As(U) {
impl forall [U: type, T: ImplicitAs(U)] T as As(U) {
fn Convert(self) -> U { return self.Convert(); }
}
// Workaround: As extends UnsafeAs.
impl forall [U:! type, T:! As(U)] T as UnsafeAs(U) {
impl forall [U: type, T: As(U)] T as UnsafeAs(U) {
fn Convert(self) -> U { return self.Convert(); }
}
// Copyable types have an identity conversion that performs a copy.
impl forall [T:! Copy] T as ImplicitAs(T) {
impl forall [T: Copy] T as ImplicitAs(T) {
fn Convert(self) -> Self { return self.(Copy.Op)(); }
}
// `const` can be added and removed when converting a value.
impl forall [T:! type, U:! ImplicitAs(T)] U as ImplicitAs(const T) {
impl forall [T: type, U: ImplicitAs(T)] U as ImplicitAs(const T) {
fn Convert(self) -> const T { return self.Convert(); }
}
impl forall [T:! type, U:! ImplicitAs(T)] const U as ImplicitAs(T) {
impl forall [T: type, U: ImplicitAs(T)] const U as ImplicitAs(T) {
fn Convert(self) -> T { return (self as U).Convert(); }
}
// `const` can be added to a pointer.
// TODO: This is also provided as a builtin conversion. We provide it here so
// that Optional(T*) can implicitly convert to Optional(const T*). See #5750.
impl forall [T:! type] T* as ImplicitAs(const T*) {
impl forall [T: type] T* as ImplicitAs(const T*) {
fn Convert(self) -> const T* = "pointer.unsafe_convert";
}
impl forall [T:! type] T* as As(const T*) {
impl forall [T: type] T* as As(const T*) {
fn Convert(self) -> const T* = "pointer.unsafe_convert";
}
// Pointer types can be unsafely cast to other pointer types.
// TODO: Should `unsafe as` be able to remove `const`?
impl forall [T:! type, U:! type] T* as UnsafeAs(U*) {
impl forall [T: type, U: type] T* as UnsafeAs(U*) {
fn Convert(self) -> U* = "pointer.unsafe_convert";
}
@@ -80,5 +80,5 @@ impl IntLiteral as As(CharLiteral) {
}
interface IntFitsIn(Dest:! type) {}
interface FloatFitsIn(Src:! type) {}
interface IntFitsIn(Dest: type) {}
interface FloatFitsIn(Src: type) {}
+17 -17
View File
@@ -9,7 +9,7 @@ import library "prelude/types/int_literal";
// TODO: Per the design, the associated type `Result` in each of these
// interfaces should have a default value of `Self`:
//
// default let Result:! type = Self;
// default let Result: type = Self;
// TODO: Per the design, for each *With interface there should also be a
// non-With named constraint, such as:
@@ -20,62 +20,62 @@ import library "prelude/types/int_literal";
// Bit complement: `^a`.
interface BitComplement {
let Result:! type;
let Result: type;
fn Op(self) -> Result;
}
// Bitwise AND: `a & b`.
interface BitAndWith(Other:! type) {
let Result:! type;
interface BitAndWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Bitwise AND with assignment: `a &= b`.
interface BitAndAssignWith(Other:! type) {
interface BitAndAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
// Bitwise OR: `a | b`.
interface BitOrWith(Other:! type) {
let Result:! type;
interface BitOrWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Bitwise OR with assignment: `a |= b`.
interface BitOrAssignWith(Other:! type) {
interface BitOrAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
// Bitwise XOR: `a ^ b`.
interface BitXorWith(Other:! type) {
let Result:! type;
interface BitXorWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Bitwise XOR with assignment: `a ^= b`.
interface BitXorAssignWith(Other:! type) {
interface BitXorAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
// Left shift: `a << b`.
interface LeftShiftWith(Other:! type) {
let Result:! type;
interface LeftShiftWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Left shift with assignment: `a <<= b`.
interface LeftShiftAssignWith(Other:! type) {
interface LeftShiftAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
// Right shift: `a >> b`.
interface RightShiftWith(Other:! type) {
let Result:! type;
interface RightShiftWith(Other: type) {
let Result: type;
fn Op(self, other: Other) -> Result;
}
// Right shift with assignment: `a >>= b`.
interface RightShiftAssignWith(Other:! type) {
interface RightShiftAssignWith(Other: type) {
fn Op(ref self, other: Other);
}
+2 -2
View File
@@ -15,13 +15,13 @@ import library "prelude/types/int_literal";
// }
// Equality comparison: `a == b` and `a != b`.
interface EqWith(Other:! type) {
interface EqWith(Other: type) {
fn Equal(self, other: Other) -> bool;
fn NotEqual(self, other: Other) -> bool;
}
// Relational comparison: `a < b`, `a <= b`, `a > b`, `a >= b`.
interface OrderedWith(Other:! type) {
interface OrderedWith(Other: type) {
// TODO: fn Compare
fn Less(self, other: Other) -> bool;
fn LessOrEquivalent(self, other: Other) -> bool;
+1 -1
View File
@@ -6,6 +6,6 @@ package Core library "prelude/operators/deref";
// TODO: Align with https://docs.carbon-lang.dev/docs/design/values.html#dereferencing-customization.
interface CppUnsafeDeref {
let Result:! type;
let Result: type;
fn Op(self) -> Result;
}
+2 -2
View File
@@ -4,7 +4,7 @@
package Core library "prelude/operators/index";
interface IndexWith(SubscriptType:! type) {
let ElementType:! type;
interface IndexWith(SubscriptType: type) {
let ElementType: type;
fn At(self, subscript: SubscriptType) -> ElementType;
}
+13 -13
View File
@@ -34,11 +34,11 @@ impl CharLiteral as As(Char) {
fn Convert(self) -> Char = "char_literal.convert_char";
}
impl forall [From:! IntLiteral] UInt(From) as As(Char) {
impl forall [From: IntLiteral] UInt(From) as As(Char) {
fn Convert(self) -> Char = "int.convert_char";
}
// `char` explicitly converts to any type that `u8` implicitly converts to.
impl forall [T:! type where u8 impls ImplicitAs(.Self)] Char as As(T) {
impl forall [T: type where u8 impls ImplicitAs(.Self)] Char as As(T) {
fn Convert(self) -> T {
return self as u8;
}
@@ -58,24 +58,24 @@ impl Char as OrderedWith(Char) {
fn GreaterOrEquivalent(self, other: Char) -> bool = "int.greater_eq";
}
impl forall [T:! ImplicitAs(Char)] Char as EqWith(T) {
impl forall [T: ImplicitAs(Char)] Char as EqWith(T) {
fn Equal(self, other: Char) -> bool = "int.eq";
fn NotEqual(self, other: Char) -> bool = "int.neq";
}
impl forall [T:! ImplicitAs(Char)] Char as OrderedWith(T) {
impl forall [T: ImplicitAs(Char)] Char as OrderedWith(T) {
fn Less(self, other: Char) -> bool = "int.less";
fn LessOrEquivalent(self, other: Char) -> bool = "int.less_eq";
fn Greater(self, other: Char) -> bool = "int.greater";
fn GreaterOrEquivalent(self, other: Char) -> bool = "int.greater_eq";
}
impl forall [T:! ImplicitAs(Char)] T as EqWith(Char) {
impl forall [T: ImplicitAs(Char)] T as EqWith(Char) {
fn Equal(self: Char, other: Char) -> bool = "int.eq";
fn NotEqual(self: Char, other: Char) -> bool = "int.neq";
}
impl forall [T:! ImplicitAs(Char)] T as OrderedWith(Char) {
impl forall [T: ImplicitAs(Char)] T as OrderedWith(Char) {
fn Less(self: Char, other: Char) -> bool = "int.less";
fn LessOrEquivalent(self: Char, other: Char) -> bool = "int.less_eq";
fn Greater(self: Char, other: Char) -> bool = "int.greater";
@@ -86,10 +86,10 @@ impl forall [T:! ImplicitAs(Char)] T as OrderedWith(Char) {
private interface AnyInt {}
impl forall [N:! IntLiteral] Int(N) as AnyInt {}
impl forall [N:! IntLiteral] UInt(N) as AnyInt {}
impl forall [N: IntLiteral] Int(N) as AnyInt {}
impl forall [N: IntLiteral] UInt(N) as AnyInt {}
impl forall [T:! AnyInt & As(u8)]
impl forall [T: AnyInt & As(u8)]
Char as AddWith(T) where .Result = Char {
fn Op(self, other: T) -> Self {
// TODO: This should be erroneous if the addition overflows.
@@ -97,7 +97,7 @@ impl forall [T:! AnyInt & As(u8)]
}
}
impl forall [T:! AnyInt & As(u8)]
impl forall [T: AnyInt & As(u8)]
T as AddWith(Char) where .Result = Char {
fn Op(self, other: Char) -> Char {
// TODO: This should be erroneous if the addition overflows.
@@ -105,7 +105,7 @@ impl forall [T:! AnyInt & As(u8)]
}
}
final impl forall [T:! AnyInt & As(u8)]
final impl forall [T: AnyInt & As(u8)]
Char as SubWith(T) where .Result = Char {
fn Op(self, other: T) -> Self {
// TODO: This should be erroneous if the addition overflows.
@@ -119,13 +119,13 @@ impl Char as SubWith(Char) where .Result = i32 {
}
}
impl forall [T:! ImplicitAs(Char)] T as SubWith(Char) where .Result = i32 {
impl forall [T: ImplicitAs(Char)] T as SubWith(Char) where .Result = i32 {
fn Op(self: Char, other: Char) -> i32 {
return (self as i32) - (other as i32);
}
}
impl forall [T:! ImplicitAs(Char)] Char as SubWith(T) where .Result = i32 {
impl forall [T: ImplicitAs(Char)] Char as SubWith(T) where .Result = i32 {
fn Op(self, other: Char) -> i32 {
return (self as i32) - (other as i32);
}
+68 -68
View File
@@ -199,25 +199,25 @@ final impl CppCompat.LongLong64 as OrderedWith(CppCompat.LongLong64) {
// - CppCompat.T on left-hand side.
impl forall [T:! ImplicitAs(CppCompat.Long32)] CppCompat.Long32 as EqWith(T) {
impl forall [T: ImplicitAs(CppCompat.Long32)] CppCompat.Long32 as EqWith(T) {
fn Equal(self, other: Self) -> bool = "int.eq";
fn NotEqual(self, other: Self) -> bool = "int.neq";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)] CppCompat.Long32 as OrderedWith(T) {
impl forall [T: ImplicitAs(CppCompat.Long32)] CppCompat.Long32 as OrderedWith(T) {
fn Less(self, other: Self) -> bool = "int.less";
fn LessOrEquivalent(self, other: Self) -> bool = "int.less_eq";
fn Greater(self, other: Self) -> bool = "int.greater";
fn GreaterOrEquivalent(self, other: Self) -> bool = "int.greater_eq";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as EqWith(T) {
fn Equal(self, other: Self) -> bool = "int.eq";
fn NotEqual(self, other: Self) -> bool = "int.neq";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as OrderedWith(T) {
fn Less(self, other: Self) -> bool = "int.less";
fn LessOrEquivalent(self, other: Self) -> bool = "int.less_eq";
@@ -227,19 +227,19 @@ impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
// - CppCompat.T on right-hand side.
impl forall [T:! ImplicitAs(CppCompat.Long32)] T as EqWith(CppCompat.Long32) {
impl forall [T: ImplicitAs(CppCompat.Long32)] T as EqWith(CppCompat.Long32) {
fn Equal(self: CppCompat.Long32, other: CppCompat.Long32) -> bool = "int.eq";
fn NotEqual(self: CppCompat.Long32, other: CppCompat.Long32) -> bool = "int.neq";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)] T as OrderedWith(CppCompat.Long32) {
impl forall [T: ImplicitAs(CppCompat.Long32)] T as OrderedWith(CppCompat.Long32) {
fn Less(self: CppCompat.Long32, other: CppCompat.Long32) -> bool = "int.less";
fn LessOrEquivalent(self: CppCompat.Long32, other: CppCompat.Long32) -> bool = "int.less_eq";
fn Greater(self: CppCompat.Long32, other: CppCompat.Long32) -> bool = "int.greater";
fn GreaterOrEquivalent(self: CppCompat.Long32, other: CppCompat.Long32) -> bool = "int.greater_eq";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as EqWith(CppCompat.LongLong64) {
fn Equal(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> bool = "int.eq";
@@ -247,7 +247,7 @@ impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
other: CppCompat.LongLong64) -> bool = "int.neq";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as OrderedWith(CppCompat.LongLong64) {
fn Less(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> bool = "int.less";
@@ -321,58 +321,58 @@ final impl CppCompat.LongLong64 as ModWith(Self) where .Result = Self {
// - CppCompat.Long32 on left-hand side.
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as AddWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.sadd";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as SubWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.ssub";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as MulWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.smul";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as DivWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.sdiv";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as ModWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.smod";
}
// - CppCompat.LongLong64 on left-hand side.
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as AddWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.sadd";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as SubWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.ssub";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as MulWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.smul";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as DivWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.sdiv";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as ModWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.smod";
@@ -380,58 +380,58 @@ impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
// - CppCompat.Long32 on right-hand side.
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as AddWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.sadd";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as SubWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.ssub";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as MulWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.smul";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as DivWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.sdiv";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as ModWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32, other: CppCompat.Long32) -> CppCompat.Long32 = "int.smod";
}
// - CppCompat.LongLong64 on right-hand side.
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as AddWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.sadd";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as SubWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.ssub";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as MulWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.smul";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as DivWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.sdiv";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as ModWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.smod";
@@ -499,31 +499,31 @@ final impl CppCompat.LongLong64 as RightShiftWith(Self) where .Result = Self {
// - CppCompat.Long32 on left-hand side.
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as BitAndWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other:CppCompat.Long32) -> CppCompat.Long32 = "int.and";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as BitOrWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other: CppCompat.Long32) -> CppCompat.Long32 = "int.or";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as BitXorWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other: CppCompat.Long32) -> CppCompat.Long32 = "int.xor";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as LeftShiftWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other: CppCompat.Long32) -> CppCompat.Long32 = "int.left_shift";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as RightShiftWith(T) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other: CppCompat.Long32) -> CppCompat.Long32 = "int.right_shift";
@@ -531,31 +531,31 @@ impl forall [T:! ImplicitAs(CppCompat.Long32)]
// - CppCompat.LongLong64 on left-hand side.
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as BitAndWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other:CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.and";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as BitOrWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.or";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as BitXorWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.xor";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as LeftShiftWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.left_shift";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as RightShiftWith(T) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.right_shift";
@@ -563,31 +563,31 @@ impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
// - CppCompat.Long32 on right-hand side.
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as BitAndWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other: CppCompat.Long32) -> CppCompat.Long32 = "int.and";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as BitOrWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other: CppCompat.Long32) -> CppCompat.Long32 = "int.or";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as BitXorWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other: CppCompat.Long32) -> CppCompat.Long32 = "int.xor";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as LeftShiftWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other: CppCompat.Long32) -> CppCompat.Long32 = "int.left_shift";
}
impl forall [T:! ImplicitAs(CppCompat.Long32)]
impl forall [T: ImplicitAs(CppCompat.Long32)]
T as RightShiftWith(CppCompat.Long32) where .Result = CppCompat.Long32 {
fn Op(self: CppCompat.Long32,
other: CppCompat.Long32) -> CppCompat.Long32 = "int.right_shift";
@@ -595,31 +595,31 @@ impl forall [T:! ImplicitAs(CppCompat.Long32)]
// - CppCompat.LongLong64 on right-hand side.
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as BitAndWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.and";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as BitOrWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.or";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as BitXorWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.xor";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as LeftShiftWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.left_shift";
}
impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
impl forall [T: ImplicitAs(CppCompat.LongLong64)]
T as RightShiftWith(CppCompat.LongLong64) where .Result = CppCompat.LongLong64 {
fn Op(self: CppCompat.LongLong64,
other: CppCompat.LongLong64) -> CppCompat.LongLong64 = "int.right_shift";
@@ -633,54 +633,54 @@ impl forall [T:! ImplicitAs(CppCompat.LongLong64)]
// - CppCompat.Long32
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as AddAssignWith(U) {
fn Op(ref self, other: Self) = "int.sadd_assign";
}
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as SubAssignWith(U) {
fn Op(ref self, other: Self) = "int.ssub_assign";
}
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as MulAssignWith(U) {
fn Op(ref self, other: Self) = "int.smul_assign";
}
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as DivAssignWith(U) {
fn Op(ref self, other: Self) = "int.sdiv_assign";
}
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as ModAssignWith(U) {
fn Op(ref self, other: Self) = "int.smod_assign";
}
// - CppCompat.LongLong64
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as AddAssignWith(U) {
fn Op(ref self, other: Self) = "int.sadd_assign";
}
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as SubAssignWith(U) {
fn Op(ref self, other: Self) = "int.ssub_assign";
}
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as MulAssignWith(U) {
fn Op(ref self, other: Self) = "int.smul_assign";
}
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as DivAssignWith(U) {
fn Op(ref self, other: Self) = "int.sdiv_assign";
}
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as ModAssignWith(U) {
fn Op(ref self, other: Self) = "int.smod_assign";
}
@@ -689,54 +689,54 @@ impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
// - CppCompat.Long32
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as BitAndAssignWith(U) {
fn Op(ref self, other: Self) = "int.and_assign";
}
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as BitOrAssignWith(U) {
fn Op(ref self, other: Self) = "int.or_assign";
}
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as BitXorAssignWith(U) {
fn Op(ref self, other: Self) = "int.xor_assign";
}
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as LeftShiftAssignWith(U) {
fn Op(ref self, other: Self) = "int.left_shift_assign";
}
impl forall [U:! ImplicitAs(CppCompat.Long32)]
impl forall [U: ImplicitAs(CppCompat.Long32)]
CppCompat.Long32 as RightShiftAssignWith(U) {
fn Op(ref self, other: Self) = "int.right_shift_assign";
}
// - CppCompat.LongLong64
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as BitAndAssignWith(U) {
fn Op(ref self, other: Self) = "int.and_assign";
}
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as BitOrAssignWith(U) {
fn Op(ref self, other: Self) = "int.or_assign";
}
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as BitXorAssignWith(U) {
fn Op(ref self, other: Self) = "int.xor_assign";
}
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as LeftShiftAssignWith(U) {
fn Op(ref self, other: Self) = "int.left_shift_assign";
}
impl forall [U:! ImplicitAs(CppCompat.LongLong64)]
impl forall [U: ImplicitAs(CppCompat.LongLong64)]
CppCompat.LongLong64 as RightShiftAssignWith(U) {
fn Op(ref self, other: Self) = "int.right_shift_assign";
}
+1 -1
View File
@@ -47,7 +47,7 @@ class CppCompat.NullptrT {
// TODO: impl as EqWith(Self)
impl forall [T:! type] as ImplicitAs(Optional(T*)) {
impl forall [T: type] as ImplicitAs(Optional(T*)) {
fn Convert(unused self) -> Optional(T*) {
return Optional(T*).None();
}
+2 -2
View File
@@ -32,10 +32,10 @@ abstract class CppCompat.VoidBase {
// TODO: Do not allow a pointer to `const T` to convert to `Cpp.void*`.
// #6357 allows it, and we don't have a good way to express "non-const" as a
// constraint on this impl, but this conversion is not const-correct.
impl forall [T:! type] T* as ImplicitAs(CppCompat.VoidBase*) {
impl forall [T: type] T* as ImplicitAs(CppCompat.VoidBase*) {
fn Convert(self: T*) -> CppCompat.VoidBase* = "pointer.unsafe_convert";
}
impl forall [T:! type] T* as ImplicitAs(const CppCompat.VoidBase*) {
impl forall [T: type] T* as ImplicitAs(const CppCompat.VoidBase*) {
fn Convert(self: T*) -> CppCompat.VoidBase* = "pointer.unsafe_convert";
}
+38 -38
View File
@@ -15,30 +15,30 @@ import library "prelude/types/int_literal";
private fn MakeFloat(size: IntLiteral) -> type = "float.make_type";
class Float(N:! IntLiteral) {
class Float(N: IntLiteral) {
adapt MakeFloat(N);
}
impl forall [N:! IntLiteral] Float(N) as UnformedInit {}
impl forall [N: IntLiteral] Float(N) as UnformedInit {}
// Copy.
impl forall [N:! IntLiteral] Float(N) as Copy {
impl forall [N: IntLiteral] Float(N) as Copy {
fn Op(self) -> Self = "primitive_copy";
}
// Conversions between floating-point types. Implicit if all the source values
// can be represented exactly in the target type, otherwise explicit.
impl forall [N:! IntLiteral] FloatLiteral as ImplicitAs(Float(N)) {
impl forall [N: IntLiteral] FloatLiteral as ImplicitAs(Float(N)) {
fn Convert(self) -> Float(N) = "float.convert_checked";
}
// TODO: Remove this once ImplicitAs extends As.
impl forall [N:! IntLiteral] FloatLiteral as As(Float(N)) {
impl forall [N: IntLiteral] FloatLiteral as As(Float(N)) {
fn Convert(self) -> Float(N) = "float.convert_checked";
}
final impl forall [From:! IntLiteral, To:! IntLiteral]
final impl forall [From: IntLiteral, To: IntLiteral]
Float(From) as As(Float(To)) {
fn Convert(self) -> Float(To) = "float.convert";
}
@@ -47,12 +47,12 @@ final impl forall [From:! IntLiteral, To:! IntLiteral]
// that is only parameterized by integers.
// TODO: Remove these once possible.
private interface AnyFloat {
let Width:! IntLiteral;
let Width: IntLiteral;
fn AsFloat(self) -> Float(Width);
fn Make(src: Float(Width)) -> Self;
}
impl forall [N:! IntLiteral] Float(N) as AnyFloat where .Width = N {
impl forall [N: IntLiteral] Float(N) as AnyFloat where .Width = N {
fn AsFloat(self) -> Self { return self; }
fn Make(src: Self) -> Self { return src; }
}
@@ -60,7 +60,7 @@ impl forall [N:! IntLiteral] Float(N) as AnyFloat where .Width = N {
// Use `Float(?) as ImplicitAs(?)` to avoid a collision with the
// `? as ImplicitAs(Float(?))` type structure used by int -> float conversion.
// TODO: Use `match_first` to resolve this instead once it is available.
impl forall [From:! IntLiteral, To:! AnyFloat where Float(From) impls FloatFitsIn(.Self)]
impl forall [From: IntLiteral, To: AnyFloat where Float(From) impls FloatFitsIn(.Self)]
Float(From) as ImplicitAs(To) {
fn Convert(self) -> To {
fn Impl(src: Float(From)) -> Float(To.Width) = "float.convert";
@@ -69,7 +69,7 @@ impl forall [From:! IntLiteral, To:! AnyFloat where Float(From) impls FloatFitsI
}
// Desired workaround-free version of the above:
// impl forall [From:! IntLiteral, To:! IntLiteral
// impl forall [From: IntLiteral, To: IntLiteral
// where Float(From) impls FloatFitsIn(Float(To))]
// Float(From) as ImplicitAs(Float(To)) {
// fn Convert(self) -> Float(To) = "float.convert";
@@ -77,34 +77,34 @@ impl forall [From:! IntLiteral, To:! AnyFloat where Float(From) impls FloatFitsI
// Conversions from floating-point to integer type. Always unsafe: not all
// source values fit in the target type.
final impl forall [From:! IntLiteral, To:! IntLiteral]
final impl forall [From: IntLiteral, To: IntLiteral]
Float(From) as UnsafeAs(Int(To)) {
fn Convert(self) -> Int(To) = "float.convert_int";
}
final impl forall [From:! IntLiteral, To:! IntLiteral]
final impl forall [From: IntLiteral, To: IntLiteral]
Float(From) as UnsafeAs(UInt(To)) {
fn Convert(self) -> UInt(To) = "float.convert_int";
}
final impl forall [From:! IntLiteral]
final impl forall [From: IntLiteral]
Float(From) as UnsafeAs(IntLiteral) {
fn Convert(self) -> IntLiteral = "float.convert_int";
}
// Conversions from integer to floating-point type. Implicit if all source
// values can be represented exactly in the target type, otherwise explicit.
impl forall [From:! IntLiteral, To:! IntLiteral]
impl forall [From: IntLiteral, To: IntLiteral]
Int(From) as As(Float(To)) {
fn Convert(self) -> Float(To) = "int.convert_float";
}
impl forall [From:! IntLiteral, To:! IntLiteral]
impl forall [From: IntLiteral, To: IntLiteral]
UInt(From) as As(Float(To)) {
fn Convert(self) -> Float(To) = "int.convert_float";
}
impl forall [To:! IntLiteral]
impl forall [To: IntLiteral]
IntLiteral as As(Float(To)) {
fn Convert(self) -> Float(To) = "int.convert_float";
}
@@ -114,28 +114,28 @@ impl forall [To:! IntLiteral]
// lack of support for `match_first`.
// TODO: Remove these once possible.
private interface AnyInt {
let Width:! IntLiteral;
let Width: IntLiteral;
fn AsInt(self) -> Int(Width);
}
impl forall [N:! IntLiteral] Int(N) as AnyInt where .Width = N {
impl forall [N: IntLiteral] Int(N) as AnyInt where .Width = N {
fn AsInt(self) -> Self { return self; }
}
private interface AnyUInt {
let Width:! IntLiteral;
let Width: IntLiteral;
fn AsUInt(self) -> UInt(Width);
}
impl forall [N:! IntLiteral] UInt(N) as AnyUInt where .Width = N {
impl forall [N: IntLiteral] UInt(N) as AnyUInt where .Width = N {
fn AsUInt(self) -> Self { return self; }
}
private interface IntImplicitAsFloat(To:! IntLiteral) {
private interface IntImplicitAsFloat(To: IntLiteral) {
fn Convert(self) -> Float(To);
}
final impl forall [To:! IntLiteral, From:! AnyInt & IntFitsIn(Float(To))]
final impl forall [To: IntLiteral, From: AnyInt & IntFitsIn(Float(To))]
From as IntImplicitAsFloat(To) {
fn Convert(self) -> Float(To) {
fn Impl(src: Int(From.Width)) -> Float(To) = "int.convert_float";
@@ -143,7 +143,7 @@ final impl forall [To:! IntLiteral, From:! AnyInt & IntFitsIn(Float(To))]
}
}
impl forall [To:! IntLiteral, From:! AnyUInt & IntFitsIn(Float(To))]
impl forall [To: IntLiteral, From: AnyUInt & IntFitsIn(Float(To))]
From as IntImplicitAsFloat(To) {
fn Convert(self) -> Float(To) {
fn Impl(src: UInt(From.Width)) -> Float(To) = "int.convert_float";
@@ -151,7 +151,7 @@ impl forall [To:! IntLiteral, From:! AnyUInt & IntFitsIn(Float(To))]
}
}
impl forall [To:! IntLiteral, From:! IntImplicitAsFloat(To)]
impl forall [To: IntLiteral, From: IntImplicitAsFloat(To)]
From as ImplicitAs(Float(To)) {
fn Convert(self) -> Float(To) {
return self.Convert();
@@ -160,31 +160,31 @@ impl forall [To:! IntLiteral, From:! IntImplicitAsFloat(To)]
// Desired workaround-free version of the above:
//
// impl forall [From:! IntLiteral, To:! IntLiteral
// impl forall [From: IntLiteral, To: IntLiteral
// where Int(From) impls ImplicitAs(Float(To))]
// Int(From) as ImplicitAs(Float(To)) {
// fn Convert(self) -> Float(To) = "int.convert_float";
// }
//
// impl forall [From:! IntLiteral, To:! IntLiteral
// impl forall [From: IntLiteral, To: IntLiteral
// where UInt(From) impls ImplicitAs(Float(To))]
// UInt(From) as ImplicitAs(Float(To)) {
// fn Convert(self) -> Float(To) = "int.convert_float";
// }
impl forall [To:! IntLiteral]
impl forall [To: IntLiteral]
IntLiteral as ImplicitAs(Float(To)) {
fn Convert(self) -> Float(To) = "int.convert_float_checked";
}
// Comparisons.
// TODO: Support mixed-type comparisons.
final impl forall [N:! IntLiteral] Float(N) as EqWith(Float(N)) {
final impl forall [N: IntLiteral] Float(N) as EqWith(Float(N)) {
fn Equal(self, other: Float(N)) -> bool = "float.eq";
fn NotEqual(self, other: Float(N)) -> bool = "float.neq";
}
final impl forall [N:! IntLiteral] Float(N) as OrderedWith(Float(N)) {
final impl forall [N: IntLiteral] Float(N) as OrderedWith(Float(N)) {
fn Less(self, other: Float(N)) -> bool = "float.less";
fn LessOrEquivalent(self, other: Float(N)) -> bool = "float.less_eq";
fn Greater(self, other: Float(N)) -> bool = "float.greater";
@@ -192,48 +192,48 @@ final impl forall [N:! IntLiteral] Float(N) as OrderedWith(Float(N)) {
}
// Arithmetic.
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Float(N) as AddWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "float.add";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Float(N) as DivWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "float.div";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Float(N) as MulWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "float.mul";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Float(N) as Negate where .Result = Self {
fn Op(self) -> Self = "float.negate";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Float(N) as SubWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "float.sub";
}
// Compound assignments.
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Float(N) as AddAssignWith(Self) {
fn Op(ref self, other: Self) = "float.add_assign";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Float(N) as DivAssignWith(Self) {
fn Op(ref self, other: Self) = "float.div_assign";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Float(N) as MulAssignWith(Self) {
fn Op(ref self, other: Self) = "float.mul_assign";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Float(N) as SubAssignWith(Self) {
fn Op(ref self, other: Self) = "float.sub_assign";
}
+67 -67
View File
@@ -14,36 +14,36 @@ import library "prelude/types/int_literal";
private fn MakeInt(size: IntLiteral) -> type = "int.make_type_signed";
class Int(N:! IntLiteral) {
class Int(N: IntLiteral) {
adapt MakeInt(N);
}
impl forall [N:! IntLiteral] Int(N) as UnformedInit {}
impl forall [N: IntLiteral] Int(N) as UnformedInit {}
// Copy.
impl forall [N:! IntLiteral] Int(N) as Copy {
impl forall [N: IntLiteral] Int(N) as Copy {
fn Op(self) -> Self = "primitive_copy";
}
// Conversions.
impl forall [To:! IntLiteral] IntLiteral as ImplicitAs(Int(To)) {
impl forall [To: IntLiteral] IntLiteral as ImplicitAs(Int(To)) {
fn Convert(self) -> Int(To) = "int.convert_checked";
}
final impl forall [From:! IntLiteral] Int(From) as ImplicitAs(IntLiteral) {
final impl forall [From: IntLiteral] Int(From) as ImplicitAs(IntLiteral) {
fn Convert(self) -> IntLiteral = "int.convert_checked";
}
// TODO: Remove these once ImplicitAs extends As. For now we need them because
// the forwarding impl of As in terms of ImplicitAs is not usable at compile
// time.
impl forall [To:! IntLiteral] IntLiteral as As(Int(To)) {
impl forall [To: IntLiteral] IntLiteral as As(Int(To)) {
fn Convert(self) -> Int(To) = "int.convert_checked";
}
final impl forall [From:! IntLiteral] Int(From) as As(IntLiteral) {
final impl forall [From: IntLiteral] Int(From) as As(IntLiteral) {
fn Convert(self) -> IntLiteral = "int.convert_checked";
}
@@ -51,15 +51,15 @@ final impl forall [From:! IntLiteral] Int(From) as As(IntLiteral) {
// type `IntLiteral`.
// TODO: Remove this once possible.
private interface AnyInt {
let Width:! IntLiteral;
let Width: IntLiteral;
fn AsInt(self) -> Int(Width);
}
impl forall [N:! IntLiteral] Int(N) as AnyInt where .Width = N {
impl forall [N: IntLiteral] Int(N) as AnyInt where .Width = N {
fn AsInt(self) -> Self { return self; }
}
impl forall [To:! IntLiteral, From:! AnyInt & IntFitsIn(Int(To))]
impl forall [To: IntLiteral, From: AnyInt & IntFitsIn(Int(To))]
From as ImplicitAs(Int(To)) {
fn Convert(self) -> Int(To) {
fn Impl(src: Int(From.Width)) -> Int(To) = "int.convert";
@@ -67,21 +67,21 @@ impl forall [To:! IntLiteral, From:! AnyInt & IntFitsIn(Int(To))]
}
}
final impl forall [From:! IntLiteral, To:! IntLiteral] Int(From) as As(Int(To)) {
final impl forall [From: IntLiteral, To: IntLiteral] Int(From) as As(Int(To)) {
fn Convert(self) -> Int(To) = "int.convert";
}
// Explicit conversion to/from character literals.
impl forall [N:! IntLiteral] Int(N) as As(CharLiteral) {
impl forall [N: IntLiteral] Int(N) as As(CharLiteral) {
fn Convert(self) -> CharLiteral = "int.convert_char_literal";
}
impl forall [N:! IntLiteral] CharLiteral as As(Int(N)) {
impl forall [N: IntLiteral] CharLiteral as As(Int(N)) {
fn Convert(self) -> Int(N) = "char_literal.convert_int";
}
// Explicit conversion from floating-point literals.
impl forall [To:! IntLiteral]
impl forall [To: IntLiteral]
FloatLiteral as UnsafeAs(Int(To)) {
fn Convert(self) -> Int(To) = "float.convert_int";
}
@@ -90,12 +90,12 @@ impl forall [To:! IntLiteral]
// - Int(N) vs Int(M).
final impl forall [N:! IntLiteral, M:! IntLiteral] Int(N) as EqWith(Int(M)) {
final impl forall [N: IntLiteral, M: IntLiteral] Int(N) as EqWith(Int(M)) {
fn Equal(self, other: Int(M)) -> bool = "int.eq";
fn NotEqual(self, other: Int(M)) -> bool = "int.neq";
}
final impl forall [N:! IntLiteral, M:! IntLiteral] Int(N) as OrderedWith(Int(M)) {
final impl forall [N: IntLiteral, M: IntLiteral] Int(N) as OrderedWith(Int(M)) {
// TODO: fn Compare
fn Less(self, other: Int(M)) -> bool = "int.less";
fn LessOrEquivalent(self, other: Int(M)) -> bool = "int.less_eq";
@@ -105,12 +105,12 @@ final impl forall [N:! IntLiteral, M:! IntLiteral] Int(N) as OrderedWith(Int(M))
// - Int(N) on left-hand side.
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))] Int(N) as EqWith(T) {
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))] Int(N) as EqWith(T) {
fn Equal(self, other: Self) -> bool = "int.eq";
fn NotEqual(self, other: Self) -> bool = "int.neq";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))] Int(N) as OrderedWith(T) {
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))] Int(N) as OrderedWith(T) {
// TODO: fn Compare
fn Less(self, other: Self) -> bool = "int.less";
fn LessOrEquivalent(self, other: Self) -> bool = "int.less_eq";
@@ -120,12 +120,12 @@ impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))] Int(N) as OrderedWith(T) {
// - Int(N) on right-hand side.
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))] T as EqWith(Int(N)) {
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))] T as EqWith(Int(N)) {
fn Equal(self: Int(N), other: Int(N)) -> bool = "int.eq";
fn NotEqual(self: Int(N), other: Int(N)) -> bool = "int.neq";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))] T as OrderedWith(Int(N)) {
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))] T as OrderedWith(Int(N)) {
// TODO: fn Compare
fn Less(self: Int(N), other: Int(N)) -> bool = "int.less";
fn LessOrEquivalent(self: Int(N), other: Int(N)) -> bool = "int.less_eq";
@@ -137,101 +137,101 @@ impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))] T as OrderedWith(Int(N)) {
// - Homogeneous.
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as AddWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.sadd";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as DivWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.sdiv";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as ModWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.smod";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as MulWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.smul";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as Negate where .Result = Self {
fn Op(self) -> Self = "int.snegate";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as SubWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.ssub";
}
// - Int(N) on left-hand side.
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as AddWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.sadd";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as DivWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.sdiv";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as ModWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.smod";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as MulWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.smul";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as SubWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.ssub";
}
// - Int(N) on right-hand side.
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as AddWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.sadd";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as DivWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.sdiv";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as ModWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.smod";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as MulWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.smul";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as SubWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.ssub";
}
// - CharLiteral and Int(N).
impl forall [N:! IntLiteral] CharLiteral as AddWith(Int(N)) where .Result = CharLiteral {
impl forall [N: IntLiteral] CharLiteral as AddWith(Int(N)) where .Result = CharLiteral {
fn Op(self, other: Int(N)) -> CharLiteral = "char_literal.add";
}
impl forall [N:! IntLiteral] Int(N) as AddWith(CharLiteral) where .Result = CharLiteral {
impl forall [N: IntLiteral] Int(N) as AddWith(CharLiteral) where .Result = CharLiteral {
fn Op(self, other: CharLiteral) -> CharLiteral = "int.add_char_literal";
}
impl forall [N:! IntLiteral] CharLiteral as SubWith(Int(N)) where .Result = CharLiteral {
impl forall [N: IntLiteral] CharLiteral as SubWith(Int(N)) where .Result = CharLiteral {
fn Op(self, other: Int(N)) -> CharLiteral = "char_literal.sub_int";
}
@@ -240,138 +240,138 @@ impl forall [N:! IntLiteral] CharLiteral as SubWith(Int(N)) where .Result = Char
// - Homogeneous.
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as BitAndWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.and";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as BitComplement where .Result = Self {
fn Op(self) -> Self = "int.complement";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as BitOrWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.or";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as BitXorWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.xor";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as LeftShiftWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.left_shift";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
Int(N) as RightShiftWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.right_shift";
}
// - Int(N) on left-hand side.
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as BitAndWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.and";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as BitOrWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.or";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as BitXorWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.xor";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as LeftShiftWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.left_shift";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as RightShiftWith(U) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.right_shift";
}
// - Int(N) on right-hand side.
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as BitAndWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.and";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as BitOrWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.or";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as BitXorWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.xor";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as LeftShiftWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.left_shift";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, T: ImplicitAs(Int(N))]
T as RightShiftWith(Int(N)) where .Result = Int(N) {
fn Op(self: Int(N), other: Int(N)) -> Int(N) = "int.right_shift";
}
// Compound assignments.
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as AddAssignWith(U) {
fn Op(ref self, other: Self) = "int.sadd_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as BitAndAssignWith(U) {
fn Op(ref self, other: Self) = "int.and_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as BitOrAssignWith(U) {
fn Op(ref self, other: Self) = "int.or_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as BitXorAssignWith(U) {
fn Op(ref self, other: Self) = "int.xor_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as DivAssignWith(U) {
fn Op(ref self, other: Self) = "int.sdiv_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as LeftShiftAssignWith(U) {
fn Op(ref self, other: Self) = "int.left_shift_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as ModAssignWith(U) {
fn Op(ref self, other: Self) = "int.smod_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as MulAssignWith(U) {
fn Op(ref self, other: Self) = "int.smul_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as RightShiftAssignWith(U) {
fn Op(ref self, other: Self) = "int.right_shift_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
impl forall [N: IntLiteral, U: ImplicitAs(Int(N))]
Int(N) as SubAssignWith(U) {
fn Op(ref self, other: Self) = "int.ssub_assign";
}
@@ -381,7 +381,7 @@ impl forall [N:! IntLiteral, U:! ImplicitAs(Int(N))]
// TODO: Add builtins for these to avoid emitting a call.
impl forall [N:! IntLiteral] Int(N) as Dec {
impl forall [N: IntLiteral] Int(N) as Dec {
fn Op(ref self) {
// TODO: `self -= 1;` should work, but fails because the `impl IntLiteral
// as ImplicitAs(Int(N))` is not final, which causes us to not attempt the
@@ -392,7 +392,7 @@ impl forall [N:! IntLiteral] Int(N) as Dec {
}
}
impl forall [N:! IntLiteral] Int(N) as Inc {
impl forall [N: IntLiteral] Int(N) as Inc {
fn Op(ref self) {
fn AsInt(n: IntLiteral) -> Int(N) = "int.convert_checked";
self += AsInt(1);
+2 -2
View File
@@ -10,8 +10,8 @@ import library "prelude/destroy";
private fn MakeMaybeUnformed(t: type) -> type = "maybe_unformed.make_type";
// TODO: This should probably support non-destructible types.
class MaybeUnformed(T:! Destroy) {
class MaybeUnformed(T: Destroy) {
adapt MakeMaybeUnformed(T);
}
impl forall [T:! Destroy] MaybeUnformed(T) as UnformedInit {}
impl forall [T: Destroy] MaybeUnformed(T) as UnformedInit {}
+18 -18
View File
@@ -14,7 +14,7 @@ import library "prelude/types/maybe_unformed";
// TODO: Decide how to expose this in the public API.
private interface OptionalStorage {
let Type:! type;
let Type: type;
fn None() -> Type;
fn Some(self) -> Type;
fn Has(value: Type) -> bool;
@@ -26,7 +26,7 @@ private interface OptionalStorage {
// TODO: We don't have an approved design for an `Optional` type yet, but it's
// used by the design for `Iterate`. The API here is a placeholder.
class Optional(T:! OptionalStorage) {
class Optional(T: OptionalStorage) {
fn None() -> Self {
return T.None() as Self;
}
@@ -44,9 +44,9 @@ class Optional(T:! OptionalStorage) {
adapt T.Type;
}
impl forall [T:! OptionalStorage & UnformedInit] Optional(T) as UnformedInit {}
impl forall [T: OptionalStorage & UnformedInit] Optional(T) as UnformedInit {}
impl forall [T:! OptionalStorage] Optional(T) as Copy {
impl forall [T: OptionalStorage] Optional(T) as Copy {
fn Op(self) -> Self {
return T.Copy(self as T.Type) as Optional(T);
}
@@ -56,14 +56,14 @@ impl forall [T:! OptionalStorage] Optional(T) as Copy {
// Once we have match_first, this can be rewritten more simply as:
//
// match_first {
// impl forall [T:! OptionalStorage]
// impl forall [T: OptionalStorage]
// T as ImplicitAs(Optional(T)) {
// fn Convert(self: T) -> Optional(T) {
// return Optional(T).Some(self);
// }
// }
//
// impl forall [T:! Destroy & OptionalStorage, U:! ImplicitAs(T)]
// impl forall [T: Destroy & OptionalStorage, U: ImplicitAs(T)]
// U as ImplicitAs(Optional(T)) {
// fn Convert(self: U) -> Optional(T) {
// return Optional(T).Some(self.Convert());
@@ -71,26 +71,26 @@ impl forall [T:! OptionalStorage] Optional(T) as Copy {
// }
// }
private interface OptionalAs(T:! OptionalStorage) {
private interface OptionalAs(T: OptionalStorage) {
fn Convert(self) -> Optional(T);
}
final impl forall [T:! OptionalStorage]
final impl forall [T: OptionalStorage]
T as OptionalAs(T) {
fn Convert(self) -> Optional(T) {
return Optional(T).Some(self);
}
}
impl forall [T:! Destroy & OptionalStorage, U:! ImplicitAs(T)]
impl forall [T: Destroy & OptionalStorage, U: ImplicitAs(T)]
U as OptionalAs(T) {
fn Convert(self) -> Optional(T) {
return Optional(T).Some(self.Convert());
}
}
impl forall [T:! Destroy & OptionalStorage,
U:! Destroy & OptionalStorage & ImplicitAs(T)]
impl forall [T: Destroy & OptionalStorage,
U: Destroy & OptionalStorage & ImplicitAs(T)]
Optional(U) as OptionalAs(T) {
fn Convert(self) -> Optional(T) {
if (self.HasValue()) {
@@ -100,7 +100,7 @@ impl forall [T:! Destroy & OptionalStorage,
}
}
impl forall [T:! OptionalStorage, U:! OptionalAs(T)]
impl forall [T: OptionalStorage, U: OptionalAs(T)]
U as ImplicitAs(Optional(T)) {
fn Convert(self) -> Optional(T) {
return self.Convert();
@@ -112,15 +112,15 @@ impl forall [T:! OptionalStorage, U:! OptionalAs(T)]
// `bool` is `false`.
//
// TODO: Revisit this once we have choice types implemented in the toolchain.
private class DefaultOptionalStorage(T:! Copy & Destroy) {
private class DefaultOptionalStorage(T: Copy & Destroy) {
var value: MaybeUnformed(T);
var has_value: bool;
}
private fn MakeUninitializedOptionalStorage(T:! Copy & Destroy)
private fn MakeUninitializedOptionalStorage(generic T: Copy & Destroy)
-> DefaultOptionalStorage(T) = "make_uninitialized";
impl forall [T:! Copy & Destroy] T as OptionalStorage
impl forall [T: Copy & Destroy] T as OptionalStorage
where .Type = DefaultOptionalStorage(T) {
fn None() -> DefaultOptionalStorage(T) {
returned var me: DefaultOptionalStorage(T) =
@@ -153,14 +153,14 @@ impl forall [T:! Copy & Destroy] T as OptionalStorage
}
}
private fn PointerIsNull[T:! type](value: MaybeUnformed(T*)) -> bool = "pointer.is_null";
private fn PointerIsNull[T: type](value: MaybeUnformed(T*)) -> bool = "pointer.is_null";
private fn MakeUninitializedOptionalPointer(T:! type)
private fn MakeUninitializedOptionalPointer(generic T: type)
-> MaybeUnformed(T*) = "make_uninitialized";
// For pointers, we use a null pointer value as the "None" value. This allows
// `Optional(T*)` to be ABI-compatible with a C++ nullable pointer.
final impl forall [T:! type] T* as OptionalStorage
final impl forall [T: type] T* as OptionalStorage
where .Type = MaybeUnformed(T*) {
fn None() -> MaybeUnformed(T*) = "pointer.make_null";
fn Some(self) -> MaybeUnformed(T*) {
+1 -1
View File
@@ -27,6 +27,6 @@ class String {
impl String as UnformedInit {}
impl forall [T:! ImplicitAs(i64)] String as IndexWith(T) where .ElementType = Char {
impl forall [T: ImplicitAs(i64)] String as IndexWith(T) where .ElementType = Char {
fn At(self, subscript: T) -> Char = "string.at";
}
+76 -76
View File
@@ -15,36 +15,36 @@ import library "prelude/types/int_literal";
private fn MakeUInt(size: IntLiteral) -> type = "int.make_type_unsigned";
class UInt(N:! IntLiteral) {
class UInt(N: IntLiteral) {
adapt MakeUInt(N);
}
impl forall [N:! IntLiteral] UInt(N) as UnformedInit {}
impl forall [N: IntLiteral] UInt(N) as UnformedInit {}
// Copy.
impl forall [N:! IntLiteral] UInt(N) as Copy {
impl forall [N: IntLiteral] UInt(N) as Copy {
fn Op(self) -> Self = "primitive_copy";
}
// Conversions.
impl forall [To:! IntLiteral] IntLiteral as ImplicitAs(UInt(To)) {
impl forall [To: IntLiteral] IntLiteral as ImplicitAs(UInt(To)) {
fn Convert(self) -> UInt(To) = "int.convert_checked";
}
final impl forall [From:! IntLiteral] UInt(From) as ImplicitAs(IntLiteral) {
final impl forall [From: IntLiteral] UInt(From) as ImplicitAs(IntLiteral) {
fn Convert(self) -> IntLiteral = "int.convert_checked";
}
// TODO: Remove these once ImplicitAs extends As. For now we need them because
// the forwarding impl of As in terms of ImplicitAs is not usable at compile
// time.
impl forall [To:! IntLiteral] IntLiteral as As(UInt(To)) {
impl forall [To: IntLiteral] IntLiteral as As(UInt(To)) {
fn Convert(self) -> UInt(To) = "int.convert_checked";
}
final impl forall [From:! IntLiteral] UInt(From) as As(IntLiteral) {
final impl forall [From: IntLiteral] UInt(From) as As(IntLiteral) {
fn Convert(self) -> IntLiteral = "int.convert_checked";
}
@@ -52,22 +52,22 @@ final impl forall [From:! IntLiteral] UInt(From) as As(IntLiteral) {
// type `IntLiteral`.
// TODO: Remove this once possible.
private interface AnyUInt {
let Width:! IntLiteral;
let Width: IntLiteral;
fn AsUInt(self) -> UInt(Width);
}
impl forall [N:! IntLiteral] UInt(N) as AnyUInt where .Width = N {
impl forall [N: IntLiteral] UInt(N) as AnyUInt where .Width = N {
fn AsUInt(self) -> Self { return self; }
}
// Work around the inability to apply constraints to an impl that is only
// parameterized by integers, and the lack of support for `match_first`.
// TODO: Remove this once possible.
private interface FromUInt(From:! type) {
private interface FromUInt(From: type) {
fn Convert(from: From) -> Self;
}
impl forall [To:! IntLiteral, From:! AnyUInt & IntFitsIn(UInt(To))]
impl forall [To: IntLiteral, From: AnyUInt & IntFitsIn(UInt(To))]
UInt(To) as FromUInt(From) {
fn Convert(from: From) -> Self {
fn Impl(src: UInt(From.Width)) -> Self = "int.convert";
@@ -75,7 +75,7 @@ impl forall [To:! IntLiteral, From:! AnyUInt & IntFitsIn(UInt(To))]
}
}
impl forall [To:! IntLiteral, From:! AnyUInt & IntFitsIn(Int(To))]
impl forall [To: IntLiteral, From: AnyUInt & IntFitsIn(Int(To))]
Int(To) as FromUInt(From) {
fn Convert(from: From) -> Self {
fn Impl(src: UInt(From.Width)) -> Self = "int.convert";
@@ -83,37 +83,37 @@ impl forall [To:! IntLiteral, From:! AnyUInt & IntFitsIn(Int(To))]
}
}
impl forall [From:! IntLiteral, To:! FromUInt(UInt(From))]
impl forall [From: IntLiteral, To: FromUInt(UInt(From))]
UInt(From) as ImplicitAs(To) {
fn Convert(self) -> To {
return To.Convert(self);
}
}
final impl forall [From:! IntLiteral, To:! IntLiteral] UInt(From) as As(UInt(To)) {
final impl forall [From: IntLiteral, To: IntLiteral] UInt(From) as As(UInt(To)) {
fn Convert(self) -> UInt(To) = "int.convert";
}
final impl forall [From:! IntLiteral, To:! IntLiteral] UInt(From) as As(Int(To)) {
final impl forall [From: IntLiteral, To: IntLiteral] UInt(From) as As(Int(To)) {
fn Convert(self) -> Int(To) = "int.convert";
}
// Never implicit.
impl forall [From:! IntLiteral, To:! IntLiteral] Int(From) as As(UInt(To)) {
impl forall [From: IntLiteral, To: IntLiteral] Int(From) as As(UInt(To)) {
fn Convert(self) -> UInt(To) = "int.convert";
}
// Explicit conversion to/from character literals.
impl forall [N:! IntLiteral] UInt(N) as As(CharLiteral) {
impl forall [N: IntLiteral] UInt(N) as As(CharLiteral) {
fn Convert(self) -> CharLiteral = "int.convert_char_literal";
}
impl forall [N:! IntLiteral] CharLiteral as As(UInt(N)) {
impl forall [N: IntLiteral] CharLiteral as As(UInt(N)) {
fn Convert(self) -> UInt(N) = "char_literal.convert_int";
}
// Explicit conversion from floating-point literals.
impl forall [To:! IntLiteral]
impl forall [To: IntLiteral]
FloatLiteral as UnsafeAs(UInt(To)) {
fn Convert(self) -> UInt(To) = "float.convert_int";
}
@@ -122,12 +122,12 @@ impl forall [To:! IntLiteral]
// - UInt(N) vs UInt(M).
final impl forall [N:! IntLiteral, M:! IntLiteral] UInt(N) as EqWith(UInt(M)) {
final impl forall [N: IntLiteral, M: IntLiteral] UInt(N) as EqWith(UInt(M)) {
fn Equal(self, other: UInt(M)) -> bool = "int.eq";
fn NotEqual(self, other: UInt(M)) -> bool = "int.neq";
}
final impl forall [N:! IntLiteral, M:! IntLiteral] UInt(N) as OrderedWith(UInt(M)) {
final impl forall [N: IntLiteral, M: IntLiteral] UInt(N) as OrderedWith(UInt(M)) {
// TODO: fn Compare
fn Less(self, other: UInt(M)) -> bool = "int.less";
fn LessOrEquivalent(self, other: UInt(M)) -> bool = "int.less_eq";
@@ -137,12 +137,12 @@ final impl forall [N:! IntLiteral, M:! IntLiteral] UInt(N) as OrderedWith(UInt(M
// - UInt(N) vs Int(M).
final impl forall [N:! IntLiteral, M:! IntLiteral] UInt(N) as EqWith(Int(M)) {
final impl forall [N: IntLiteral, M: IntLiteral] UInt(N) as EqWith(Int(M)) {
fn Equal(self, other: Int(M)) -> bool = "int.eq";
fn NotEqual(self, other: Int(M)) -> bool = "int.neq";
}
final impl forall [N:! IntLiteral, M:! IntLiteral] UInt(N) as OrderedWith(Int(M)) {
final impl forall [N: IntLiteral, M: IntLiteral] UInt(N) as OrderedWith(Int(M)) {
// TODO: fn Compare
fn Less(self, other: Int(M)) -> bool = "int.less";
fn LessOrEquivalent(self, other: Int(M)) -> bool = "int.less_eq";
@@ -152,12 +152,12 @@ final impl forall [N:! IntLiteral, M:! IntLiteral] UInt(N) as OrderedWith(Int(M)
// - Int(N) vs UInt(M).
impl forall [N:! IntLiteral, M:! IntLiteral] Int(N) as EqWith(UInt(M)) {
impl forall [N: IntLiteral, M: IntLiteral] Int(N) as EqWith(UInt(M)) {
fn Equal(self, other: UInt(M)) -> bool = "int.eq";
fn NotEqual(self, other: UInt(M)) -> bool = "int.neq";
}
impl forall [N:! IntLiteral, M:! IntLiteral] Int(N) as OrderedWith(UInt(M)) {
impl forall [N: IntLiteral, M: IntLiteral] Int(N) as OrderedWith(UInt(M)) {
// TODO: fn Compare
fn Less(self, other: UInt(M)) -> bool = "int.less";
fn LessOrEquivalent(self, other: UInt(M)) -> bool = "int.less_eq";
@@ -167,12 +167,12 @@ impl forall [N:! IntLiteral, M:! IntLiteral] Int(N) as OrderedWith(UInt(M)) {
// - UInt(N) on left-hand side.
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))] UInt(N) as EqWith(T) {
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))] UInt(N) as EqWith(T) {
fn Equal(self, other: Self) -> bool = "int.eq";
fn NotEqual(self, other: Self) -> bool = "int.neq";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))] UInt(N) as OrderedWith(T) {
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))] UInt(N) as OrderedWith(T) {
// TODO: fn Compare
fn Less(self, other: Self) -> bool = "int.less";
fn LessOrEquivalent(self, other: Self) -> bool = "int.less_eq";
@@ -182,12 +182,12 @@ impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))] UInt(N) as OrderedWith(T)
// - UInt(N) on right-hand side.
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))] T as EqWith(UInt(N)) {
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))] T as EqWith(UInt(N)) {
fn Equal(self: UInt(N), other: UInt(N)) -> bool = "int.eq";
fn NotEqual(self: UInt(N), other: UInt(N)) -> bool = "int.neq";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))] T as OrderedWith(UInt(N)) {
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))] T as OrderedWith(UInt(N)) {
// TODO: fn Compare
fn Less(self: UInt(N), other: UInt(N)) -> bool = "int.less";
fn LessOrEquivalent(self: UInt(N), other: UInt(N)) -> bool = "int.less_eq";
@@ -199,101 +199,101 @@ impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))] T as OrderedWith(UInt(N))
// - Homogeneous.
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as AddWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.uadd";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as DivWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.udiv";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as ModWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.umod";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as MulWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.umul";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as Negate where .Result = Self {
fn Op(self) -> Self = "int.unegate";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as SubWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.usub";
}
// - UInt(N) on left-hand side.
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as AddWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.uadd";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as DivWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.udiv";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as ModWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.umod";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as MulWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.umul";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as SubWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.usub";
}
// - UInt(N) on right-hand side.
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as AddWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.uadd";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as DivWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.udiv";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as ModWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.umod";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as MulWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.umul";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as SubWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.usub";
}
// - CharLiteral and UInt(N).
impl forall [N:! IntLiteral] CharLiteral as AddWith(UInt(N)) where .Result = CharLiteral {
impl forall [N: IntLiteral] CharLiteral as AddWith(UInt(N)) where .Result = CharLiteral {
fn Op(self, other: UInt(N)) -> CharLiteral = "char_literal.add";
}
impl forall [N:! IntLiteral] UInt(N) as AddWith(CharLiteral) where .Result = CharLiteral {
impl forall [N: IntLiteral] UInt(N) as AddWith(CharLiteral) where .Result = CharLiteral {
fn Op(self, other: CharLiteral) -> CharLiteral = "int.add_char_literal";
}
impl forall [N:! IntLiteral] CharLiteral as SubWith(UInt(N)) where .Result = CharLiteral {
impl forall [N: IntLiteral] CharLiteral as SubWith(UInt(N)) where .Result = CharLiteral {
fn Op(self, other: UInt(N)) -> CharLiteral = "char_literal.sub_int";
}
@@ -302,138 +302,138 @@ impl forall [N:! IntLiteral] CharLiteral as SubWith(UInt(N)) where .Result = Cha
// - Homogeneous.
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as BitAndWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.and";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as BitComplement where .Result = Self {
fn Op(self) -> Self = "int.complement";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as BitOrWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.or";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as BitXorWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.xor";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as LeftShiftWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.left_shift";
}
final impl forall [N:! IntLiteral]
final impl forall [N: IntLiteral]
UInt(N) as RightShiftWith(Self) where .Result = Self {
fn Op(self, other: Self) -> Self = "int.right_shift";
}
// - UInt(N) on left-hand side.
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as BitAndWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.and";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as BitOrWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.or";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as BitXorWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.xor";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as LeftShiftWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.left_shift";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as RightShiftWith(U) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.right_shift";
}
// - UInt(N) on right-hand side.
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as BitAndWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.and";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as BitOrWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.or";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as BitXorWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.xor";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as LeftShiftWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.left_shift";
}
impl forall [N:! IntLiteral, T:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, T: ImplicitAs(UInt(N))]
T as RightShiftWith(UInt(N)) where .Result = UInt(N) {
fn Op(self: UInt(N), other: UInt(N)) -> UInt(N) = "int.right_shift";
}
// Compound assignments.
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as AddAssignWith(U) {
fn Op(ref self, other: Self) = "int.uadd_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as BitAndAssignWith(U) {
fn Op(ref self, other: Self) = "int.and_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as BitOrAssignWith(U) {
fn Op(ref self, other: Self) = "int.or_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as BitXorAssignWith(U) {
fn Op(ref self, other: Self) = "int.xor_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as DivAssignWith(U) {
fn Op(ref self, other: Self) = "int.udiv_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as LeftShiftAssignWith(U) {
fn Op(ref self, other: Self) = "int.left_shift_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as ModAssignWith(U) {
fn Op(ref self, other: Self) = "int.umod_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as MulAssignWith(U) {
fn Op(ref self, other: Self) = "int.umul_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as RightShiftAssignWith(U) {
fn Op(ref self, other: Self) = "int.right_shift_assign";
}
impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
impl forall [N: IntLiteral, U: ImplicitAs(UInt(N))]
UInt(N) as SubAssignWith(U) {
fn Op(ref self, other: Self) = "int.usub_assign";
}
@@ -443,7 +443,7 @@ impl forall [N:! IntLiteral, U:! ImplicitAs(UInt(N))]
// TODO: Add builtins for these to avoid emitting a call.
impl forall [N:! IntLiteral] UInt(N) as Dec {
impl forall [N: IntLiteral] UInt(N) as Dec {
fn Op(ref self) {
// TODO: `self -= 1;` should work, but fails because the `impl IntLiteral
// as ImplicitAs(Int(N))` is not final, which causes us to not attempt the
@@ -454,7 +454,7 @@ impl forall [N:! IntLiteral] UInt(N) as Dec {
}
}
impl forall [N:! IntLiteral] UInt(N) as Inc {
impl forall [N: IntLiteral] UInt(N) as Inc {
fn Op(ref self) {
fn AsUInt(n: IntLiteral) -> UInt(N) = "int.convert_checked";
self += AsUInt(1);
+1 -1
View File
@@ -16,7 +16,7 @@ import library "prelude/types/int";
import library "prelude/types/int_literal";
import library "prelude/types/optional";
class IntRange(N:! IntLiteral) {
class IntRange(N: IntLiteral) {
fn Make(start: Int(N), end: Int(N)) -> Self {
return {.start = start, .end = end};
}
+1 -1
View File
@@ -12,7 +12,7 @@ import library "io_utils";
// Read a sequence of lines each containing a pair of numbers into two arrays.
// Returns the number of lines read.
fn ReadInputs[N:! Core.IntLiteral](ref a: array(i32, N), ref b: array(i32, N)) -> i32 {
fn ReadInputs[N: Core.IntLiteral](ref a: array(i32, N), ref b: array(i32, N)) -> i32 {
for (i: i32 in Core.Range(N)) {
var av: i32;
var bv: i32;
+7 -7
View File
@@ -27,13 +27,13 @@ fn CharOrEOF.EOF() -> Self {
return (-1 as i32) as CharOrEOF;
}
impl forall [U:! Core.ImplicitAs(char)] U as Core.ImplicitAs(CharOrEOF) {
impl forall [U: Core.ImplicitAs(char)] U as Core.ImplicitAs(CharOrEOF) {
fn Convert(self: char) -> CharOrEOF {
return ((self as u8) as i32) as CharOrEOF;
}
}
impl forall [U:! Core.ImplicitAs(CharOrEOF)]
impl forall [U: Core.ImplicitAs(CharOrEOF)]
CharOrEOF as Core.EqWith(U) {
fn Equal(self, other: CharOrEOF) -> bool {
return (self as i32) == (other as i32);
@@ -43,7 +43,7 @@ impl forall [U:! Core.ImplicitAs(CharOrEOF)]
}
}
impl forall [U:! Core.ImplicitAs(CharOrEOF)]
impl forall [U: Core.ImplicitAs(CharOrEOF)]
CharOrEOF as Core.OrderedWith(U) {
fn Less(self, other: CharOrEOF) -> bool {
return (self as i32) < (other as i32);
@@ -59,7 +59,7 @@ impl forall [U:! Core.ImplicitAs(CharOrEOF)]
}
}
impl forall [U:! Core.ImplicitAs(char)]
impl forall [U: Core.ImplicitAs(char)]
CharOrEOF as Core.SubWith(U) where .Result = i32 {
fn Op(self, other: char) -> i32 {
return (self as i32) - ((other as u8) as i32);
@@ -105,7 +105,7 @@ fn ConsumeChar(c: char) -> bool {
return true;
}
fn ReadInt[N:! Core.IntLiteral](ref p: Core.Int(N)) -> bool {
fn ReadInt[N: Core.IntLiteral](ref p: Core.Int(N)) -> bool {
var read_any_digits: bool = false;
let negative: bool = ConsumeChar('-');
// TODO: `p = 0;` crashes the toolchain, see
@@ -133,7 +133,7 @@ fn ReadInt[N:! Core.IntLiteral](ref p: Core.Int(N)) -> bool {
return read_any_digits;
}
fn PrintIntNoNewline[N:! Core.IntLiteral](n_val: Core.Int(N)) {
fn PrintIntNoNewline[N: Core.IntLiteral](n_val: Core.Int(N)) {
// TODO: var pow10: Core.Int(N) = 1; crashes the toolchain.
var pow10: Core.Int(N) = (1 as i32) as Core.Int(N);
var n: Core.Int(N) = n_val;
@@ -152,7 +152,7 @@ fn PrintIntNoNewline[N:! Core.IntLiteral](n_val: Core.Int(N)) {
}
}
fn PrintInt[N:! Core.IntLiteral](n_val: Core.Int(N)) {
fn PrintInt[N: Core.IntLiteral](n_val: Core.Int(N)) {
PrintIntNoNewline(n_val);
Core.PrintChar('\n');
}
+3 -3
View File
@@ -19,14 +19,14 @@ impl i32 as Ordered {
fn GreaterOrEquivalent(self, other: Self) -> bool { return self >= other; }
}
fn Swap[T:! Core.Copy & Core.Destroy](ref from: T, ref to: T) {
fn Swap[T: Core.Copy & Core.Destroy](ref from: T, ref to: T) {
var tmp: T = from;
from = to;
to = tmp;
}
fn Partition
[T:! Core.Copy & Core.Destroy & Ordered, N:! Core.IntLiteral]
[T: Core.Copy & Core.Destroy & Ordered, N: Core.IntLiteral]
(ref a: array(T, N), from_in: i32, to_in: i32) -> i32 {
var pivot_index: i32 = from_in;
let pivot: T = a[pivot_index];
@@ -52,7 +52,7 @@ fn Partition
}
fn Quicksort
[T:! Core.Copy & Core.Destroy & Ordered, N:! Core.IntLiteral]
[T: Core.Copy & Core.Destroy & Ordered, N: Core.IntLiteral]
(ref a: array(T, N), from: i32, to: i32) {
if (from + 1 >= to) { return; }
var pivot: i32 = Partition(ref a, from, to);
+13 -13
View File
@@ -353,7 +353,7 @@ class RE2 {
fn FindAndConsumeN(input: StringPiece*, re: RE2,
args: Array(const Arg*), n: i32) -> bool;
private fn Apply[template F:! type, SP:! type](f: F, sp: SP, re: Self) {
private fn Apply[template F: type, SP: type](f: F, sp: SP, re: Self) {
return f(sp, re, nullptr, 0);
}
@@ -671,7 +671,7 @@ class RE2 {
// For now, make the default budget something close to Code Search.
// TODO: How to define a class-scope constant?
let kDefaultMaxMem:! i32 = 8 << 20;
let generic kDefaultMaxMem: i32 = 8 << 20;
enum Encoding {
EncodingUTF8 = 1,
@@ -762,9 +762,9 @@ class RE2 {
// Argument converters; see below.
// TODO: Should these be package members not class members in Carbon
// so you use `RE2.Hex` not `RE2.RE2.Hex`?
fn CRadix[T:! Parse4ary](ptr: T*) -> Self.Arg;
fn Hex[T:! Parse4ary](ptr: T*) -> Self.Arg;
fn Octal[T:! Parse4ary](ptr: T*) -> Self.Arg;
fn CRadix[T: Parse4ary](ptr: T*) -> Self.Arg;
fn Hex[T: Parse4ary](ptr: T*) -> Self.Arg;
fn Octal[T: Parse4ary](ptr: T*) -> Self.Arg;
private fn Init(addr self: Self, pattern: StringPiece, options: Options);
@@ -856,17 +856,17 @@ class RE2.Arg {
fn Parse(ref self, str: StringView, n: i64) -> bool;
}
match_first {
impl [T:! Parse3ary] T as Parseable {
impl [T: Parse3ary] T as Parseable {
fn Parse(ref self, str: StringView, n: i64) -> bool {
return T.Parse(str, n, self);
}
}
impl [T:! Parse4ary] T as Parseable {
impl [T: Parse4ary] T as Parseable {
fn Parse(ref self, str: StringView, n: i64) -> bool {
return T.Parse(str, n, self, 10);
}
}
impl [T:! ParseFrom] T as Parseable {
impl [T: ParseFrom] T as Parseable {
fn Parse(ref self, str: StringView, n: i64) -> bool {
if (self == nullptr) { return true; }
return T.Parse(str, n, self);
@@ -881,7 +881,7 @@ class RE2.Arg {
}
}
fn Make[T:! Parseable](ptr: T*) {
fn Make[T: Parseable](ptr: T*) {
return {.type_ = T, .arg_ = ptr};
}
@@ -894,7 +894,7 @@ class RE2.Arg {
private var arg_: Nullable(type_*);
}
private adapter ParseAsBase(T:! Parse4ary, base: i32) for T {
private adapter ParseAsBase(T: Parse4ary, base: i32) for T {
impl as Self.Arg.Parseable {
fn Parse(ref self, str: StringView, n: i64) -> bool {
return T.Parse(str, n, self, base);
@@ -902,15 +902,15 @@ private adapter ParseAsBase(T:! Parse4ary, base: i32) for T {
}
}
fn RE2.CRadix[T:! Parse4ary](ptr: T*) -> Self.Arg {
fn RE2.CRadix[T: Parse4ary](ptr: T*) -> Self.Arg {
return Self.Arg.Make(ptr as ParseAsBase(T, 0)*);
}
fn RE2.Hex[T:! Parse4ary](ptr: T*) -> Self.Arg {
fn RE2.Hex[T: Parse4ary](ptr: T*) -> Self.Arg {
return Self.Arg.Make(ptr as ParseAsBase(T, 16)*);
}
fn RE2.Octal[T:! Parse4ary](ptr: T*) -> Self.Arg {
fn RE2.Octal[T: Parse4ary](ptr: T*) -> Self.Arg {
return Self.Arg.Make(ptr as ParseAsBase(T, 8)*);
}
+1 -1
View File
@@ -2020,7 +2020,7 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id,
// Defer the action if it's dependent. We do this now rather than before
// attempting any conversion so that we can still perform builtin conversions
// on dependent arguments. This matters for things like converting a
// `template T:! SomeInterface` to `type`, where it's important to form a
// `template T: SomeInterface` to `type`, where it's important to form a
// `FacetAccessType` when checking the template. But when running the action
// later, we need to try builtin conversions again, because one may apply that
// didn't apply in the template definition.
+2 -2
View File
@@ -239,7 +239,7 @@ static auto GetAssociatedEntityScope(Context& context,
}
// Push a scope corresponding to a name qualifier. For example, for
// `fn Class(T:! type).F(n: i32)` we will push the scope for `Class(T:! type)`
// `fn Class(T: type).F(n: i32)` we will push the scope for `Class(T: type)`
// between the scope containing the declaration of `T` and the scope
// containing the declaration of `n`.
//
@@ -488,7 +488,7 @@ auto DeclNameStack::ResolveAsScope(const NameContext& name_context,
name_context.resolved_inst_id);
return InvalidResult;
}
// The scope and generic of an `I(T:! type)` is the outer
// The scope and generic of an `I(T: type)` is the outer
// interface-without-self. That is the generic where parameters appear.
// However when moving to the next qualifier, we need to move to the
// interface-with-self for the associated entity name.
+3 -3
View File
@@ -18,8 +18,8 @@ class Context;
// Provides support and stacking for qualified declaration name handling.
//
// A qualified declaration name will consist of entries, which are `Name`s
// optionally followed by generic parameter lists, such as `Vector(T:! type)`
// in `fn Vector(T:! type).Clear();`, but parameter lists aren't supported yet.
// optionally followed by generic parameter lists, such as `Vector(T: type)`
// in `fn Vector(T: type).Clear();`, but parameter lists aren't supported yet.
// Identifiers such as `Clear` will be resolved to a name if possible, for
// example when declaring things that are in a non-generic type or namespace,
// and are otherwise marked as an unresolved identifier.
@@ -36,7 +36,7 @@ class Context;
// appearing later in the declaration name itself. For example, in:
//
// ```
// fn ClassA.ClassB(T:! U).Fn() { var x: V; }
// fn ClassA.ClassB(T: U).Fn() { var x: V; }
// ```
//
// the lookup for `U` looks in `ClassA`; the lookup for `V` looks first in
+5 -5
View File
@@ -312,7 +312,7 @@ auto DeductionContext::Deduce() -> bool {
param_type_id =
SemIR::ExtractScrutineeType(context().sem_ir(), param_type_id);
} else if (context().types().IsFacetType(param_type_id)) {
// Given `fn F[G:! Interface](g: G)`, the type of `g` is `G as type`. For
// Given `fn F[G: Interface](g: G)`, the type of `g` is `G as type`. For
// deduction, we want to ignore the `as type`, and check that the argument
// can convert to the FacetType of the canonical facet value.
param_id = GetCanonicalFacetOrTypeValue(context(), param_id);
@@ -361,9 +361,9 @@ auto DeductionContext::Deduce() -> bool {
CARBON_KIND_SWITCH(param_inst) {
// Deducing a symbolic binding pattern from an argument deduces the
// binding as having that constant value. For example, deducing
// `(T:! type)` against `(i32)` deduces `T` to be `i32`. This only arises
// when initializing a generic parameter from an explicitly specified
// argument, and in this case, the argument is required to be a
// `(generic T: type)` against `(i32)` deduces `T` to be `i32`. This only
// arises when initializing a generic parameter from an explicitly
// specified argument, and in this case, the argument is required to be a
// compile-time constant.
case CARBON_KIND(SemIR::SymbolicBindingPattern bind): {
auto& entity_name = context().entity_names().Get(bind.entity_name_id);
@@ -403,7 +403,7 @@ auto DeductionContext::Deduce() -> bool {
// Deducing a symbolic binding appearing within an expression against a
// constant value deduces the binding as having that value. For example,
// deducing `[T:! type](x: T)` against `("foo")` deduces `T` as `String`.
// deducing `[T: type](x: T)` against `("foo")` deduces `T` as `String`.
case CARBON_KIND(SemIR::SymbolicBinding bind): {
auto& entity_name = context().entity_names().Get(bind.entity_name_id);
auto index = entity_name.bind_index();
+3 -3
View File
@@ -348,13 +348,13 @@ static auto TryFindValueInRewriteConstraints(
// The LHS of a rewrite can be an arbitrary type. For example:
// ```
// T:! Z where C impls (Y(.Self) where .Y1 = {})
// T: Z where C impls (Y(.Self) where .Y1 = {})
// ```
// The rewrite in the facet type will be `(C as Y(T)).Y1 = {}`.
//
// It can also be another ImplWitnessAccess. For example:
// ```
// T:! Z where .Z1 impls (Y where .Y1 = {})
// T: Z where .Z1 impls (Y where .Y1 = {})
// ```
// The rewrite in the facet type will be `((T as Z).Z1 as Y).Y1 = {}`.
//
@@ -371,7 +371,7 @@ static auto TryFindValueInRewriteConstraints(
// TODO: Requiring the rewrite to be against `.Self` is actually
// insufficient. For a facet like
// ```
// T:! type where C impls (Z(.Self) where .Z1 = ())
// T: type where C impls (Z(.Self) where .Z1 = ())
// ```
// and an access like `C.(Z(T).Z1)`, the root of the access is `C`. If we
// search `T` for a witness, we'd need the inner-most self facet to be `C`
+3 -3
View File
@@ -305,11 +305,11 @@ auto AttachDependentInstToCurrentGeneric(Context& context,
// unattached. This happens for out-of-line redeclarations of members of
// dependent scopes:
//
// class A(T:! type) {
// class A(T: type) {
// fn F();
// }
// // Has generic type and constant value, but no generic region.
// fn A(T:! type).F() {}
// fn A(T: type).F() {}
//
// TODO: Copy the attached type and constant value from the previous
// declaration in this case instead of attempting to attach the new
@@ -407,7 +407,7 @@ auto StartGenericDefinition(Context& context, SemIR::GenericId generic_id)
// have locally-introduced generic parameters to track:
//
// fn F() {
// let T:! type = i32;
// let generic T: type = i32;
// var x: T;
// }
context.generic_region_stack().Push(
+1 -1
View File
@@ -103,7 +103,7 @@ auto MakeSpecific(Context& context, SemIR::LocId loc_id,
-> SemIR::SpecificId;
// Builds the specific that describes how the generic should refer to itself.
// For example, for a generic `G(T:! type)`, this is the specific `G(T)`. If
// For example, for a generic `G(T: type)`, this is the specific `G(T)`. If
// `generic_id` is `None`, returns `None`.
auto MakeSelfSpecific(Context& context, SemIR::LocId loc_id,
SemIR::GenericId generic_id) -> SemIR::SpecificId;
+1 -1
View File
@@ -26,7 +26,7 @@ using ConstantsInGenericMap = Map<SemIR::InstId, SemIR::InstId, 256>;
//
// We split a generic into two regions -- declaration and definition -- because
// these are in general introduced separately, and substituted into separately.
// For example, for `class C(T:! type, N:! T) { var x: T; }`, a use such as
// For example, for `class C(T: type, N: T) { var x: T; }`, a use such as
// `C(i32, 0)*` substitutes into just the declaration, whereas a use such as
// `var x: C(i32, 0) = {.x = 0};` also substitutes into the definition.
class GenericRegionStack {
+33 -14
View File
@@ -52,21 +52,21 @@ static auto GetLeafBindingPatternInstKind(Parse::NodeKind node_kind,
}
// Returns true if a parameter is valid in the given `introducer_kind`.
static auto IsValidParamForIntroducer(Context& context, Parse::NodeId node_id,
// `is_deduced` is whether this is a deduced (`[...]`) parameter.
static auto IsValidParamForIntroducer(Context& context, SemIR::LocId loc_id,
SemIR::NameId name_id,
Lex::TokenKind introducer_kind,
bool is_generic) -> bool {
bool is_generic, bool is_deduced,
bool is_var) -> bool {
switch (introducer_kind) {
case Lex::TokenKind::Fn: {
// `self` in the implicit parameter list is diagnosed separately (see
// `SelfInImplicitParamList`), so skip it here to avoid a redundant
// diagnostic.
if (context.full_pattern_stack().CurrentKind() ==
FullPatternStack::Kind::ImplicitParamList &&
!(is_generic || name_id == SemIR::NameId::SelfValue)) {
if (is_deduced && !(is_generic || name_id == SemIR::NameId::SelfValue)) {
CARBON_DIAGNOSTIC(ImplictParamMustBeConstant, Error,
"implicit parameters of functions must be constant");
context.emitter().Emit(node_id, ImplictParamMustBeConstant);
context.emitter().Emit(loc_id, ImplictParamMustBeConstant);
return false;
}
// Parameters can have incomplete types in a function declaration, but not
@@ -80,8 +80,7 @@ static auto IsValidParamForIntroducer(Context& context, Parse::NodeId node_id,
// choice type itself.
// Implicit param lists are prevented during parse.
CARBON_CHECK(context.full_pattern_stack().CurrentKind() !=
FullPatternStack::Kind::ImplicitParamList,
CARBON_CHECK(!is_deduced,
"choice alternative with implicit parameters");
// Don't fall through to the `Class` logic for choice alternatives.
return true;
@@ -93,13 +92,20 @@ static auto IsValidParamForIntroducer(Context& context, Parse::NodeId node_id,
if (name_id == SemIR::NameId::SelfValue) {
CARBON_DIAGNOSTIC(SelfParameterNotAllowed, Error,
"`self` parameter only allowed on functions");
context.emitter().Emit(node_id, SelfParameterNotAllowed);
context.emitter().Emit(loc_id, SelfParameterNotAllowed);
return false;
}
if (!is_generic) {
CARBON_DIAGNOSTIC(GenericParamMustBeConstant, Error,
"parameters of generic types must be constant");
context.emitter().Emit(node_id, GenericParamMustBeConstant);
auto builder =
context.emitter().Build(loc_id, GenericParamMustBeConstant);
if (is_var) {
CARBON_DIAGNOSTIC(VarParamIsRuntime, Note,
"`var` parameters are runtime");
builder.Note(loc_id, VarParamIsRuntime);
}
builder.Emit();
return false;
}
return true;
@@ -111,7 +117,7 @@ static auto IsValidParamForIntroducer(Context& context, Parse::NodeId node_id,
namespace {
// Information about the expression in the type position of a binding pattern,
// i.e. the position following the `:`/`:?`/`:!` separator. Note that this
// i.e. the position following the `:` or `:?` separator. Note that this
// expression may be interpreted as a type or a form, depending on the binding
// kind.
struct BindingPatternTypeInfo {
@@ -197,6 +203,10 @@ static auto HandleAnyBindingPattern(
// A non-generic template binding is diagnosed by the parser.
is_template &= is_generic;
// The name in a runtime binding may be wrapped in `runtime`; discard it.
context.node_stack()
.PopAndDiscardSoloNodeIdIf<Parse::NodeKind::RuntimeBindingName>();
// The name in a runtime binding may be wrapped in `ref`.
bool is_ref =
context.node_stack()
@@ -290,8 +300,8 @@ static auto HandleAnyBindingPattern(
// TODO: We should re-evaluate the contents of the eval block in a
// synthesized specific to form these values, in order to propagate the
// values.
return context.TODO(node_id,
"local `let :!` bindings are currently unsupported");
return context.TODO(
node_id, "local generic `let` bindings are currently unsupported");
}
// Allocate an instruction of the appropriate kind, linked to the name for
@@ -299,8 +309,11 @@ static auto HandleAnyBindingPattern(
switch (context.full_pattern_stack().CurrentKind()) {
case FullPatternStack::Kind::ImplicitParamList:
case FullPatternStack::Kind::ExplicitParamList: {
bool is_deduced = context.full_pattern_stack().CurrentKind() ==
FullPatternStack::Kind::ImplicitParamList;
bool is_var = node_kind == Parse::NodeKind::VarBindingPattern;
if (!IsValidParamForIntroducer(context, node_id, name_id, introducer.kind,
is_generic)) {
is_generic, is_deduced, is_var)) {
if (name_id != SemIR::NameId::Underscore) {
AddNameToLookup(context, name_id, SemIR::ErrorInst::InstId);
}
@@ -557,6 +570,12 @@ auto HandleParseNode(Context& context, Parse::RefBindingNameId node_id)
return true;
}
auto HandleParseNode(Context& context, Parse::RuntimeBindingNameId node_id)
-> bool {
context.node_stack().Push(node_id);
return true;
}
auto HandleParseNode(Context& context, Parse::TemplateBindingNameId node_id)
-> bool {
context.node_stack().Push(node_id);
+1 -1
View File
@@ -674,7 +674,7 @@ static auto DiagnoseUnusedMarkersWithoutDefinition(
const auto& function = context.functions().Get(function_id);
// The `unused` modifier requires a definition, so it is not valid on any
// parameter when there is none. This applies to implicit parameters (such as
// `T:! type` introduced by `[...]`) too, so check the implicit parameter list
// `T: type` introduced by `[...]`) too, so check the implicit parameter list
// as well as the explicit one.
for (auto param_patterns_id :
{function.implicit_param_patterns_id, function.param_patterns_id}) {
+2 -2
View File
@@ -14,8 +14,8 @@ namespace Carbon::Check {
class Context;
// A component in a declaration name, such as `C[T:! type](N:! T)` in
// `fn C[T:! type](N:! T).F() {}`.
// A component in a declaration name, such as `C[T: type](N: T)` in
// `fn C[T: type](N: T).F() {}`.
struct NameComponent {
// The name of the declaration.
Parse::NodeId name_loc_id;
+1 -1
View File
@@ -70,7 +70,7 @@ auto LookupNameInDecl(Context& context, SemIR::LocId loc_id,
// - The name is redeclared by a parameter of the same entity:
//
// fn F() {
// class C(C:! type);
// class C(C: type);
// }
//
// In this case, the class C is not a redeclaration of its parameter, but
+1
View File
@@ -466,6 +466,7 @@ class NodeStack {
case Parse::NodeKind::LetIntroducer:
case Parse::NodeKind::NamedConstraintIntroducer:
case Parse::NodeKind::RefBindingName:
case Parse::NodeKind::RuntimeBindingName:
case Parse::NodeKind::ReturnStatementStart:
case Parse::NodeKind::StructLiteralStart:
case Parse::NodeKind::StructTypeLiteralField:
+1 -1
View File
@@ -115,7 +115,7 @@ auto BuildBinaryOperator(Context& context, SemIR::LocId loc_id, Operator op,
// For binary operators with a C++ class as at least one of the operands, try
// to import and call the C++ operator.
// TODO: Instead of hooking this here, change impl lookup, so that a generic
// constraint such as `T:! Core.Add` is satisfied by C++ class types that are
// constraint such as `T: Core.Add` is satisfied by C++ class types that are
// addable. See
// https://github.com/carbon-language/carbon-lang/pull/5996/files/5d01fa69511b76f87efbc0387f5e40abcf4c911a#r2308666348
// and
+1 -1
View File
@@ -15,7 +15,7 @@ namespace Carbon::Check {
// the `SymbolicBinding` instruction.
//
// The type of `.Self` must be a `FacetType`, so that it gets wrapped in
// `FacetAccessType` when used in a type position, such as in `U:! I(.Self)`.
// `FacetAccessType` when used in a type position, such as in `U: I(.Self)`.
// This allows substitution with other facet values without requiring an
// additional `FacetAccessType` to be inserted.
auto MakePeriodSelfFacetValue(Context& context, SemIR::LocId loc_id,
+4 -4
View File
@@ -39,7 +39,7 @@ let d: c = {};
library "[[@TEST_NAME]]";
class A(T:! type) {}
class A(T: type) {}
//@dump-sem-ir-begin
alias a = A({});
@@ -105,10 +105,10 @@ alias c = *b;
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_params.carbon:[[@LINE+4]]:8: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams]
// CHECK:STDERR: alias A(T:! type) = T*;
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: alias A(T: type) = T*;
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR:
alias A(T:! type) = T*;
alias A(T: type) = T*;
// --- fail_modifiers.carbon
+1 -1
View File
@@ -31,7 +31,7 @@ fn G(n: i32) -> i32 {
library "[[@TEST_NAME]]";
interface I {
let value:! array(i32, 1);
let value: array(i32, 1);
}
class C {}
+10 -10
View File
@@ -14,7 +14,7 @@
library "[[@TEST_NAME]]";
fn G(T:! type) {
fn G(generic T: type) {
// We can initialize this without knowing T.
//@dump-sem-ir-begin
var unused arr: array(T, 0) = ();
@@ -31,7 +31,7 @@ fn H() {
library "[[@TEST_NAME]]";
fn F(N:! i32) {
fn F(generic N: i32) {
// CHECK:STDERR: fail_init_dependent_bound.carbon:[[@LINE+4]]:35: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound]
// CHECK:STDERR: var unused arr: array(i32, N) = (1, 2, 3);
// CHECK:STDERR: ^~~~~~~~~
@@ -44,7 +44,7 @@ fn F(N:! i32) {
library "[[@TEST_NAME]]";
// TODO: This should be valid.
fn G(template N:! i32) {
fn G(template N: i32) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_init_template_dependent_bound.carbon:[[@LINE+4]]:19: error: cannot evaluate type expression [TypeExprEvaluationFailure]
// CHECK:STDERR: var unused arr: array(i32, N) = (1, 2, 3);
@@ -94,11 +94,11 @@ fn H() { G(3); }
// CHECK:STDOUT: %.a02: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.ccc, %Destroy.facet.396 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @G(%T.loc4_7.2: type) {
// CHECK:STDOUT: generic fn @G(%T.loc4_15.2: type) {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %array_type.loc7_29.2: type = array_type constants.%int_0, %T.loc4_7.1 [symbolic = %array_type.loc7_29.2 (constants.%array_type.1b3)]
// CHECK:STDOUT: %array_type.loc7_29.2: type = array_type constants.%int_0, %T.loc4_15.1 [symbolic = %array_type.loc7_29.2 (constants.%array_type.1b3)]
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %array_type.loc7_29.2 [symbolic = %require_complete (constants.%require_complete)]
// CHECK:STDOUT: %pattern_type: type = pattern_type %array_type.loc7_29.2 [symbolic = %pattern_type (constants.%pattern_type.bd6)]
// CHECK:STDOUT: %arr.patt.loc7_17.2: @G.%pattern_type (%pattern_type.bd6) = ref_binding_pattern arr [symbolic = %arr.patt.loc7_17.2 (constants.%arr.patt.770)]
@@ -119,7 +119,7 @@ fn H() { G(3); }
// CHECK:STDOUT: %.loc7_3.1: init @G.%array_type.loc7_29.2 (%array_type.1b3) = converted %.loc7_34.1, %.loc7_34.2 [symbolic = %array (constants.%array.ca4)]
// CHECK:STDOUT: assign %arr.var, %.loc7_3.1
// CHECK:STDOUT: %.loc7_29: type = splice_block %array_type.loc7_29.1 [symbolic = %array_type.loc7_29.2 (constants.%array_type.1b3)] {
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_7.2 [symbolic = %T.loc4_7.1 (constants.%T)]
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_15.2 [symbolic = %T.loc4_15.1 (constants.%T)]
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
// CHECK:STDOUT: %array_type.loc7_29.1: type = array_type %int_0, %T.ref [symbolic = %array_type.loc7_29.2 (constants.%array_type.1b3)]
// CHECK:STDOUT: }
@@ -146,13 +146,13 @@ fn H() { G(3); }
// CHECK:STDOUT: fn @Destroy.Op(%self.param: ref %array_type.988) = "no_op";
// CHECK:STDOUT:
// CHECK:STDOUT: specific @G(constants.%T) {
// CHECK:STDOUT: %T.patt.loc4_7.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc4_7.1 => constants.%T
// CHECK:STDOUT: %T.patt.loc4_15.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc4_15.1 => constants.%T
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @G(constants.%C) {
// CHECK:STDOUT: %T.patt.loc4_7.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc4_7.1 => constants.%C
// CHECK:STDOUT: %T.patt.loc4_15.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc4_15.1 => constants.%C
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %array_type.loc7_29.2 => constants.%array_type.988
+6 -6
View File
@@ -18,15 +18,15 @@
// works.
// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+4]]:8: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant]
// CHECK:STDERR: fn Foo[a: ()]();
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fn Foo[runtime a: ()]();
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR:
fn Foo[a: ()]();
fn Foo[runtime a: ()]();
// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+4]]:8: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant]
// CHECK:STDERR: fn Boo[a: ()]() {}
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fn Boo[runtime a: ()]() {}
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR:
fn Boo[a: ()]() {}
fn Boo[runtime a: ()]() {}
// CHECK:STDOUT: --- fail_multi_error.carbon
// CHECK:STDOUT:
+1 -1
View File
@@ -13,7 +13,7 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/raw_sem_ir/bundle.carbon
fn F(Form:! Core.Form) ->? Form;
fn F(generic Form: Core.Form) ->? Form;
// CHECK:STDOUT: ---
// CHECK:STDOUT: filename: bundle.carbon
@@ -16,21 +16,21 @@
// --- non_core.carbon
package NonCore;
interface Destroy {
let T1:! type;
let T2:! type;
let T1: type;
let T2: type;
}
// --- main.carbon
import NonCore;
interface Copy {
let T1:! type;
let T2:! type;
let T1: type;
let T2: type;
}
//@dump-sem-ir-begin
fn UseNonCoreDestroy[T:! NonCore.Destroy](_: T.T1, _: T.T2) {}
fn UseLocalCopy[T:! Copy](_: T.T1, _: T.T2) {}
fn UseNonCoreDestroy[T: NonCore.Destroy](_: T.T1, _: T.T2) {}
fn UseLocalCopy[T: Copy](_: T.T1, _: T.T2) {}
//@dump-sem-ir-end
// CHECK:STDOUT: ---
+1 -1
View File
@@ -13,7 +13,7 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/raw_sem_ir/one_file.carbon
fn Foo[T:! type](p: T*) -> (T*, ()) {
fn Foo[T: type](p: T*) -> (T*, ()) {
return (p, ());
}
+2 -2
View File
@@ -16,7 +16,7 @@ library "[[@TEST_NAME]]";
fn Eq(a: bool, b: bool) -> bool = "bool.eq";
class C(B:! bool) {}
class C(B: bool) {}
fn True() -> C(true);
fn False() -> C(false);
@@ -32,7 +32,7 @@ var d: C(Eq(false, false)) = True();
library "[[@TEST_NAME]]";
class C(B:! bool) {}
class C(B: bool) {}
fn True() -> C(true);
fn False() -> C(false);
+2 -2
View File
@@ -16,7 +16,7 @@ library "[[@TEST_NAME]]";
fn Neq(a: bool, b: bool) -> bool = "bool.neq";
class C(B:! bool) {}
class C(B: bool) {}
fn True() -> C(true);
fn False() -> C(false);
@@ -32,7 +32,7 @@ var d: C(Neq(false, false)) = False();
library "[[@TEST_NAME]]";
class C(B:! bool) {}
class C(B: bool) {}
fn True() -> C(true);
fn False() -> C(false);
+2 -2
View File
@@ -23,8 +23,8 @@ fn ConvertF64ToIntLiteral(a: f64) -> Core.IntLiteral = "float.convert_int";
fn Negate(a: f64) -> f64 = "float.negate";
fn Div(a: f64, b: f64) -> f64 = "float.div";
class Expect[T:! type](N:! T) {}
fn Test[T:! type](N:! T) -> Expect(N) { return {}; }
class Expect[T: type](N: T) {}
fn Test[T: type](generic N: T) -> Expect(N) { return {}; }
// --- identity.carbon
library "[[@TEST_NAME]]";
+2 -2
View File
@@ -31,8 +31,8 @@ library "[[@TEST_NAME]]";
fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
class Expect(N:! Core.IntLiteral) {}
fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; }
class Expect(N: Core.IntLiteral) {}
fn Test(generic N: Core.IntLiteral) -> Expect(N) { return {}; }
fn F() {
Test(And(1, 2)) as Expect(0);
+2 -2
View File
@@ -32,8 +32,8 @@ library "[[@TEST_NAME]]";
fn Complement(a: Core.IntLiteral) -> Core.IntLiteral = "int.complement";
class Expect(N:! Core.IntLiteral) {}
fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; }
class Expect(N: Core.IntLiteral) {}
fn Test(generic N: Core.IntLiteral) -> Expect(N) { return {}; }
fn F() {
Test(Complement(0)) as Expect(-1);
+2 -2
View File
@@ -43,8 +43,8 @@ fn UInt16ToChar(a: u16) -> u8 = "int.convert_char";
fn UInt32ToChar(a: u32) -> u8 = "int.convert_char";
fn UInt64ToChar(a: u64) -> u8 = "int.convert_char";
class Expect[T:! type](N:! T) {}
fn Test[T:! type](N:! T) -> Expect(N) { return {}; }
class Expect[T: type](N: T) {}
fn Test[T: type](generic N: T) -> Expect(N) { return {}; }
// --- runtime_call.carbon
+2 -2
View File
@@ -20,8 +20,8 @@ fn ConvertIntLiteralToFloatLiteral(a: Core.IntLiteral) -> Core.FloatLiteral = "i
fn Negate(a: f64) -> f64 = "float.negate";
class Expect[T:! type](N:! T) {}
fn Test[T:! type](N:! T) -> Expect(N) { return {}; }
class Expect[T: type](N: T) {}
fn Test[T: type](generic N: T) -> Expect(N) { return {}; }
// --- identity.carbon
library "[[@TEST_NAME]]";
@@ -16,8 +16,8 @@ library "[[@TEST_NAME]]";
fn ConvertIntLiteralToFloatLiteral(a: Core.IntLiteral) -> Core.FloatLiteral = "int.convert_float_checked";
fn ConvertIntLiteralToF32(a: Core.IntLiteral) -> f32 = "int.convert_float_checked";
class Expect[T:! type](N:! T) {}
fn Test[T:! type](N:! T) -> Expect(N) { return {}; }
class Expect[T: type](N: T) {}
fn Test[T: type](generic N: T) -> Expect(N) { return {}; }
// --- identity.carbon
library "[[@TEST_NAME]]";
+4 -4
View File
@@ -46,8 +46,8 @@ library "[[@TEST_NAME]]";
fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq";
class Expect(B:! bool) {}
fn Test(B:! bool) -> Expect(B) { return {}; }
class Expect(B: bool) {}
fn Test(generic B: bool) -> Expect(B) { return {}; }
fn F() {
Test(Eq(5, 5)) as Expect(true);
@@ -62,8 +62,8 @@ library "[[@TEST_NAME]]";
fn Eq(a: Core.IntLiteral, b: i32) -> bool = "int.eq";
class Expect(B:! bool) {}
fn Test(B:! bool) -> Expect(B) { return {}; }
class Expect(B: bool) {}
fn Test(generic B: bool) -> Expect(B) { return {}; }
fn F() {
Test(Eq(5, 5)) as Expect(true);
+4 -4
View File
@@ -40,8 +40,8 @@ library "[[@TEST_NAME]]";
fn GreaterEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.greater_eq";
class Expect(B:! bool) {}
fn Test(B:! bool) -> Expect(B) { return {}; }
class Expect(B: bool) {}
fn Test(generic B: bool) -> Expect(B) { return {}; }
fn F() {
Test(GreaterEq(5, 5)) as Expect(true);
@@ -58,8 +58,8 @@ library "[[@TEST_NAME]]";
fn GreaterEq(a: Core.IntLiteral, b: i32) -> bool = "int.greater_eq";
class Expect(B:! bool) {}
fn Test(B:! bool) -> Expect(B) { return {}; }
class Expect(B: bool) {}
fn Test(generic B: bool) -> Expect(B) { return {}; }
fn F() {
Test(GreaterEq(5, 5)) as Expect(true);
+6 -6
View File
@@ -14,8 +14,8 @@
library "[[@TEST_NAME]]";
class Expect(N:! i32) {}
fn Test(N:! i32) -> Expect(N) { return {}; }
class Expect(N: i32) {}
fn Test(generic N: i32) -> Expect(N) { return {}; }
fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift";
@@ -40,8 +40,8 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> i32 {
library "[[@TEST_NAME]]";
class Expect(N:! u32) {}
fn Test(N:! u32) -> Expect(N) { return {}; }
class Expect(N: u32) {}
fn Test(generic N: u32) -> Expect(N) { return {}; }
fn LeftShift(a: u32, b: i32) -> u32 = "int.left_shift";
@@ -68,8 +68,8 @@ library "[[@TEST_NAME]]";
fn LeftShift(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift";
class Expect(N:! Core.IntLiteral) {}
fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; }
class Expect(N: Core.IntLiteral) {}
fn Test(generic N: Core.IntLiteral) -> Expect(N) { return {}; }
fn F() {
// Zero can be shifted by any amount.
+4 -4
View File
@@ -40,8 +40,8 @@ library "[[@TEST_NAME]]";
fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq";
class Expect(B:! bool) {}
fn Test(B:! bool) -> Expect(B) { return {}; }
class Expect(B: bool) {}
fn Test(generic B: bool) -> Expect(B) { return {}; }
fn F() {
Test(LessEq(5, 5)) as Expect(true);
@@ -58,8 +58,8 @@ library "[[@TEST_NAME]]";
fn LessEq(a: Core.IntLiteral, b: i32) -> bool = "int.less_eq";
class Expect(B:! bool) {}
fn Test(B:! bool) -> Expect(B) { return {}; }
class Expect(B: bool) {}
fn Test(generic B: bool) -> Expect(B) { return {}; }
fn F() {
Test(LessEq(5, 5)) as Expect(true);
@@ -24,7 +24,7 @@ library "[[@TEST_NAME]]";
import library "types";
fn Copy[N:! IntLiteral](x: Int(N)) -> Int(N) = "primitive_copy";
fn Copy[N: IntLiteral](x: Int(N)) -> Int(N) = "primitive_copy";
fn F(n: Int(64)) ->
//@dump-sem-ir-begin
@@ -42,7 +42,7 @@ fn G(n: Int(13)) ->
return Copy(n);
}
fn Symbolic(N:! IntLiteral, x: Int(N)) -> Int(N) {
fn Symbolic(generic N: IntLiteral, x: Int(N)) -> Int(N) {
return Copy(x);
}
@@ -24,7 +24,7 @@ library "[[@TEST_NAME]]";
import library "types";
fn Copy[N:! IntLiteral](x: UInt(N)) -> UInt(N) = "primitive_copy";
fn Copy[N: IntLiteral](x: UInt(N)) -> UInt(N) = "primitive_copy";
fn F(n: UInt(64)) ->
//@dump-sem-ir-begin
@@ -42,7 +42,7 @@ fn G(n: UInt(13)) ->
return Copy(n);
}
fn Symbolic(N:! IntLiteral, x: UInt(N)) -> UInt(N)
fn Symbolic(generic N: IntLiteral, x: UInt(N)) -> UInt(N)
{
return Copy(x);
}
+6 -6
View File
@@ -14,8 +14,8 @@
library "[[@TEST_NAME]]";
class Expect(N:! i32) {}
fn Test(N:! i32) -> Expect(N) { return {}; }
class Expect(N: i32) {}
fn Test(generic N: i32) -> Expect(N) { return {}; }
fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift";
@@ -40,8 +40,8 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> i32 {
library "[[@TEST_NAME]]";
class Expect(N:! u32) {}
fn Test(N:! u32) -> Expect(N) { return {}; }
class Expect(N: u32) {}
fn Test(generic N: u32) -> Expect(N) { return {}; }
fn RightShift(a: u32, b: i32) -> u32 = "int.right_shift";
@@ -67,8 +67,8 @@ library "[[@TEST_NAME]]";
fn RightShift(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.right_shift";
class Expect(N:! Core.IntLiteral) {}
fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; }
class Expect(N: Core.IntLiteral) {}
fn Test(generic N: Core.IntLiteral) -> Expect(N) { return {}; }
fn F() {
Test(RightShift(0, 31)) as Expect(0);
+4 -4
View File
@@ -16,8 +16,8 @@ library "[[@TEST_NAME]]";
fn Add(a: i32, b: i32) -> i32 = "int.sadd";
class Expect(N:! i32) {}
fn Test(N:! i32) -> Expect(N) { return {}; }
class Expect(N: i32) {}
fn Test(generic N: i32) -> Expect(N) { return {}; }
fn F() {
Test(Add(0, 0)) as Expect(0);
@@ -37,8 +37,8 @@ library "[[@TEST_NAME]]";
fn Add(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.sadd";
class Expect(N:! Core.IntLiteral) {}
fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; }
class Expect(N: Core.IntLiteral) {}
fn Test(generic N: Core.IntLiteral) -> Expect(N) { return {}; }
fn F() {
Test(Add(0, 0)) as Expect(0);
+2 -2
View File
@@ -52,8 +52,8 @@ library "[[@TEST_NAME]]";
fn Div(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.sdiv";
class Expect(N:! Core.IntLiteral) {}
fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; }
class Expect(N: Core.IntLiteral) {}
fn Test(generic N: Core.IntLiteral) -> Expect(N) { return {}; }
fn F() {
Test(Div(-0x8000_0000, -1)) as Expect(0x8000_0000);
+4 -4
View File
@@ -16,8 +16,8 @@ library "[[@TEST_NAME]]";
fn Mul(a: i32, b: i32) -> i32 = "int.smul";
class Expect(N:! i32) {}
fn Test(N:! i32) -> Expect(N) { return {}; }
class Expect(N: i32) {}
fn Test(generic N: i32) -> Expect(N) { return {}; }
fn F() {
Test(Mul(0, 0)) as Expect(0);
@@ -40,8 +40,8 @@ library "[[@TEST_NAME]]";
fn Mul(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.smul";
class Expect(N:! Core.IntLiteral) {}
fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; }
class Expect(N: Core.IntLiteral) {}
fn Test(generic N: Core.IntLiteral) -> Expect(N) { return {}; }
fn F() {
Test(Mul(0, 0)) as Expect(0);
+2 -2
View File
@@ -34,8 +34,8 @@ library "[[@TEST_NAME]]";
fn Negate(a: Core.IntLiteral) -> Core.IntLiteral = "int.snegate";
fn Sub(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.ssub";
class Expect(N:! Core.IntLiteral) {}
fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; }
class Expect(N: Core.IntLiteral) {}
fn Test(generic N: Core.IntLiteral) -> Expect(N) { return {}; }
fn F() {
Test(Negate(0)) as Expect(0);
+2 -2
View File
@@ -108,8 +108,8 @@ library "[[@TEST_NAME]]";
fn Negate(a: u32) -> u32 = "int.unegate";
class Expect(N:! u32) {}
fn Test(N:! u32) -> Expect(N) { return {}; }
class Expect(N: u32) {}
fn Test(generic N: u32) -> Expect(N) { return {}; }
fn F() {
// -(-INT_MAX) is INT_MAX.
@@ -48,10 +48,10 @@ library "[[@TEST_NAME]]";
fn NoParam() -> type = "maybe_unformed.make_type";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "maybe_unformed.make_type" [InvalidBuiltinSignature]
// CHECK:STDERR: fn ColonBangParam(T:! type) -> type = "maybe_unformed.make_type";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fn ColonBangParam(generic T: type) -> type = "maybe_unformed.make_type";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn ColonBangParam(T:! type) -> type = "maybe_unformed.make_type";
fn ColonBangParam(generic T: type) -> type = "maybe_unformed.make_type";
// CHECK:STDOUT: --- use_types.carbon
// CHECK:STDOUT:
+1 -1
View File
@@ -35,7 +35,7 @@ fn TestC(c: MakeUnformed(C*)) -> bool {
library "[[@TEST_NAME]]";
fn MakeUnformed(t: type) -> type = "maybe_unformed.make_type";
fn IsNull[T:! type](p: MakeUnformed(T*)) -> bool = "pointer.is_null";
fn IsNull[T: type](p: MakeUnformed(T*)) -> bool = "pointer.is_null";
class C {}
+1 -1
View File
@@ -30,7 +30,7 @@ let c: MakeUnformed(C*) = MakeNullC();
library "[[@TEST_NAME]]";
fn MakeUnformed(t: type) -> type = "maybe_unformed.make_type";
fn MakeNull(T:! type) -> MakeUnformed(T*) = "pointer.make_null";
fn MakeNull(generic T: type) -> MakeUnformed(T*) = "pointer.make_null";
class C {}
+8 -8
View File
@@ -19,7 +19,7 @@ fn TypeAnd(a: type, b: type) -> type = "type.and";
interface I {}
interface J {}
fn TakeIJ(unused T:! TypeAnd(I, J)) {}
fn TakeIJ(unused generic T: TypeAnd(I, J)) {}
class IJ {
impl as I {}
@@ -39,7 +39,7 @@ fn TypeAnd(a: type, b: type) -> type = "type.and";
interface I {}
interface J {}
fn TakeIJ(unused T:! TypeAnd(I, J)) {}
fn TakeIJ(unused generic T: TypeAnd(I, J)) {}
class JustI {
impl as I {}
@@ -53,17 +53,17 @@ fn Call() {
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+7]]:3: error: cannot convert type `JustI` into type implementing `I & J` [ConversionFailureTypeToFacet]
// CHECK:STDERR: TakeIJ(JustI);
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-14]]:18: note: initializing generic parameter `T` declared here [InitializingGenericParam]
// CHECK:STDERR: fn TakeIJ(unused T:! TypeAnd(I, J)) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-14]]:26: note: initializing generic parameter `T` declared here [InitializingGenericParam]
// CHECK:STDERR: fn TakeIJ(unused generic T: TypeAnd(I, J)) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
// CHECK:STDERR:
TakeIJ(JustI);
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+7]]:3: error: cannot convert type `JustJ` into type implementing `I & J` [ConversionFailureTypeToFacet]
// CHECK:STDERR: TakeIJ(JustJ);
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-22]]:18: note: initializing generic parameter `T` declared here [InitializingGenericParam]
// CHECK:STDERR: fn TakeIJ(unused T:! TypeAnd(I, J)) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-22]]:26: note: initializing generic parameter `T` declared here [InitializingGenericParam]
// CHECK:STDERR: fn TakeIJ(unused generic T: TypeAnd(I, J)) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
// CHECK:STDERR:
TakeIJ(JustJ);
}
+3 -3
View File
@@ -11,7 +11,7 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/choice/generic.carbon
//@dump-sem-ir-begin
choice Always(T:! type) {
choice Always(T: type) {
Sunny
}
//@dump-sem-ir-end
@@ -41,9 +41,9 @@ choice Always(T:! type) {
// CHECK:STDOUT: %Always.decl: %Always.type = class_decl @Always [concrete = constants.%Always.generic] {
// CHECK:STDOUT: %T.patt.loc14_16.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_16.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc14_19.1: type = splice_block %.loc14_19.2 [concrete = type] {
// CHECK:STDOUT: %.loc14_18.1: type = splice_block %.loc14_18.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc14_19.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc14_18.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc14_16.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_16.1 (constants.%T)]
// CHECK:STDOUT: }
+1 -1
View File
@@ -39,7 +39,7 @@ choice C {
// --- fail_todo_generic_params.carbon
library "[[@TEST_NAME]]";
choice C(T:! type) {
choice C(T: type) {
// CHECK:STDERR: fail_todo_generic_params.carbon:[[@LINE+4]]:6: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
// CHECK:STDERR: Alt(a: T)
// CHECK:STDERR: ^~~~~~
@@ -14,7 +14,7 @@
library "[[@TEST_NAME]]";
class Adapter(T:! type) {
class Adapter(T: type) {
extend adapt T*;
}
@@ -31,7 +31,7 @@ fn F(p: Adapter(X)*) {
library "[[@TEST_NAME]]";
class Adapter(T:! type) {
class Adapter(T: type) {
extend adapt T*;
}
@@ -47,7 +47,7 @@ fn F(p: Adapter(X)*) {
library "[[@TEST_NAME]]";
class Adapter(T:! type);
class Adapter(T: type);
class X {}
+5 -5
View File
@@ -67,7 +67,7 @@ library "[[@TEST_NAME]]";
class C {}
class D(template T:! type) {}
class D(template T: type) {}
//@dump-sem-ir-begin
fn F() {
@@ -78,10 +78,10 @@ fn F() {
// --- generic_use_inside_generic.carbon
library "[[@TEST_NAME]]";
class C(template T:! type) {}
class C(template T: type) {}
//@dump-sem-ir-begin
fn F(template T:! type) {
fn F(template T: type) {
var unused v: C(T) = {};
}
//@dump-sem-ir-end
@@ -487,9 +487,9 @@ fn G() { F({}); }
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
// CHECK:STDOUT: %T.patt.loc6_16.1: %pattern_type.98f = symbolic_binding_pattern T, 0, template [template = %T.patt.loc6_16.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc6_19.1: type = splice_block %.loc6_19.2 [concrete = type] {
// CHECK:STDOUT: %.loc6_18.1: type = splice_block %.loc6_18.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc6_19.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc6_18.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc6_16.2: type = symbolic_binding T, 0, template [template = %T.loc6_16.1 (constants.%T)]
// CHECK:STDOUT: }
+4 -4
View File
@@ -12,11 +12,11 @@
// --- fail_virtual_fn_in_invalid_context.carbon
// CHECK:STDERR: fail_virtual_fn_in_invalid_context.carbon:[[@LINE+4]]:17: error: name `error_not_found` not found [NameNotFound]
// CHECK:STDERR: fn F(unused N:! error_not_found) {
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR: fail_virtual_fn_in_invalid_context.carbon:[[@LINE+4]]:24: error: name `error_not_found` not found [NameNotFound]
// CHECK:STDERR: fn F(unused generic N: error_not_found) {
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR:
fn F(unused N:! error_not_found) {
fn F(unused generic N: error_not_found) {
base class C {
virtual fn Foo(unused self) {}
}
+1 -1
View File
@@ -14,7 +14,7 @@ class Class {
fn F() -> ();
}
// TODO: Use `:!` here once it is available.
// TODO: Use `generic` here once local generic `let` bindings are supported.
let T: type = Class;
// The class name is required to be written in the same way as in the class
+22
View File
@@ -0,0 +1,22 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_var_param.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_var_param.carbon
// A `var` parameter is not constant, so it is not allowed as a parameter of a
// generic type.
// CHECK:STDERR: fail_var_param.carbon:[[@LINE+7]]:13: error: parameters of generic types must be constant [GenericParamMustBeConstant]
// CHECK:STDERR: class C(var x: i32);
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: fail_var_param.carbon:[[@LINE+4]]:13: note: `var` parameters are runtime [VarParamIsRuntime]
// CHECK:STDERR: class C(var x: i32);
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
class C(var x: i32);
+22 -22
View File
@@ -17,17 +17,17 @@
library "[[@TEST_NAME]]";
class Class {
// CHECK:STDERR: fail_let.carbon:[[@LINE+4]]:7: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo]
// CHECK:STDERR: let A:! type = Class;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_let.carbon:[[@LINE+4]]:15: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo]
// CHECK:STDERR: let generic A: type = Class;
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
let A:! type = Class;
let generic A: type = Class;
// CHECK:STDERR: fail_let.carbon:[[@LINE+4]]:7: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo]
// CHECK:STDERR: let template B:! type = Class;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR: let template B: type = Class;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
// CHECK:STDERR:
let template B:! type = Class;
let template B: type = Class;
}
// --- fail_var.carbon
@@ -35,21 +35,21 @@ class Class {
library "[[@TEST_NAME]]";
class Class {
// CHECK:STDERR: fail_var.carbon:[[@LINE+8]]:7: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: var C:! type = Class;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_var.carbon:[[@LINE+8]]:15: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: var generic C: type = Class;
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:16: error: found `:!` pattern inside `var` pattern [NonRegularBindingInVarDecl]
// CHECK:STDERR: var C:! type = Class;
// CHECK:STDERR: ^
// CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:23: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl]
// CHECK:STDERR: var generic C: type = Class;
// CHECK:STDERR: ^
// CHECK:STDERR:
var C:! type = Class;
var generic C: type = Class;
// CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:25: error: found `:!` pattern inside `var` pattern [NonRegularBindingInVarDecl]
// CHECK:STDERR: var template D:! type = Class;
// CHECK:STDERR: ^
// CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:24: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl]
// CHECK:STDERR: var template D: type = Class;
// CHECK:STDERR: ^
// CHECK:STDERR:
var template D:! type = Class;
var template D: type = Class;
}
var x: Class = {};
@@ -76,18 +76,18 @@ var x: Class = {};
// CHECK:STDOUT:
// CHECK:STDOUT: class @Class {
// CHECK:STDOUT: %Class.ref.loc9: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
// CHECK:STDOUT: %.loc9_11.1: type = splice_block %.loc9_11.2 [concrete = type] {
// CHECK:STDOUT: %.loc9_18.1: type = splice_block %.loc9_18.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc9: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc9_11.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc9_18.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %A: type = wrapper_binding A, %Class.ref.loc9
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %A.patt: %pattern_type = value_binding_pattern A [concrete = constants.%A.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Class.ref.loc15: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
// CHECK:STDOUT: %.loc15_20.1: type = splice_block %.loc15_20.2 [concrete = type] {
// CHECK:STDOUT: %.loc15_19.1: type = splice_block %.loc15_19.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc15: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc15_20.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc15_19.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %B: type = wrapper_binding B, %Class.ref.loc15
// CHECK:STDOUT: name_binding_decl {
@@ -32,12 +32,12 @@ var C2: Class = {};
library "[[@TEST_NAME]]";
interface I {
let Default:! Self;
let Default: Self;
}
impl i32 as I where .Default = 123 {}
class Class(T:! I) {
class Class(T: I) {
var x: T = T.Default;
}
+12 -12
View File
@@ -16,7 +16,7 @@
library "[[@TEST_NAME]]";
class C(T:! type) {
class C(T: type) {
var x: T;
}
@@ -42,7 +42,7 @@ fn ImportedAccess(a: Adapter) -> i32 {
library "[[@TEST_NAME]]";
class C(T:! type) {
class C(T: type) {
var x: T;
}
@@ -69,7 +69,7 @@ fn Access(a: Adapter) -> i32 {
library "[[@TEST_NAME]]";
class C(T:! type) {
class C(T: type) {
var x: T;
}
@@ -99,7 +99,7 @@ fn ImportedAccess(a: Adapter) -> i32 {
library "[[@TEST_NAME]]";
class Adapter(T:! type) {
class Adapter(T: type) {
adapt T;
}
@@ -200,9 +200,9 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 {
// CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
// CHECK:STDOUT: %T.patt.loc4_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_10.2 (constants.%T.patt.d47)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_13.1: type = splice_block %.loc4_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_12.1: type = splice_block %.loc4_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_10.1 (constants.%T.67d)]
// CHECK:STDOUT: }
@@ -532,9 +532,9 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 {
// CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
// CHECK:STDOUT: %T.patt.loc4_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_10.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_13.1: type = splice_block %.loc4_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_12.1: type = splice_block %.loc4_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_10.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -676,9 +676,9 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 {
// CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
// CHECK:STDOUT: %T.patt.loc7_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_10.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc7_13.1: type = splice_block %.loc7_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc7_12.1: type = splice_block %.loc7_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc7_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc7_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc7_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc7_10.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -954,9 +954,9 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 {
// CHECK:STDOUT: %Adapter.decl: %Adapter.type = class_decl @Adapter [concrete = constants.%Adapter.generic] {
// CHECK:STDOUT: %T.patt.loc4_16.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_16.2 (constants.%T.patt.d47)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_19.1: type = splice_block %.loc4_19.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_18.1: type = splice_block %.loc4_18.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_19.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_18.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_16.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_16.1 (constants.%T.67d)]
// CHECK:STDOUT: }
+12 -12
View File
@@ -16,7 +16,7 @@
library "[[@TEST_NAME]]";
base class Base(T:! type) {
base class Base(T: type) {
var x: T;
}
@@ -46,7 +46,7 @@ fn ImportedDoubleFieldAccess(d: Derived) -> i32 {
library "[[@TEST_NAME]]";
class C(T:! type) {
class C(T: type) {
// CHECK:STDERR: fail_todo_extend_symbolic_base.carbon:[[@LINE+4]]:16: error: deriving from final type `T`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: extend base: T;
// CHECK:STDERR: ^
@@ -66,11 +66,11 @@ fn F() {
library "[[@TEST_NAME]]";
base class X(U:! type) {
base class X(U: type) {
fn G() -> U { return G(); }
}
class C(T:! type) {
class C(T: type) {
extend base: X(T);
}
@@ -171,9 +171,9 @@ fn H() {
// CHECK:STDOUT: %Base.decl: %Base.type = class_decl @Base [concrete = constants.%Base.generic] {
// CHECK:STDOUT: %T.patt.loc4_18.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_18.2 (constants.%T.patt.d47)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_21.1: type = splice_block %.loc4_21.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_21.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_20.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_18.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_18.1 (constants.%T.67d)]
// CHECK:STDOUT: }
@@ -516,9 +516,9 @@ fn H() {
// CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
// CHECK:STDOUT: %T.patt.loc4_10.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_10.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_13.1: type = splice_block %.loc4_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_12.1: type = splice_block %.loc4_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_10.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -665,18 +665,18 @@ fn H() {
// CHECK:STDOUT: %X.decl: %X.type = class_decl @X [concrete = constants.%X.generic] {
// CHECK:STDOUT: %U.patt.loc4_15.1: %pattern_type.98f = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc4_15.2 (constants.%U.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_18.1: type = splice_block %.loc4_18.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_18.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc4_15.2: type = symbolic_binding U, 0 [symbolic = %U.loc4_15.1 (constants.%U)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
// CHECK:STDOUT: %T.patt.loc8_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_10.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc8_13.1: type = splice_block %.loc8_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc8_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc8_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc8_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_10.1 (constants.%T)]
// CHECK:STDOUT: }
+4 -4
View File
@@ -15,7 +15,7 @@
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
class Class(T:! Core.Copy) {
class Class(T: Core.Copy) {
fn GetAddr(ref self) -> T* {
return &self.k;
}
@@ -27,7 +27,7 @@ class Class(T:! Core.Copy) {
var k: T;
}
class Declaration(T:! type);
class Declaration(T: type);
//@dump-sem-ir-end
@@ -111,9 +111,9 @@ class Declaration(T:! type);
// CHECK:STDOUT: %Declaration.decl: %Declaration.type = class_decl @Declaration [concrete = constants.%Declaration.generic] {
// CHECK:STDOUT: %T.patt.loc17_20.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_20.2 (constants.%T.patt.d47)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc17_23.1: type = splice_block %.loc17_23.2 [concrete = type] {
// CHECK:STDOUT: %.loc17_22.1: type = splice_block %.loc17_22.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc17_23.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc17_22.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc17_20.2: type = symbolic_binding T, 0 [symbolic = %T.loc17_20.1 (constants.%T.67d)]
// CHECK:STDOUT: }
+64 -64
View File
@@ -16,7 +16,7 @@
library "[[@TEST_NAME]]";
class Class(T:! type, N:! i32) {}
class Class(T: type, N: i32) {}
var a: Class(i32*, 5);
@@ -27,14 +27,14 @@ var b: Class((), 0);
library "[[@TEST_NAME]]";
class Class(T:! type, N:! i32) {}
class Class(T: type, N: i32) {}
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+7]]:8: error: 1 argument passed to generic class expecting 2 arguments [CallArgCountMismatch]
// CHECK:STDERR: var a: Class(i32*);
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR: fail_too_few.carbon:[[@LINE-5]]:1: note: calling generic class declared here [InCallToEntity]
// CHECK:STDERR: class Class(T:! type, N:! i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: class Class(T: type, N: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
var a: Class(i32*);
@@ -42,14 +42,14 @@ var a: Class(i32*);
library "[[@TEST_NAME]]";
class Class(T:! type, N:! i32) {}
class Class(T: type, N: i32) {}
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+7]]:8: error: 3 arguments passed to generic class expecting 2 arguments [CallArgCountMismatch]
// CHECK:STDERR: var a: Class(i32*, 1, 2);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_too_many.carbon:[[@LINE-5]]:1: note: calling generic class declared here [InCallToEntity]
// CHECK:STDERR: class Class(T:! type, N:! i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: class Class(T: type, N: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
var a: Class(i32*, 1, 2);
@@ -57,7 +57,7 @@ var a: Class(i32*, 1, 2);
library "[[@TEST_NAME]]";
class Class(T:! type, N:! i32) {}
class Class(T: type, N: i32) {}
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+10]]:8: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
// CHECK:STDERR: var a: Class(5, i32*);
@@ -66,15 +66,15 @@ class Class(T:! type, N:! i32) {}
// CHECK:STDERR: var a: Class(5, i32*);
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE-8]]:13: note: initializing generic parameter `T` declared here [InitializingGenericParam]
// CHECK:STDERR: class Class(T:! type, N:! i32) {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: class Class(T: type, N: i32) {}
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
var a: Class(5, i32*);
// --- call_in_nested_return_type.carbon
class Outer(T:! type) {
class Inner(U:! type) {
class Outer(T: type) {
class Inner(U: type) {
fn A() -> Outer(T) {
return {};
}
@@ -184,18 +184,18 @@ class Outer(T:! type) {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc4_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt.d47)]
// CHECK:STDOUT: %N.patt.loc4_24.1: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_24.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.patt.loc4_23.1: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_16.1: type = splice_block %.loc4_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc4_14: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T.67d)]
// CHECK:STDOUT: %.loc4_27: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %.Self.frozen.loc4_24: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_25: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %.Self.frozen.loc4_23: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %N.loc4_24.2: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_24.1 (constants.%N.ce9)]
// CHECK:STDOUT: %N.loc4_23.2: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_23.1 (constants.%N.ce9)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %a.var: ref %Class.4f7 = var_storage %a.var_patt [concrete]
// CHECK:STDOUT: %.loc6_21.1: type = splice_block %Class.loc6 [concrete = constants.%Class.4f7] {
@@ -239,11 +239,11 @@ class Outer(T:! type) {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic class @Class(%T.loc4_14.2: type, %N.loc4_24.2: %i32) {
// CHECK:STDOUT: generic class @Class(%T.loc4_14.2: type, %N.loc4_23.2: %i32) {
// CHECK:STDOUT: %T.patt.loc4_14.2: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt.d47)]
// CHECK:STDOUT: %T.loc4_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T.67d)]
// CHECK:STDOUT: %N.patt.loc4_24.2: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_24.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.loc4_24.1: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_24.1 (constants.%N.ce9)]
// CHECK:STDOUT: %N.patt.loc4_23.2: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.loc4_23.1: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_23.1 (constants.%N.ce9)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT:
@@ -282,15 +282,15 @@ class Outer(T:! type) {
// CHECK:STDOUT: specific @Class(constants.%T.67d, constants.%N.ce9) {
// CHECK:STDOUT: %T.patt.loc4_14.2 => constants.%T.patt.d47
// CHECK:STDOUT: %T.loc4_14.1 => constants.%T.67d
// CHECK:STDOUT: %N.patt.loc4_24.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_24.1 => constants.%N.ce9
// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_23.1 => constants.%N.ce9
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class(constants.%ptr.d08, constants.%int_5.eef) {
// CHECK:STDOUT: %T.patt.loc4_14.2 => constants.%T.patt.d47
// CHECK:STDOUT: %T.loc4_14.1 => constants.%ptr.d08
// CHECK:STDOUT: %N.patt.loc4_24.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_24.1 => constants.%int_5.eef
// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_23.1 => constants.%int_5.eef
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
@@ -298,8 +298,8 @@ class Outer(T:! type) {
// CHECK:STDOUT: specific @Class(constants.%empty_tuple.type, constants.%int_0.3c0) {
// CHECK:STDOUT: %T.patt.loc4_14.2 => constants.%T.patt.d47
// CHECK:STDOUT: %T.loc4_14.1 => constants.%empty_tuple.type
// CHECK:STDOUT: %N.patt.loc4_24.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_24.1 => constants.%int_0.3c0
// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_23.1 => constants.%int_0.3c0
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
@@ -345,18 +345,18 @@ class Outer(T:! type) {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc4_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
// CHECK:STDOUT: %N.patt.loc4_24.1: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_24.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.patt.loc4_23.1: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_16.1: type = splice_block %.loc4_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc4_14: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
// CHECK:STDOUT: %.loc4_27: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %.Self.frozen.loc4_24: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_25: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %.Self.frozen.loc4_23: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %N.loc4_24.2: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_24.1 (constants.%N.ce9)]
// CHECK:STDOUT: %N.loc4_23.2: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_23.1 (constants.%N.ce9)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %a.var: ref <error> = var_storage %a.var_patt [concrete = <error>]
// CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
@@ -371,11 +371,11 @@ class Outer(T:! type) {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic class @Class(%T.loc4_14.2: type, %N.loc4_24.2: %i32) {
// CHECK:STDOUT: generic class @Class(%T.loc4_14.2: type, %N.loc4_23.2: %i32) {
// CHECK:STDOUT: %T.patt.loc4_14.2: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.loc4_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
// CHECK:STDOUT: %N.patt.loc4_24.2: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_24.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.loc4_24.1: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_24.1 (constants.%N.ce9)]
// CHECK:STDOUT: %N.patt.loc4_23.2: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.loc4_23.1: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_23.1 (constants.%N.ce9)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT:
@@ -399,8 +399,8 @@ class Outer(T:! type) {
// CHECK:STDOUT: specific @Class(constants.%T, constants.%N.ce9) {
// CHECK:STDOUT: %T.patt.loc4_14.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc4_14.1 => constants.%T
// CHECK:STDOUT: %N.patt.loc4_24.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_24.1 => constants.%N.ce9
// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_23.1 => constants.%N.ce9
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_too_many.carbon
@@ -446,18 +446,18 @@ class Outer(T:! type) {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc4_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
// CHECK:STDOUT: %N.patt.loc4_24.1: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_24.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.patt.loc4_23.1: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_16.1: type = splice_block %.loc4_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc4_14: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
// CHECK:STDOUT: %.loc4_27: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %.Self.frozen.loc4_24: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_25: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %.Self.frozen.loc4_23: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %N.loc4_24.2: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_24.1 (constants.%N.ce9)]
// CHECK:STDOUT: %N.loc4_23.2: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_23.1 (constants.%N.ce9)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %a.var: ref <error> = var_storage %a.var_patt [concrete = <error>]
// CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
@@ -474,11 +474,11 @@ class Outer(T:! type) {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic class @Class(%T.loc4_14.2: type, %N.loc4_24.2: %i32) {
// CHECK:STDOUT: generic class @Class(%T.loc4_14.2: type, %N.loc4_23.2: %i32) {
// CHECK:STDOUT: %T.patt.loc4_14.2: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.loc4_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
// CHECK:STDOUT: %N.patt.loc4_24.2: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_24.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.loc4_24.1: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_24.1 (constants.%N.ce9)]
// CHECK:STDOUT: %N.patt.loc4_23.2: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.loc4_23.1: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_23.1 (constants.%N.ce9)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT:
@@ -502,8 +502,8 @@ class Outer(T:! type) {
// CHECK:STDOUT: specific @Class(constants.%T, constants.%N.ce9) {
// CHECK:STDOUT: %T.patt.loc4_14.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc4_14.1 => constants.%T
// CHECK:STDOUT: %N.patt.loc4_24.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_24.1 => constants.%N.ce9
// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_23.1 => constants.%N.ce9
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_no_conversion.carbon
@@ -552,18 +552,18 @@ class Outer(T:! type) {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc4_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
// CHECK:STDOUT: %N.patt.loc4_24.1: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_24.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.patt.loc4_23.1: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_16.1: type = splice_block %.loc4_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc4_14: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
// CHECK:STDOUT: %.loc4_27: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %.Self.frozen.loc4_24: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_25: type = splice_block %i32 [concrete = constants.%i32] {
// CHECK:STDOUT: %.Self.frozen.loc4_23: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %N.loc4_24.2: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_24.1 (constants.%N.ce9)]
// CHECK:STDOUT: %N.loc4_23.2: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_23.1 (constants.%N.ce9)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %a.var: ref <error> = var_storage %a.var_patt [concrete = <error>]
// CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
@@ -580,11 +580,11 @@ class Outer(T:! type) {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic class @Class(%T.loc4_14.2: type, %N.loc4_24.2: %i32) {
// CHECK:STDOUT: generic class @Class(%T.loc4_14.2: type, %N.loc4_23.2: %i32) {
// CHECK:STDOUT: %T.patt.loc4_14.2: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.loc4_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
// CHECK:STDOUT: %N.patt.loc4_24.2: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_24.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.loc4_24.1: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_24.1 (constants.%N.ce9)]
// CHECK:STDOUT: %N.patt.loc4_23.2: %pattern_type.6b6 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.a76)]
// CHECK:STDOUT: %N.loc4_23.1: %i32 = symbolic_binding N, 1 [symbolic = %N.loc4_23.1 (constants.%N.ce9)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT:
@@ -608,8 +608,8 @@ class Outer(T:! type) {
// CHECK:STDOUT: specific @Class(constants.%T, constants.%N.ce9) {
// CHECK:STDOUT: %T.patt.loc4_14.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc4_14.1 => constants.%T
// CHECK:STDOUT: %N.patt.loc4_24.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_24.1 => constants.%N.ce9
// CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.patt.a76
// CHECK:STDOUT: %N.loc4_23.1 => constants.%N.ce9
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- call_in_nested_return_type.carbon
@@ -693,9 +693,9 @@ class Outer(T:! type) {
// CHECK:STDOUT: %Outer.decl: %Outer.type = class_decl @Outer [concrete = constants.%Outer.generic] {
// CHECK:STDOUT: %T.patt.loc2_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc2_14.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc2_17.1: type = splice_block %.loc2_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc2_16.1: type = splice_block %.loc2_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc2_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc2_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc2_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc2_14.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -713,9 +713,9 @@ class Outer(T:! type) {
// CHECK:STDOUT: %Inner.decl: @Outer.%Inner.type (%Inner.type.8f7) = class_decl @Inner [symbolic = @Outer.%Inner.generic (constants.%Inner.generic.b3a)] {
// CHECK:STDOUT: %U.patt.loc3_16.1: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc3_16.2 (constants.%U.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc3_19.1: type = splice_block %.loc3_19.2 [concrete = type] {
// CHECK:STDOUT: %.loc3_18.1: type = splice_block %.loc3_18.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc3_19.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc3_18.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc3_16.2: type = symbolic_binding U, 1 [symbolic = %U.loc3_16.1 (constants.%U)]
// CHECK:STDOUT: }
@@ -18,7 +18,7 @@ fn Int(N: Core.IntLiteral) -> type = "int.make_type_signed";
base class B {}
class A(N:! i32) {
class A(N: i32) {
extend base: B;
var n: Int(N);
+121 -121
View File
@@ -15,7 +15,7 @@
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
class Class(T:! type) {
class Class(T: type) {
var x: T;
}
@@ -23,11 +23,11 @@ fn F(c: Class(i32)) -> i32 {
return c.x;
}
fn G(T:! Core.Copy, c: Class(T)) -> T {
fn G(generic T: Core.Copy, c: Class(T)) -> T {
return c.x;
}
fn H(U:! Core.Copy, c: Class(U)) -> U {
fn H(generic U: Core.Copy, c: Class(U)) -> U {
return c.x;
}
//@dump-sem-ir-end
@@ -149,9 +149,9 @@ fn H(U:! Core.Copy, c: Class(U)) -> U {
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc5_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc5_14.2 (constants.%T.patt.d47)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc5_17.1: type = splice_block %.loc5_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc5_16.1: type = splice_block %.loc5_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc5_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc5_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc5_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc5_14.1 (constants.%T.67d)]
// CHECK:STDOUT: }
@@ -174,62 +174,62 @@ fn H(U:! Core.Copy, c: Class(U)) -> U {
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
// CHECK:STDOUT: %T.patt.loc13_7.1: %pattern_type.e81 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_7.2 (constants.%T.patt.fe6)]
// CHECK:STDOUT: %c.param_patt.loc13_22.1: @G.%pattern_type.loc13_22 (%pattern_type.6b8c16.1) = value_param_pattern [symbolic = %c.param_patt.loc13_22.2 (constants.%c.param_patt.7092f5.1)]
// CHECK:STDOUT: %c.patt.loc13_22.1: @G.%pattern_type.loc13_22 (%pattern_type.6b8c16.1) = at_binding_pattern c, %c.param_patt.loc13_22.1 [symbolic = %c.patt.loc13_22.2 (constants.%c.patt.39adc7.1)]
// CHECK:STDOUT: %return.param_patt.loc13_37.1: @G.%pattern_type.loc13_37 (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc13_37.2 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc13_34.1: @G.%pattern_type.loc13_37 (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc13_37.1, %.loc13_37.3 [symbolic = %return.patt.loc13_34.2 (constants.%return.patt.f449d7.1)]
// CHECK:STDOUT: %T.patt.loc13_15.1: %pattern_type.e81 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt.fe6)]
// CHECK:STDOUT: %c.param_patt.loc13_29.1: @G.%pattern_type.loc13_29 (%pattern_type.6b8c16.1) = value_param_pattern [symbolic = %c.param_patt.loc13_29.2 (constants.%c.param_patt.7092f5.1)]
// CHECK:STDOUT: %c.patt.loc13_29.1: @G.%pattern_type.loc13_29 (%pattern_type.6b8c16.1) = at_binding_pattern c, %c.param_patt.loc13_29.1 [symbolic = %c.patt.loc13_29.2 (constants.%c.patt.39adc7.1)]
// CHECK:STDOUT: %return.param_patt.loc13_44.1: @G.%pattern_type.loc13_44 (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc13_44.2 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc13_41.1: @G.%pattern_type.loc13_44 (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc13_44.1, %.loc13_44.3 [symbolic = %return.patt.loc13_41.2 (constants.%return.patt.f449d7.1)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %T.ref.loc13_37: %Copy.type = name_ref T, %T.loc13_7.2 [symbolic = %T.loc13_7.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc13_37: type = facet_access_type %T.ref.loc13_37 [symbolic = %T.as_type.loc13_31.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc13_37.3: type = converted %T.ref.loc13_37, %T.as_type.loc13_37 [symbolic = %T.as_type.loc13_31.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc13_37.4: Core.Form = init_form %.loc13_37.3 [symbolic = %.loc13_37.2 (constants.%.1ce700.2)]
// CHECK:STDOUT: %.loc13_14: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %T.ref.loc13_44: %Copy.type = name_ref T, %T.loc13_15.2 [symbolic = %T.loc13_15.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc13_44: type = facet_access_type %T.ref.loc13_44 [symbolic = %T.as_type.loc13_38.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc13_44.3: type = converted %T.ref.loc13_44, %T.as_type.loc13_44 [symbolic = %T.as_type.loc13_38.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc13_44.4: Core.Form = init_form %.loc13_44.3 [symbolic = %.loc13_44.2 (constants.%.1ce700.2)]
// CHECK:STDOUT: %.loc13_21: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
// CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc13_7.2: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc13_7.1 (constants.%T.f84)]
// CHECK:STDOUT: %c.param: @G.%Class.loc13_31.1 (%Class.c74ef3.1) = value_param call_param0
// CHECK:STDOUT: %.loc13_31.1: type = splice_block %Class.loc13_31.2 [symbolic = %Class.loc13_31.1 (constants.%Class.c74ef3.1)] {
// CHECK:STDOUT: %T.loc13_15.2: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc13_15.1 (constants.%T.f84)]
// CHECK:STDOUT: %c.param: @G.%Class.loc13_38.1 (%Class.c74ef3.1) = value_param call_param0
// CHECK:STDOUT: %.loc13_38.1: type = splice_block %Class.loc13_38.2 [symbolic = %Class.loc13_38.1 (constants.%Class.c74ef3.1)] {
// CHECK:STDOUT: %Class.ref: %Class.type = name_ref Class, file.%Class.decl [concrete = constants.%Class.generic]
// CHECK:STDOUT: %T.ref.loc13_30: %Copy.type = name_ref T, %T.loc13_7.2 [symbolic = %T.loc13_7.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc13_31.2: type = facet_access_type %T.ref.loc13_30 [symbolic = %T.as_type.loc13_31.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc13_31.2: type = converted %T.ref.loc13_30, %T.as_type.loc13_31.2 [symbolic = %T.as_type.loc13_31.1 (constants.%T.as_type)]
// CHECK:STDOUT: %Class.loc13_31.2: type = class_type @Class, @Class(constants.%T.as_type) [symbolic = %Class.loc13_31.1 (constants.%Class.c74ef3.1)]
// CHECK:STDOUT: %T.ref.loc13_37: %Copy.type = name_ref T, %T.loc13_15.2 [symbolic = %T.loc13_15.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc13_38.2: type = facet_access_type %T.ref.loc13_37 [symbolic = %T.as_type.loc13_38.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc13_38.2: type = converted %T.ref.loc13_37, %T.as_type.loc13_38.2 [symbolic = %T.as_type.loc13_38.1 (constants.%T.as_type)]
// CHECK:STDOUT: %Class.loc13_38.2: type = class_type @Class, @Class(constants.%T.as_type) [symbolic = %Class.loc13_38.1 (constants.%Class.c74ef3.1)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c: @G.%Class.loc13_31.1 (%Class.c74ef3.1) = wrapper_binding c, %c.param
// CHECK:STDOUT: %return.param: ref @G.%T.as_type.loc13_31.1 (%T.as_type) = out_param call_param1
// CHECK:STDOUT: %return: ref @G.%T.as_type.loc13_31.1 (%T.as_type) = return_slot %return.param
// CHECK:STDOUT: %c: @G.%Class.loc13_38.1 (%Class.c74ef3.1) = wrapper_binding c, %c.param
// CHECK:STDOUT: %return.param: ref @G.%T.as_type.loc13_38.1 (%T.as_type) = out_param call_param1
// CHECK:STDOUT: %return: ref @G.%T.as_type.loc13_38.1 (%T.as_type) = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {
// CHECK:STDOUT: %U.patt.loc17_7.1: %pattern_type.e81 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc17_7.2 (constants.%U.patt.fe6)]
// CHECK:STDOUT: %c.param_patt.loc17_22.1: @H.%pattern_type.loc17_22 (%pattern_type.6b8c16.2) = value_param_pattern [symbolic = %c.param_patt.loc17_22.2 (constants.%c.param_patt.7092f5.2)]
// CHECK:STDOUT: %c.patt.loc17_22.1: @H.%pattern_type.loc17_22 (%pattern_type.6b8c16.2) = at_binding_pattern c, %c.param_patt.loc17_22.1 [symbolic = %c.patt.loc17_22.2 (constants.%c.patt.39adc7.2)]
// CHECK:STDOUT: %return.param_patt.loc17_37.1: @H.%pattern_type.loc17_37 (%pattern_type.2c66b4.3) = out_param_pattern [symbolic = %return.param_patt.loc17_37.2 (constants.%return.param_patt.bf4475.3)]
// CHECK:STDOUT: %return.patt.loc17_34.1: @H.%pattern_type.loc17_37 (%pattern_type.2c66b4.3) = return_slot_pattern %return.param_patt.loc17_37.1, %.loc17_37.3 [symbolic = %return.patt.loc17_34.2 (constants.%return.patt.f449d7.2)]
// CHECK:STDOUT: %U.patt.loc17_15.1: %pattern_type.e81 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc17_15.2 (constants.%U.patt.fe6)]
// CHECK:STDOUT: %c.param_patt.loc17_29.1: @H.%pattern_type.loc17_29 (%pattern_type.6b8c16.2) = value_param_pattern [symbolic = %c.param_patt.loc17_29.2 (constants.%c.param_patt.7092f5.2)]
// CHECK:STDOUT: %c.patt.loc17_29.1: @H.%pattern_type.loc17_29 (%pattern_type.6b8c16.2) = at_binding_pattern c, %c.param_patt.loc17_29.1 [symbolic = %c.patt.loc17_29.2 (constants.%c.patt.39adc7.2)]
// CHECK:STDOUT: %return.param_patt.loc17_44.1: @H.%pattern_type.loc17_44 (%pattern_type.2c66b4.3) = out_param_pattern [symbolic = %return.param_patt.loc17_44.2 (constants.%return.param_patt.bf4475.3)]
// CHECK:STDOUT: %return.patt.loc17_41.1: @H.%pattern_type.loc17_44 (%pattern_type.2c66b4.3) = return_slot_pattern %return.param_patt.loc17_44.1, %.loc17_44.3 [symbolic = %return.patt.loc17_41.2 (constants.%return.patt.f449d7.2)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %U.ref.loc17_37: %Copy.type = name_ref U, %U.loc17_7.2 [symbolic = %U.loc17_7.1 (constants.%U.f84)]
// CHECK:STDOUT: %U.as_type.loc17_37: type = facet_access_type %U.ref.loc17_37 [symbolic = %U.as_type.loc17_31.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %.loc17_37.3: type = converted %U.ref.loc17_37, %U.as_type.loc17_37 [symbolic = %U.as_type.loc17_31.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %.loc17_37.4: Core.Form = init_form %.loc17_37.3 [symbolic = %.loc17_37.2 (constants.%.1ce700.3)]
// CHECK:STDOUT: %.loc17_14: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %U.ref.loc17_44: %Copy.type = name_ref U, %U.loc17_15.2 [symbolic = %U.loc17_15.1 (constants.%U.f84)]
// CHECK:STDOUT: %U.as_type.loc17_44: type = facet_access_type %U.ref.loc17_44 [symbolic = %U.as_type.loc17_38.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %.loc17_44.3: type = converted %U.ref.loc17_44, %U.as_type.loc17_44 [symbolic = %U.as_type.loc17_38.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %.loc17_44.4: Core.Form = init_form %.loc17_44.3 [symbolic = %.loc17_44.2 (constants.%.1ce700.3)]
// CHECK:STDOUT: %.loc17_21: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
// CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc17_7.2: %Copy.type = symbolic_binding U, 0 [symbolic = %U.loc17_7.1 (constants.%U.f84)]
// CHECK:STDOUT: %c.param: @H.%Class.loc17_31.1 (%Class.c74ef3.2) = value_param call_param0
// CHECK:STDOUT: %.loc17_31.1: type = splice_block %Class.loc17_31.2 [symbolic = %Class.loc17_31.1 (constants.%Class.c74ef3.2)] {
// CHECK:STDOUT: %U.loc17_15.2: %Copy.type = symbolic_binding U, 0 [symbolic = %U.loc17_15.1 (constants.%U.f84)]
// CHECK:STDOUT: %c.param: @H.%Class.loc17_38.1 (%Class.c74ef3.2) = value_param call_param0
// CHECK:STDOUT: %.loc17_38.1: type = splice_block %Class.loc17_38.2 [symbolic = %Class.loc17_38.1 (constants.%Class.c74ef3.2)] {
// CHECK:STDOUT: %Class.ref: %Class.type = name_ref Class, file.%Class.decl [concrete = constants.%Class.generic]
// CHECK:STDOUT: %U.ref.loc17_30: %Copy.type = name_ref U, %U.loc17_7.2 [symbolic = %U.loc17_7.1 (constants.%U.f84)]
// CHECK:STDOUT: %U.as_type.loc17_31.2: type = facet_access_type %U.ref.loc17_30 [symbolic = %U.as_type.loc17_31.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %.loc17_31.2: type = converted %U.ref.loc17_30, %U.as_type.loc17_31.2 [symbolic = %U.as_type.loc17_31.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %Class.loc17_31.2: type = class_type @Class, @Class(constants.%U.as_type.c1c) [symbolic = %Class.loc17_31.1 (constants.%Class.c74ef3.2)]
// CHECK:STDOUT: %U.ref.loc17_37: %Copy.type = name_ref U, %U.loc17_15.2 [symbolic = %U.loc17_15.1 (constants.%U.f84)]
// CHECK:STDOUT: %U.as_type.loc17_38.2: type = facet_access_type %U.ref.loc17_37 [symbolic = %U.as_type.loc17_38.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %.loc17_38.2: type = converted %U.ref.loc17_37, %U.as_type.loc17_38.2 [symbolic = %U.as_type.loc17_38.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %Class.loc17_38.2: type = class_type @Class, @Class(constants.%U.as_type.c1c) [symbolic = %Class.loc17_38.1 (constants.%Class.c74ef3.2)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c: @H.%Class.loc17_31.1 (%Class.c74ef3.2) = wrapper_binding c, %c.param
// CHECK:STDOUT: %return.param: ref @H.%U.as_type.loc17_31.1 (%U.as_type.c1c) = out_param call_param1
// CHECK:STDOUT: %return: ref @H.%U.as_type.loc17_31.1 (%U.as_type.c1c) = return_slot %return.param
// CHECK:STDOUT: %c: @H.%Class.loc17_38.1 (%Class.c74ef3.2) = wrapper_binding c, %c.param
// CHECK:STDOUT: %return.param: ref @H.%U.as_type.loc17_38.1 (%U.as_type.c1c) = out_param call_param1
// CHECK:STDOUT: %return: ref @H.%U.as_type.loc17_38.1 (%U.as_type.c1c) = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -274,86 +274,86 @@ fn H(U:! Core.Copy, c: Class(U)) -> U {
// CHECK:STDOUT: !observes:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @G(%T.loc13_7.2: %Copy.type) {
// CHECK:STDOUT: %T.patt.loc13_7.2: %pattern_type.e81 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_7.2 (constants.%T.patt.fe6)]
// CHECK:STDOUT: %T.loc13_7.1: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc13_7.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc13_31.1: type = facet_access_type %T.loc13_7.1 [symbolic = %T.as_type.loc13_31.1 (constants.%T.as_type)]
// CHECK:STDOUT: %Class.loc13_31.1: type = class_type @Class, @Class(%T.as_type.loc13_31.1) [symbolic = %Class.loc13_31.1 (constants.%Class.c74ef3.1)]
// CHECK:STDOUT: %pattern_type.loc13_22: type = pattern_type %Class.loc13_31.1 [symbolic = %pattern_type.loc13_22 (constants.%pattern_type.6b8c16.1)]
// CHECK:STDOUT: %c.param_patt.loc13_22.2: @G.%pattern_type.loc13_22 (%pattern_type.6b8c16.1) = value_param_pattern [symbolic = %c.param_patt.loc13_22.2 (constants.%c.param_patt.7092f5.1)]
// CHECK:STDOUT: %c.patt.loc13_22.2: @G.%pattern_type.loc13_22 (%pattern_type.6b8c16.1) = at_binding_pattern c, %c.param_patt.loc13_22.2 [symbolic = %c.patt.loc13_22.2 (constants.%c.patt.39adc7.1)]
// CHECK:STDOUT: %.loc13_37.2: Core.Form = init_form %T.as_type.loc13_31.1 [symbolic = %.loc13_37.2 (constants.%.1ce700.2)]
// CHECK:STDOUT: %pattern_type.loc13_37: type = pattern_type %T.as_type.loc13_31.1 [symbolic = %pattern_type.loc13_37 (constants.%pattern_type.2c66b4.2)]
// CHECK:STDOUT: %return.param_patt.loc13_37.2: @G.%pattern_type.loc13_37 (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc13_37.2 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc13_34.2: @G.%pattern_type.loc13_37 (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc13_37.2, %T.as_type.loc13_31.1 [symbolic = %return.patt.loc13_34.2 (constants.%return.patt.f449d7.1)]
// CHECK:STDOUT: generic fn @G(%T.loc13_15.2: %Copy.type) {
// CHECK:STDOUT: %T.patt.loc13_15.2: %pattern_type.e81 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt.fe6)]
// CHECK:STDOUT: %T.loc13_15.1: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc13_15.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc13_38.1: type = facet_access_type %T.loc13_15.1 [symbolic = %T.as_type.loc13_38.1 (constants.%T.as_type)]
// CHECK:STDOUT: %Class.loc13_38.1: type = class_type @Class, @Class(%T.as_type.loc13_38.1) [symbolic = %Class.loc13_38.1 (constants.%Class.c74ef3.1)]
// CHECK:STDOUT: %pattern_type.loc13_29: type = pattern_type %Class.loc13_38.1 [symbolic = %pattern_type.loc13_29 (constants.%pattern_type.6b8c16.1)]
// CHECK:STDOUT: %c.param_patt.loc13_29.2: @G.%pattern_type.loc13_29 (%pattern_type.6b8c16.1) = value_param_pattern [symbolic = %c.param_patt.loc13_29.2 (constants.%c.param_patt.7092f5.1)]
// CHECK:STDOUT: %c.patt.loc13_29.2: @G.%pattern_type.loc13_29 (%pattern_type.6b8c16.1) = at_binding_pattern c, %c.param_patt.loc13_29.2 [symbolic = %c.patt.loc13_29.2 (constants.%c.patt.39adc7.1)]
// CHECK:STDOUT: %.loc13_44.2: Core.Form = init_form %T.as_type.loc13_38.1 [symbolic = %.loc13_44.2 (constants.%.1ce700.2)]
// CHECK:STDOUT: %pattern_type.loc13_44: type = pattern_type %T.as_type.loc13_38.1 [symbolic = %pattern_type.loc13_44 (constants.%pattern_type.2c66b4.2)]
// CHECK:STDOUT: %return.param_patt.loc13_44.2: @G.%pattern_type.loc13_44 (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc13_44.2 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc13_41.2: @G.%pattern_type.loc13_44 (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc13_44.2, %T.as_type.loc13_38.1 [symbolic = %return.patt.loc13_41.2 (constants.%return.patt.f449d7.1)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete.loc13: <witness> = require_complete_type %Class.loc13_31.1 [symbolic = %require_complete.loc13 (constants.%require_complete.3b48fd.1)]
// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class.loc13_31.1, %T.as_type.loc13_31.1 [symbolic = %Class.elem (constants.%Class.elem.14b853.1)]
// CHECK:STDOUT: %require_complete.loc14: <witness> = require_complete_type %T.as_type.loc13_31.1 [symbolic = %require_complete.loc14 (constants.%require_complete.d83f06.1)]
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc13_7.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.2)]
// CHECK:STDOUT: %.loc14_11.5: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc13_7.1 [symbolic = %.loc14_11.5 (constants.%.c29330.1)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc13_7.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c332.1)]
// CHECK:STDOUT: %require_complete.loc13: <witness> = require_complete_type %Class.loc13_38.1 [symbolic = %require_complete.loc13 (constants.%require_complete.3b48fd.1)]
// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class.loc13_38.1, %T.as_type.loc13_38.1 [symbolic = %Class.elem (constants.%Class.elem.14b853.1)]
// CHECK:STDOUT: %require_complete.loc14: <witness> = require_complete_type %T.as_type.loc13_38.1 [symbolic = %require_complete.loc14 (constants.%require_complete.d83f06.1)]
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc13_15.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.2)]
// CHECK:STDOUT: %.loc14_11.5: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc13_15.1 [symbolic = %.loc14_11.5 (constants.%.c29330.1)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc13_15.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c332.1)]
// CHECK:STDOUT: %impl.elem0.loc14_11.2: @G.%.loc14_11.5 (%.c29330.1) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc14_11.2 (constants.%impl.elem0.bd2456.1)]
// CHECK:STDOUT: %specific_impl_fn.loc14_11.2: <specific function> = specific_impl_function %impl.elem0.loc14_11.2, @Copy.WithSelf.Op(%T.loc13_7.1) [symbolic = %specific_impl_fn.loc14_11.2 (constants.%specific_impl_fn.e2af7e.1)]
// CHECK:STDOUT: %specific_impl_fn.loc14_11.2: <specific function> = specific_impl_function %impl.elem0.loc14_11.2, @Copy.WithSelf.Op(%T.loc13_15.1) [symbolic = %specific_impl_fn.loc14_11.2 (constants.%specific_impl_fn.e2af7e.1)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%c.param: @G.%Class.loc13_31.1 (%Class.c74ef3.1)) -> out %return.param: @G.%T.as_type.loc13_31.1 (%T.as_type) {
// CHECK:STDOUT: fn(%c.param: @G.%Class.loc13_38.1 (%Class.c74ef3.1)) -> out %return.param: @G.%T.as_type.loc13_38.1 (%T.as_type) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %c.ref: @G.%Class.loc13_31.1 (%Class.c74ef3.1) = name_ref c, %c
// CHECK:STDOUT: %c.ref: @G.%Class.loc13_38.1 (%Class.c74ef3.1) = name_ref c, %c
// CHECK:STDOUT: %x.ref: @G.%Class.elem (%Class.elem.14b853.1) = name_ref x, @Class.%.loc6 [concrete = @Class.%.loc6]
// CHECK:STDOUT: %.loc14_11.1: ref @G.%T.as_type.loc13_31.1 (%T.as_type) = class_element_access %c.ref, element0
// CHECK:STDOUT: %.loc14_11.2: @G.%T.as_type.loc13_31.1 (%T.as_type) = acquire_value %.loc14_11.1
// CHECK:STDOUT: %.loc14_11.1: ref @G.%T.as_type.loc13_38.1 (%T.as_type) = class_element_access %c.ref, element0
// CHECK:STDOUT: %.loc14_11.2: @G.%T.as_type.loc13_38.1 (%T.as_type) = acquire_value %.loc14_11.1
// CHECK:STDOUT: %impl.elem0.loc14_11.1: @G.%.loc14_11.5 (%.c29330.1) = impl_witness_access constants.%Copy.lookup_impl_witness.d9c332.1, element0 [symbolic = %impl.elem0.loc14_11.2 (constants.%impl.elem0.bd2456.1)]
// CHECK:STDOUT: %bound_method.loc14_11.1: <bound method> = bound_method %.loc14_11.2, %impl.elem0.loc14_11.1
// CHECK:STDOUT: %.loc14_11.3: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc13_7.1 (constants.%T.f84)]
// CHECK:STDOUT: %.loc14_11.4: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc13_7.1 (constants.%T.f84)]
// CHECK:STDOUT: %.loc14_11.3: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc13_15.1 (constants.%T.f84)]
// CHECK:STDOUT: %.loc14_11.4: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc13_15.1 (constants.%T.f84)]
// CHECK:STDOUT: %specific_impl_fn.loc14_11.1: <specific function> = specific_impl_function %impl.elem0.loc14_11.1, @Copy.WithSelf.Op(constants.%T.f84) [symbolic = %specific_impl_fn.loc14_11.2 (constants.%specific_impl_fn.e2af7e.1)]
// CHECK:STDOUT: %bound_method.loc14_11.2: <bound method> = bound_method %.loc14_11.2, %specific_impl_fn.loc14_11.1
// CHECK:STDOUT: %.loc13_37.1: ref @G.%T.as_type.loc13_31.1 (%T.as_type) = splice_block %return.param {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @G.%T.as_type.loc13_31.1 (%T.as_type) to %.loc13_37.1 = call %bound_method.loc14_11.2(%.loc14_11.2)
// CHECK:STDOUT: %.loc13_44.1: ref @G.%T.as_type.loc13_38.1 (%T.as_type) = splice_block %return.param {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @G.%T.as_type.loc13_38.1 (%T.as_type) to %.loc13_44.1 = call %bound_method.loc14_11.2(%.loc14_11.2)
// CHECK:STDOUT: return %Copy.WithSelf.Op.call to %return.param
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @H(%U.loc17_7.2: %Copy.type) {
// CHECK:STDOUT: %U.patt.loc17_7.2: %pattern_type.e81 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc17_7.2 (constants.%U.patt.fe6)]
// CHECK:STDOUT: %U.loc17_7.1: %Copy.type = symbolic_binding U, 0 [symbolic = %U.loc17_7.1 (constants.%U.f84)]
// CHECK:STDOUT: %U.as_type.loc17_31.1: type = facet_access_type %U.loc17_7.1 [symbolic = %U.as_type.loc17_31.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %Class.loc17_31.1: type = class_type @Class, @Class(%U.as_type.loc17_31.1) [symbolic = %Class.loc17_31.1 (constants.%Class.c74ef3.2)]
// CHECK:STDOUT: %pattern_type.loc17_22: type = pattern_type %Class.loc17_31.1 [symbolic = %pattern_type.loc17_22 (constants.%pattern_type.6b8c16.2)]
// CHECK:STDOUT: %c.param_patt.loc17_22.2: @H.%pattern_type.loc17_22 (%pattern_type.6b8c16.2) = value_param_pattern [symbolic = %c.param_patt.loc17_22.2 (constants.%c.param_patt.7092f5.2)]
// CHECK:STDOUT: %c.patt.loc17_22.2: @H.%pattern_type.loc17_22 (%pattern_type.6b8c16.2) = at_binding_pattern c, %c.param_patt.loc17_22.2 [symbolic = %c.patt.loc17_22.2 (constants.%c.patt.39adc7.2)]
// CHECK:STDOUT: %.loc17_37.2: Core.Form = init_form %U.as_type.loc17_31.1 [symbolic = %.loc17_37.2 (constants.%.1ce700.3)]
// CHECK:STDOUT: %pattern_type.loc17_37: type = pattern_type %U.as_type.loc17_31.1 [symbolic = %pattern_type.loc17_37 (constants.%pattern_type.2c66b4.3)]
// CHECK:STDOUT: %return.param_patt.loc17_37.2: @H.%pattern_type.loc17_37 (%pattern_type.2c66b4.3) = out_param_pattern [symbolic = %return.param_patt.loc17_37.2 (constants.%return.param_patt.bf4475.3)]
// CHECK:STDOUT: %return.patt.loc17_34.2: @H.%pattern_type.loc17_37 (%pattern_type.2c66b4.3) = return_slot_pattern %return.param_patt.loc17_37.2, %U.as_type.loc17_31.1 [symbolic = %return.patt.loc17_34.2 (constants.%return.patt.f449d7.2)]
// CHECK:STDOUT: generic fn @H(%U.loc17_15.2: %Copy.type) {
// CHECK:STDOUT: %U.patt.loc17_15.2: %pattern_type.e81 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc17_15.2 (constants.%U.patt.fe6)]
// CHECK:STDOUT: %U.loc17_15.1: %Copy.type = symbolic_binding U, 0 [symbolic = %U.loc17_15.1 (constants.%U.f84)]
// CHECK:STDOUT: %U.as_type.loc17_38.1: type = facet_access_type %U.loc17_15.1 [symbolic = %U.as_type.loc17_38.1 (constants.%U.as_type.c1c)]
// CHECK:STDOUT: %Class.loc17_38.1: type = class_type @Class, @Class(%U.as_type.loc17_38.1) [symbolic = %Class.loc17_38.1 (constants.%Class.c74ef3.2)]
// CHECK:STDOUT: %pattern_type.loc17_29: type = pattern_type %Class.loc17_38.1 [symbolic = %pattern_type.loc17_29 (constants.%pattern_type.6b8c16.2)]
// CHECK:STDOUT: %c.param_patt.loc17_29.2: @H.%pattern_type.loc17_29 (%pattern_type.6b8c16.2) = value_param_pattern [symbolic = %c.param_patt.loc17_29.2 (constants.%c.param_patt.7092f5.2)]
// CHECK:STDOUT: %c.patt.loc17_29.2: @H.%pattern_type.loc17_29 (%pattern_type.6b8c16.2) = at_binding_pattern c, %c.param_patt.loc17_29.2 [symbolic = %c.patt.loc17_29.2 (constants.%c.patt.39adc7.2)]
// CHECK:STDOUT: %.loc17_44.2: Core.Form = init_form %U.as_type.loc17_38.1 [symbolic = %.loc17_44.2 (constants.%.1ce700.3)]
// CHECK:STDOUT: %pattern_type.loc17_44: type = pattern_type %U.as_type.loc17_38.1 [symbolic = %pattern_type.loc17_44 (constants.%pattern_type.2c66b4.3)]
// CHECK:STDOUT: %return.param_patt.loc17_44.2: @H.%pattern_type.loc17_44 (%pattern_type.2c66b4.3) = out_param_pattern [symbolic = %return.param_patt.loc17_44.2 (constants.%return.param_patt.bf4475.3)]
// CHECK:STDOUT: %return.patt.loc17_41.2: @H.%pattern_type.loc17_44 (%pattern_type.2c66b4.3) = return_slot_pattern %return.param_patt.loc17_44.2, %U.as_type.loc17_38.1 [symbolic = %return.patt.loc17_41.2 (constants.%return.patt.f449d7.2)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete.loc17: <witness> = require_complete_type %Class.loc17_31.1 [symbolic = %require_complete.loc17 (constants.%require_complete.3b48fd.2)]
// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class.loc17_31.1, %U.as_type.loc17_31.1 [symbolic = %Class.elem (constants.%Class.elem.14b853.2)]
// CHECK:STDOUT: %require_complete.loc18: <witness> = require_complete_type %U.as_type.loc17_31.1 [symbolic = %require_complete.loc18 (constants.%require_complete.d83f06.2)]
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%U.loc17_7.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.3)]
// CHECK:STDOUT: %.loc18_11.5: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %U.loc17_7.1 [symbolic = %.loc18_11.5 (constants.%.c29330.2)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %U.loc17_7.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c332.2)]
// CHECK:STDOUT: %require_complete.loc17: <witness> = require_complete_type %Class.loc17_38.1 [symbolic = %require_complete.loc17 (constants.%require_complete.3b48fd.2)]
// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class.loc17_38.1, %U.as_type.loc17_38.1 [symbolic = %Class.elem (constants.%Class.elem.14b853.2)]
// CHECK:STDOUT: %require_complete.loc18: <witness> = require_complete_type %U.as_type.loc17_38.1 [symbolic = %require_complete.loc18 (constants.%require_complete.d83f06.2)]
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%U.loc17_15.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.3)]
// CHECK:STDOUT: %.loc18_11.5: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %U.loc17_15.1 [symbolic = %.loc18_11.5 (constants.%.c29330.2)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %U.loc17_15.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c332.2)]
// CHECK:STDOUT: %impl.elem0.loc18_11.2: @H.%.loc18_11.5 (%.c29330.2) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_11.2 (constants.%impl.elem0.bd2456.2)]
// CHECK:STDOUT: %specific_impl_fn.loc18_11.2: <specific function> = specific_impl_function %impl.elem0.loc18_11.2, @Copy.WithSelf.Op(%U.loc17_7.1) [symbolic = %specific_impl_fn.loc18_11.2 (constants.%specific_impl_fn.e2af7e.2)]
// CHECK:STDOUT: %specific_impl_fn.loc18_11.2: <specific function> = specific_impl_function %impl.elem0.loc18_11.2, @Copy.WithSelf.Op(%U.loc17_15.1) [symbolic = %specific_impl_fn.loc18_11.2 (constants.%specific_impl_fn.e2af7e.2)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%c.param: @H.%Class.loc17_31.1 (%Class.c74ef3.2)) -> out %return.param: @H.%U.as_type.loc17_31.1 (%U.as_type.c1c) {
// CHECK:STDOUT: fn(%c.param: @H.%Class.loc17_38.1 (%Class.c74ef3.2)) -> out %return.param: @H.%U.as_type.loc17_38.1 (%U.as_type.c1c) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %c.ref: @H.%Class.loc17_31.1 (%Class.c74ef3.2) = name_ref c, %c
// CHECK:STDOUT: %c.ref: @H.%Class.loc17_38.1 (%Class.c74ef3.2) = name_ref c, %c
// CHECK:STDOUT: %x.ref: @H.%Class.elem (%Class.elem.14b853.2) = name_ref x, @Class.%.loc6 [concrete = @Class.%.loc6]
// CHECK:STDOUT: %.loc18_11.1: ref @H.%U.as_type.loc17_31.1 (%U.as_type.c1c) = class_element_access %c.ref, element0
// CHECK:STDOUT: %.loc18_11.2: @H.%U.as_type.loc17_31.1 (%U.as_type.c1c) = acquire_value %.loc18_11.1
// CHECK:STDOUT: %.loc18_11.1: ref @H.%U.as_type.loc17_38.1 (%U.as_type.c1c) = class_element_access %c.ref, element0
// CHECK:STDOUT: %.loc18_11.2: @H.%U.as_type.loc17_38.1 (%U.as_type.c1c) = acquire_value %.loc18_11.1
// CHECK:STDOUT: %impl.elem0.loc18_11.1: @H.%.loc18_11.5 (%.c29330.2) = impl_witness_access constants.%Copy.lookup_impl_witness.d9c332.2, element0 [symbolic = %impl.elem0.loc18_11.2 (constants.%impl.elem0.bd2456.2)]
// CHECK:STDOUT: %bound_method.loc18_11.1: <bound method> = bound_method %.loc18_11.2, %impl.elem0.loc18_11.1
// CHECK:STDOUT: %.loc18_11.3: %Copy.type = converted constants.%U.as_type.c1c, constants.%U.f84 [symbolic = %U.loc17_7.1 (constants.%U.f84)]
// CHECK:STDOUT: %.loc18_11.4: %Copy.type = converted constants.%U.as_type.c1c, constants.%U.f84 [symbolic = %U.loc17_7.1 (constants.%U.f84)]
// CHECK:STDOUT: %.loc18_11.3: %Copy.type = converted constants.%U.as_type.c1c, constants.%U.f84 [symbolic = %U.loc17_15.1 (constants.%U.f84)]
// CHECK:STDOUT: %.loc18_11.4: %Copy.type = converted constants.%U.as_type.c1c, constants.%U.f84 [symbolic = %U.loc17_15.1 (constants.%U.f84)]
// CHECK:STDOUT: %specific_impl_fn.loc18_11.1: <specific function> = specific_impl_function %impl.elem0.loc18_11.1, @Copy.WithSelf.Op(constants.%U.f84) [symbolic = %specific_impl_fn.loc18_11.2 (constants.%specific_impl_fn.e2af7e.2)]
// CHECK:STDOUT: %bound_method.loc18_11.2: <bound method> = bound_method %.loc18_11.2, %specific_impl_fn.loc18_11.1
// CHECK:STDOUT: %.loc17_37.1: ref @H.%U.as_type.loc17_31.1 (%U.as_type.c1c) = splice_block %return.param {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @H.%U.as_type.loc17_31.1 (%U.as_type.c1c) to %.loc17_37.1 = call %bound_method.loc18_11.2(%.loc18_11.2)
// CHECK:STDOUT: %.loc17_44.1: ref @H.%U.as_type.loc17_38.1 (%U.as_type.c1c) = splice_block %return.param {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @H.%U.as_type.loc17_38.1 (%U.as_type.c1c) to %.loc17_44.1 = call %bound_method.loc18_11.2(%.loc18_11.2)
// CHECK:STDOUT: return %Copy.WithSelf.Op.call to %return.param
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
@@ -394,17 +394,17 @@ fn H(U:! Core.Copy, c: Class(U)) -> U {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @G(constants.%T.f84) {
// CHECK:STDOUT: %T.patt.loc13_7.2 => constants.%T.patt.fe6
// CHECK:STDOUT: %T.loc13_7.1 => constants.%T.f84
// CHECK:STDOUT: %T.as_type.loc13_31.1 => constants.%T.as_type
// CHECK:STDOUT: %Class.loc13_31.1 => constants.%Class.c74ef3.1
// CHECK:STDOUT: %pattern_type.loc13_22 => constants.%pattern_type.6b8c16.1
// CHECK:STDOUT: %c.param_patt.loc13_22.2 => constants.%c.param_patt.7092f5.1
// CHECK:STDOUT: %c.patt.loc13_22.2 => constants.%c.patt.39adc7.1
// CHECK:STDOUT: %.loc13_37.2 => constants.%.1ce700.2
// CHECK:STDOUT: %pattern_type.loc13_37 => constants.%pattern_type.2c66b4.2
// CHECK:STDOUT: %return.param_patt.loc13_37.2 => constants.%return.param_patt.bf4475.2
// CHECK:STDOUT: %return.patt.loc13_34.2 => constants.%return.patt.f449d7.1
// CHECK:STDOUT: %T.patt.loc13_15.2 => constants.%T.patt.fe6
// CHECK:STDOUT: %T.loc13_15.1 => constants.%T.f84
// CHECK:STDOUT: %T.as_type.loc13_38.1 => constants.%T.as_type
// CHECK:STDOUT: %Class.loc13_38.1 => constants.%Class.c74ef3.1
// CHECK:STDOUT: %pattern_type.loc13_29 => constants.%pattern_type.6b8c16.1
// CHECK:STDOUT: %c.param_patt.loc13_29.2 => constants.%c.param_patt.7092f5.1
// CHECK:STDOUT: %c.patt.loc13_29.2 => constants.%c.patt.39adc7.1
// CHECK:STDOUT: %.loc13_44.2 => constants.%.1ce700.2
// CHECK:STDOUT: %pattern_type.loc13_44 => constants.%pattern_type.2c66b4.2
// CHECK:STDOUT: %return.param_patt.loc13_44.2 => constants.%return.param_patt.bf4475.2
// CHECK:STDOUT: %return.patt.loc13_41.2 => constants.%return.patt.f449d7.1
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class(constants.%U.as_type.c1c) {
@@ -422,16 +422,16 @@ fn H(U:! Core.Copy, c: Class(U)) -> U {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @H(constants.%U.f84) {
// CHECK:STDOUT: %U.patt.loc17_7.2 => constants.%U.patt.fe6
// CHECK:STDOUT: %U.loc17_7.1 => constants.%U.f84
// CHECK:STDOUT: %U.as_type.loc17_31.1 => constants.%U.as_type.c1c
// CHECK:STDOUT: %Class.loc17_31.1 => constants.%Class.c74ef3.2
// CHECK:STDOUT: %pattern_type.loc17_22 => constants.%pattern_type.6b8c16.2
// CHECK:STDOUT: %c.param_patt.loc17_22.2 => constants.%c.param_patt.7092f5.2
// CHECK:STDOUT: %c.patt.loc17_22.2 => constants.%c.patt.39adc7.2
// CHECK:STDOUT: %.loc17_37.2 => constants.%.1ce700.3
// CHECK:STDOUT: %pattern_type.loc17_37 => constants.%pattern_type.2c66b4.3
// CHECK:STDOUT: %return.param_patt.loc17_37.2 => constants.%return.param_patt.bf4475.3
// CHECK:STDOUT: %return.patt.loc17_34.2 => constants.%return.patt.f449d7.2
// CHECK:STDOUT: %U.patt.loc17_15.2 => constants.%U.patt.fe6
// CHECK:STDOUT: %U.loc17_15.1 => constants.%U.f84
// CHECK:STDOUT: %U.as_type.loc17_38.1 => constants.%U.as_type.c1c
// CHECK:STDOUT: %Class.loc17_38.1 => constants.%Class.c74ef3.2
// CHECK:STDOUT: %pattern_type.loc17_29 => constants.%pattern_type.6b8c16.2
// CHECK:STDOUT: %c.param_patt.loc17_29.2 => constants.%c.param_patt.7092f5.2
// CHECK:STDOUT: %c.patt.loc17_29.2 => constants.%c.patt.39adc7.2
// CHECK:STDOUT: %.loc17_44.2 => constants.%.1ce700.3
// CHECK:STDOUT: %pattern_type.loc17_44 => constants.%pattern_type.2c66b4.3
// CHECK:STDOUT: %return.param_patt.loc17_44.2 => constants.%return.param_patt.bf4475.3
// CHECK:STDOUT: %return.patt.loc17_41.2 => constants.%return.patt.f449d7.2
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -18,11 +18,11 @@ library "[[@TEST_NAME]]";
class NotGenericNoParams {}
class NotGenericButParams() {}
class GenericAndParams(T:! type) {}
class GenericAndParams(T: type) {}
class C(T:! type) {
class C(T: type) {
class GenericNoParams {}
class GenericAndParams(U:! type) {}
class GenericAndParams(U: type) {}
}
class X {}
@@ -38,23 +38,23 @@ var e: C(X).GenericAndParams(X) = {};
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_non_generic_implicit_params.carbon:[[@LINE+4]]:9: error: parameters of generic types must be constant [GenericParamMustBeConstant]
// CHECK:STDERR: class A[T: type]() {}
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: class A[runtime T: type]() {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR:
class A[T: type]() {}
class A[runtime T: type]() {}
// --- fail_non_generic_params.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_non_generic_params.carbon:[[@LINE+4]]:9: error: parameters of generic types must be constant [GenericParamMustBeConstant]
// CHECK:STDERR: class A(T: type) {}
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: class A(runtime T: type) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR:
class A(T: type) {}
class A(runtime T: type) {}
// This is testing a use of the invalid type.
fn F(T:! type) {
fn F(generic T: type) {
A(T);
}
@@ -73,10 +73,10 @@ class Foo[];
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_implicit_params_only.carbon:[[@LINE+4]]:10: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters]
// CHECK:STDERR: class Foo[T:! type];
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: class Foo[T: type];
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR:
class Foo[T:! type];
class Foo[T: type];
// CHECK:STDOUT: --- params.carbon
// CHECK:STDOUT:
@@ -152,18 +152,18 @@ class Foo[T:! type];
// CHECK:STDOUT: %GenericAndParams.decl: %GenericAndParams.type.aa5 = class_decl @GenericAndParams.loc6 [concrete = constants.%GenericAndParams.generic.128] {
// CHECK:STDOUT: %T.patt.loc6_25.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_25.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc6_28.1: type = splice_block %.loc6_28.2 [concrete = type] {
// CHECK:STDOUT: %.loc6_27.1: type = splice_block %.loc6_27.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc6_28.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc6_27.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc6_25.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_25.1 (constants.%T)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
// CHECK:STDOUT: %T.patt.loc8_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_10.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc8_13.1: type = splice_block %.loc8_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc8_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc8_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc8_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_10.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -271,9 +271,9 @@ class Foo[T:! type];
// CHECK:STDOUT: %GenericAndParams.decl: @C.%GenericAndParams.type (%GenericAndParams.type.c37) = class_decl @GenericAndParams.loc10 [symbolic = @C.%GenericAndParams.generic (constants.%GenericAndParams.generic.6c8)] {
// CHECK:STDOUT: %U.patt.loc10_27.1: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_27.2 (constants.%U.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc10_30.1: type = splice_block %.loc10_30.2 [concrete = type] {
// CHECK:STDOUT: %.loc10_29.1: type = splice_block %.loc10_29.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc10_30.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc10_29.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc10_27.2: type = symbolic_binding U, 1 [symbolic = %U.loc10_27.1 (constants.%U)]
// CHECK:STDOUT: }
@@ -443,13 +443,13 @@ class Foo[T:! type];
// CHECK:STDOUT: }
// CHECK:STDOUT: %A.decl: %A.type = class_decl @A [concrete = constants.%A.generic] {} {}
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
// CHECK:STDOUT: %T.patt.loc11_7.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_7.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc11_10.1: type = splice_block %.loc11_10.2 [concrete = type] {
// CHECK:STDOUT: %.loc11_17.1: type = splice_block %.loc11_17.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc11_10.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc11_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc11_7.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_7.1 (constants.%T)]
// CHECK:STDOUT: %T.loc11_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)]
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -461,16 +461,16 @@ class Foo[T:! type];
// CHECK:STDOUT: .Self = constants.%A
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @F(%T.loc11_7.2: type) {
// CHECK:STDOUT: %T.patt.loc11_7.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_7.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.loc11_7.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_7.1 (constants.%T)]
// CHECK:STDOUT: generic fn @F(%T.loc11_15.2: type) {
// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.loc11_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT:
// CHECK:STDOUT: fn() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic]
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_7.2 [symbolic = %T.loc11_7.1 (constants.%T)]
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_15.2 [symbolic = %T.loc11_15.1 (constants.%T)]
// CHECK:STDOUT: %A: type = class_type @A [concrete = constants.%A]
// CHECK:STDOUT: return
// CHECK:STDOUT:
@@ -479,8 +479,8 @@ class Foo[T:! type];
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @F(constants.%T) {
// CHECK:STDOUT: %T.patt.loc11_7.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc11_7.1 => constants.%T
// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc11_15.1 => constants.%T
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_implicit_params_only_empty.carbon
@@ -518,9 +518,9 @@ class Foo[T:! type];
// CHECK:STDOUT: %Foo.decl: %Foo.type = class_decl @Foo [concrete = constants.%Foo.generic] {
// CHECK:STDOUT: %T.patt.loc8_12.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc8_15.1: type = splice_block %.loc8_15.2 [concrete = type] {
// CHECK:STDOUT: %.loc8_14.1: type = splice_block %.loc8_14.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc8_15.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc8_14.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc8_12.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_12.1 (constants.%T)]
// CHECK:STDOUT: }
+16 -16
View File
@@ -16,9 +16,9 @@
library "[[@TEST_NAME]]";
class Class(T:! type);
class Class(T: type);
class CompleteClass(T:! type) {
class CompleteClass(T: type) {
var n: i32;
fn F() -> i32 { return 0; }
}
@@ -29,7 +29,7 @@ fn F() -> CompleteClass(i32);
impl library "[[@TEST_NAME]]";
class Class(T:! type) {
class Class(T: type) {
var x: T;
}
@@ -73,14 +73,14 @@ fn Use() {
impl library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+8]]:13: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
// CHECK:STDERR: class Class(U:! type) {
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: class Class(U: type) {
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_foo.impl.carbon:[[@LINE-5]]:1: in import [InImport]
// CHECK:STDERR: foo.carbon:4:13: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
// CHECK:STDERR: class Class(T:! type);
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: class Class(T: type);
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
class Class(U:! type) {
class Class(U: type) {
// CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+4]]:10: error: name `T` not found [NameNotFound]
// CHECK:STDERR: var x: T;
// CHECK:STDERR: ^
@@ -164,18 +164,18 @@ class Class(U:! type) {
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc4_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_16.1: type = splice_block %.loc4_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %CompleteClass.decl: %CompleteClass.type = class_decl @CompleteClass [concrete = constants.%CompleteClass.generic] {
// CHECK:STDOUT: %T.patt.loc6_22.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_22.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc6_25.1: type = splice_block %.loc6_25.2 [concrete = type] {
// CHECK:STDOUT: %.loc6_24.1: type = splice_block %.loc6_24.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc6_25.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc6_24.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc6_22.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_22.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -368,9 +368,9 @@ class Class(U:! type) {
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc4: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.1 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_16.1: type = splice_block %.loc4_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4: type = symbolic_binding T, 0 [symbolic = %T.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -969,9 +969,9 @@ class Class(U:! type) {
// CHECK:STDOUT: %Class.decl: %Class.type.3256be.2 = class_decl @Class.loc12 [concrete = constants.%Class.generic.4154f7.2] {
// CHECK:STDOUT: %U.patt.loc12_14.1: %pattern_type.98f = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_14.2 (constants.%U.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc12_17.1: type = splice_block %.loc12_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc12_16.1: type = splice_block %.loc12_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc12_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc12_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc12_14.2: type = symbolic_binding U, 0 [symbolic = %U.loc12_14.1 (constants.%U)]
// CHECK:STDOUT: }
+120 -120
View File
@@ -14,12 +14,12 @@
library "[[@TEST_NAME]]";
class Class(T:! Core.Destroy) {
class Class(T: Core.Destroy) {
var k: T;
}
//@dump-sem-ir-begin
fn InitFromStructGeneric(T:! Core.Copy & Core.Destroy, x: T) -> T {
fn InitFromStructGeneric(generic T: Core.Copy & Core.Destroy, x: T) -> T {
var v: Class(T) = {.k = x};
return v.k;
}
@@ -34,12 +34,12 @@ fn InitFromStructSpecific(x: i32) -> i32 {
library "[[@TEST_NAME]]";
class Adapt(T:! type) {
class Adapt(T: type) {
adapt T;
}
//@dump-sem-ir-begin
fn InitFromAdaptedGeneric(T:! Core.Copy, x: T) -> T {
fn InitFromAdaptedGeneric(generic T: Core.Copy, x: T) -> T {
return (x as Adapt(T)) as T;
}
@@ -162,38 +162,38 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: %InitFromStructGeneric.decl: %InitFromStructGeneric.type = fn_decl @InitFromStructGeneric [concrete = constants.%InitFromStructGeneric] {
// CHECK:STDOUT: %T.patt.loc9_27.1: %pattern_type.709 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_27.2 (constants.%T.patt.478)]
// CHECK:STDOUT: %x.param_patt.loc9_57.1: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = value_param_pattern [symbolic = %x.param_patt.loc9_57.2 (constants.%x.param_patt.e3c)]
// CHECK:STDOUT: %x.patt.loc9_57.1: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = at_binding_pattern x, %x.param_patt.loc9_57.1 [symbolic = %x.patt.loc9_57.2 (constants.%x.patt.a06)]
// CHECK:STDOUT: %return.param_patt.loc9_65.1: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = out_param_pattern [symbolic = %return.param_patt.loc9_65.2 (constants.%return.param_patt.7e9)]
// CHECK:STDOUT: %return.patt.loc9_62.1: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = return_slot_pattern %return.param_patt.loc9_65.1, %.loc9_65.3 [symbolic = %return.patt.loc9_62.2 (constants.%return.patt.c4f)]
// CHECK:STDOUT: %T.patt.loc9_35.1: %pattern_type.709 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_35.2 (constants.%T.patt.478)]
// CHECK:STDOUT: %x.param_patt.loc9_64.1: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = value_param_pattern [symbolic = %x.param_patt.loc9_64.2 (constants.%x.param_patt.e3c)]
// CHECK:STDOUT: %x.patt.loc9_64.1: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = at_binding_pattern x, %x.param_patt.loc9_64.1 [symbolic = %x.patt.loc9_64.2 (constants.%x.patt.a06)]
// CHECK:STDOUT: %return.param_patt.loc9_72.1: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = out_param_pattern [symbolic = %return.param_patt.loc9_72.2 (constants.%return.param_patt.7e9)]
// CHECK:STDOUT: %return.patt.loc9_69.1: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = return_slot_pattern %return.param_patt.loc9_72.1, %.loc9_72.3 [symbolic = %return.patt.loc9_69.2 (constants.%return.patt.c4f)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %T.ref.loc9_65: %facet_type = name_ref T, %T.loc9_27.2 [symbolic = %T.loc9_27.1 (constants.%T.283)]
// CHECK:STDOUT: %T.as_type.loc9_65: type = facet_access_type %T.ref.loc9_65 [symbolic = %T.as_type.loc9_59.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %.loc9_65.3: type = converted %T.ref.loc9_65, %T.as_type.loc9_65 [symbolic = %T.as_type.loc9_59.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %.loc9_65.4: Core.Form = init_form %.loc9_65.3 [symbolic = %.loc9_65.2 (constants.%.2b9)]
// CHECK:STDOUT: %.loc9_40.1: type = splice_block %.loc9_40.3 [concrete = constants.%facet_type] {
// CHECK:STDOUT: %T.ref.loc9_72: %facet_type = name_ref T, %T.loc9_35.2 [symbolic = %T.loc9_35.1 (constants.%T.283)]
// CHECK:STDOUT: %T.as_type.loc9_72: type = facet_access_type %T.ref.loc9_72 [symbolic = %T.as_type.loc9_66.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %.loc9_72.3: type = converted %T.ref.loc9_72, %T.as_type.loc9_72 [symbolic = %T.as_type.loc9_66.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %.loc9_72.4: Core.Form = init_form %.loc9_72.3 [symbolic = %.loc9_72.2 (constants.%.2b9)]
// CHECK:STDOUT: %.loc9_47.1: type = splice_block %.loc9_47.3 [concrete = constants.%facet_type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %Core.ref.loc9_30: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
// CHECK:STDOUT: %Core.ref.loc9_37: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
// CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
// CHECK:STDOUT: %Core.ref.loc9_42: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
// CHECK:STDOUT: %Core.ref.loc9_49: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
// CHECK:STDOUT: %Destroy.ref: type = name_ref Destroy, imports.%Core.Destroy [concrete = constants.%Destroy.type]
// CHECK:STDOUT: %impl.elem0.loc9: %.d56 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op]
// CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %Copy.ref, %impl.elem0.loc9 [concrete = constants.%type.as.BitAndWith.impl.Op.bound]
// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call: init type = call %bound_method.loc9(%Copy.ref, %Destroy.ref) [concrete = constants.%facet_type]
// CHECK:STDOUT: %.loc9_40.2: type = value_of_initializer %type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type]
// CHECK:STDOUT: %.loc9_40.3: type = converted %type.as.BitAndWith.impl.Op.call, %.loc9_40.2 [concrete = constants.%facet_type]
// CHECK:STDOUT: %.loc9_47.2: type = value_of_initializer %type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type]
// CHECK:STDOUT: %.loc9_47.3: type = converted %type.as.BitAndWith.impl.Op.call, %.loc9_47.2 [concrete = constants.%facet_type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc9_27.2: %facet_type = symbolic_binding T, 0 [symbolic = %T.loc9_27.1 (constants.%T.283)]
// CHECK:STDOUT: %x.param: @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) = value_param call_param0
// CHECK:STDOUT: %.loc9_59.1: type = splice_block %.loc9_59.2 [symbolic = %T.as_type.loc9_59.1 (constants.%T.as_type.74b)] {
// CHECK:STDOUT: %T.ref.loc9_59: %facet_type = name_ref T, %T.loc9_27.2 [symbolic = %T.loc9_27.1 (constants.%T.283)]
// CHECK:STDOUT: %T.as_type.loc9_59.2: type = facet_access_type %T.ref.loc9_59 [symbolic = %T.as_type.loc9_59.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %.loc9_59.2: type = converted %T.ref.loc9_59, %T.as_type.loc9_59.2 [symbolic = %T.as_type.loc9_59.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %T.loc9_35.2: %facet_type = symbolic_binding T, 0 [symbolic = %T.loc9_35.1 (constants.%T.283)]
// CHECK:STDOUT: %x.param: @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) = value_param call_param0
// CHECK:STDOUT: %.loc9_66.1: type = splice_block %.loc9_66.2 [symbolic = %T.as_type.loc9_66.1 (constants.%T.as_type.74b)] {
// CHECK:STDOUT: %T.ref.loc9_66: %facet_type = name_ref T, %T.loc9_35.2 [symbolic = %T.loc9_35.1 (constants.%T.283)]
// CHECK:STDOUT: %T.as_type.loc9_66.2: type = facet_access_type %T.ref.loc9_66 [symbolic = %T.as_type.loc9_66.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %.loc9_66.2: type = converted %T.ref.loc9_66, %T.as_type.loc9_66.2 [symbolic = %T.as_type.loc9_66.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %x: @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) = wrapper_binding x, %x.param
// CHECK:STDOUT: %return.param: ref @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) = out_param call_param1
// CHECK:STDOUT: %return: ref @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) = return_slot %return.param
// CHECK:STDOUT: %x: @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) = wrapper_binding x, %x.param
// CHECK:STDOUT: %return.param: ref @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) = out_param call_param1
// CHECK:STDOUT: %return: ref @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %InitFromStructSpecific.decl: %InitFromStructSpecific.type = fn_decl @InitFromStructSpecific [concrete = constants.%InitFromStructSpecific] {
// CHECK:STDOUT: %x.param_patt: %pattern_type.6b6 = value_param_pattern [concrete = constants.%x.param_patt.cee]
@@ -211,34 +211,34 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @InitFromStructGeneric(%T.loc9_27.2: %facet_type) {
// CHECK:STDOUT: %T.patt.loc9_27.2: %pattern_type.709 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_27.2 (constants.%T.patt.478)]
// CHECK:STDOUT: %T.loc9_27.1: %facet_type = symbolic_binding T, 0 [symbolic = %T.loc9_27.1 (constants.%T.283)]
// CHECK:STDOUT: %T.as_type.loc9_59.1: type = facet_access_type %T.loc9_27.1 [symbolic = %T.as_type.loc9_59.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %pattern_type.loc9: type = pattern_type %T.as_type.loc9_59.1 [symbolic = %pattern_type.loc9 (constants.%pattern_type.44a)]
// CHECK:STDOUT: %x.param_patt.loc9_57.2: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = value_param_pattern [symbolic = %x.param_patt.loc9_57.2 (constants.%x.param_patt.e3c)]
// CHECK:STDOUT: %x.patt.loc9_57.2: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = at_binding_pattern x, %x.param_patt.loc9_57.2 [symbolic = %x.patt.loc9_57.2 (constants.%x.patt.a06)]
// CHECK:STDOUT: %.loc9_65.2: Core.Form = init_form %T.as_type.loc9_59.1 [symbolic = %.loc9_65.2 (constants.%.2b9)]
// CHECK:STDOUT: %return.param_patt.loc9_65.2: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = out_param_pattern [symbolic = %return.param_patt.loc9_65.2 (constants.%return.param_patt.7e9)]
// CHECK:STDOUT: %return.patt.loc9_62.2: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = return_slot_pattern %return.param_patt.loc9_65.2, %T.as_type.loc9_59.1 [symbolic = %return.patt.loc9_62.2 (constants.%return.patt.c4f)]
// CHECK:STDOUT: generic fn @InitFromStructGeneric(%T.loc9_35.2: %facet_type) {
// CHECK:STDOUT: %T.patt.loc9_35.2: %pattern_type.709 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_35.2 (constants.%T.patt.478)]
// CHECK:STDOUT: %T.loc9_35.1: %facet_type = symbolic_binding T, 0 [symbolic = %T.loc9_35.1 (constants.%T.283)]
// CHECK:STDOUT: %T.as_type.loc9_66.1: type = facet_access_type %T.loc9_35.1 [symbolic = %T.as_type.loc9_66.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %pattern_type.loc9: type = pattern_type %T.as_type.loc9_66.1 [symbolic = %pattern_type.loc9 (constants.%pattern_type.44a)]
// CHECK:STDOUT: %x.param_patt.loc9_64.2: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = value_param_pattern [symbolic = %x.param_patt.loc9_64.2 (constants.%x.param_patt.e3c)]
// CHECK:STDOUT: %x.patt.loc9_64.2: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = at_binding_pattern x, %x.param_patt.loc9_64.2 [symbolic = %x.patt.loc9_64.2 (constants.%x.patt.a06)]
// CHECK:STDOUT: %.loc9_72.2: Core.Form = init_form %T.as_type.loc9_66.1 [symbolic = %.loc9_72.2 (constants.%.2b9)]
// CHECK:STDOUT: %return.param_patt.loc9_72.2: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = out_param_pattern [symbolic = %return.param_patt.loc9_72.2 (constants.%return.param_patt.7e9)]
// CHECK:STDOUT: %return.patt.loc9_69.2: @InitFromStructGeneric.%pattern_type.loc9 (%pattern_type.44a) = return_slot_pattern %return.param_patt.loc9_72.2, %T.as_type.loc9_66.1 [symbolic = %return.patt.loc9_69.2 (constants.%return.patt.c4f)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete.loc9: <witness> = require_complete_type %T.as_type.loc9_59.1 [symbolic = %require_complete.loc9 (constants.%require_complete.44d)]
// CHECK:STDOUT: %Destroy.lookup_impl_witness.loc10_17: <witness> = lookup_impl_witness %T.loc9_27.1, @Destroy [symbolic = %Destroy.lookup_impl_witness.loc10_17 (constants.%Destroy.lookup_impl_witness.28a)]
// CHECK:STDOUT: %Destroy.facet.loc10_17.2: %Destroy.type = facet_value %T.as_type.loc9_59.1, (%Destroy.lookup_impl_witness.loc10_17) [symbolic = %Destroy.facet.loc10_17.2 (constants.%Destroy.facet.16e)]
// CHECK:STDOUT: %require_complete.loc9: <witness> = require_complete_type %T.as_type.loc9_66.1 [symbolic = %require_complete.loc9 (constants.%require_complete.44d)]
// CHECK:STDOUT: %Destroy.lookup_impl_witness.loc10_17: <witness> = lookup_impl_witness %T.loc9_35.1, @Destroy [symbolic = %Destroy.lookup_impl_witness.loc10_17 (constants.%Destroy.lookup_impl_witness.28a)]
// CHECK:STDOUT: %Destroy.facet.loc10_17.2: %Destroy.type = facet_value %T.as_type.loc9_66.1, (%Destroy.lookup_impl_witness.loc10_17) [symbolic = %Destroy.facet.loc10_17.2 (constants.%Destroy.facet.16e)]
// CHECK:STDOUT: %Class.loc10_17.2: type = class_type @Class, @Class(%Destroy.facet.loc10_17.2) [symbolic = %Class.loc10_17.2 (constants.%Class.55b)]
// CHECK:STDOUT: %require_complete.loc10: <witness> = require_complete_type %Class.loc10_17.2 [symbolic = %require_complete.loc10 (constants.%require_complete.ff5)]
// CHECK:STDOUT: %pattern_type.loc10: type = pattern_type %Class.loc10_17.2 [symbolic = %pattern_type.loc10 (constants.%pattern_type.0b6)]
// CHECK:STDOUT: %v.patt.loc10_8.2: @InitFromStructGeneric.%pattern_type.loc10 (%pattern_type.0b6) = ref_binding_pattern v [symbolic = %v.patt.loc10_8.2 (constants.%v.patt.ef6)]
// CHECK:STDOUT: %v.var_patt.loc10_3.2: @InitFromStructGeneric.%pattern_type.loc10 (%pattern_type.0b6) = var_pattern %v.patt.loc10_8.2 [symbolic = %v.var_patt.loc10_3.2 (constants.%v.var_patt.8cf)]
// CHECK:STDOUT: %struct_type.k: type = struct_type {.k: @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b)} [symbolic = %struct_type.k (constants.%struct_type.k.aa4)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc9_27.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.4df)]
// CHECK:STDOUT: %Copy.facet.loc10_27.3: %Copy.type = facet_value %T.as_type.loc9_59.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet.loc10_27.3 (constants.%Copy.facet.3f0)]
// CHECK:STDOUT: %struct_type.k: type = struct_type {.k: @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b)} [symbolic = %struct_type.k (constants.%struct_type.k.aa4)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc9_35.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.4df)]
// CHECK:STDOUT: %Copy.facet.loc10_27.3: %Copy.type = facet_value %T.as_type.loc9_66.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet.loc10_27.3 (constants.%Copy.facet.3f0)]
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.loc10_27.3) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.090)]
// CHECK:STDOUT: %.loc10_27.3: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %Copy.facet.loc10_27.3 [symbolic = %.loc10_27.3 (constants.%.018)]
// CHECK:STDOUT: %impl.elem0.loc10_27.2: @InitFromStructGeneric.%.loc10_27.3 (%.018) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_27.2 (constants.%impl.elem0.170)]
// CHECK:STDOUT: %specific_impl_fn.loc10_27.2: <specific function> = specific_impl_function %impl.elem0.loc10_27.2, @Copy.WithSelf.Op(%Copy.facet.loc10_27.3) [symbolic = %specific_impl_fn.loc10_27.2 (constants.%specific_impl_fn.be5)]
// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class.loc10_17.2, %T.as_type.loc9_59.1 [symbolic = %Class.elem (constants.%Class.elem.b97)]
// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class.loc10_17.2, %T.as_type.loc9_66.1 [symbolic = %Class.elem (constants.%Class.elem.b97)]
// CHECK:STDOUT: %Destroy.lookup_impl_witness.loc10_3: <witness> = lookup_impl_witness %Class.loc10_17.2, @Destroy [symbolic = %Destroy.lookup_impl_witness.loc10_3 (constants.%Destroy.lookup_impl_witness.62e)]
// CHECK:STDOUT: %Destroy.facet.loc10_3.3: %Destroy.type = facet_value %Class.loc10_17.2, (%Destroy.lookup_impl_witness.loc10_3) [symbolic = %Destroy.facet.loc10_3.3 (constants.%Destroy.facet.25e)]
// CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.loc10_3.3) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.d76)]
@@ -246,10 +246,10 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT: %impl.elem0.loc10_3.2: @InitFromStructGeneric.%.loc10_3.4 (%.0da) = impl_witness_access %Destroy.lookup_impl_witness.loc10_3, element0 [symbolic = %impl.elem0.loc10_3.2 (constants.%impl.elem0.730)]
// CHECK:STDOUT: %specific_impl_fn.loc10_3.2: <specific function> = specific_impl_function %impl.elem0.loc10_3.2, @Destroy.WithSelf.Op(%Destroy.facet.loc10_3.3) [symbolic = %specific_impl_fn.loc10_3.2 (constants.%specific_impl_fn.fa9)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%x.param: @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b)) -> out %return.param: @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) {
// CHECK:STDOUT: fn(%x.param: @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b)) -> out %return.param: @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %v.var: ref @InitFromStructGeneric.%Class.loc10_17.2 (%Class.55b) = var_storage %v.var_patt.loc10_3.1
// CHECK:STDOUT: %x.ref: @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) = name_ref x, %x
// CHECK:STDOUT: %x.ref: @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) = name_ref x, %x
// CHECK:STDOUT: %.loc10_28.1: @InitFromStructGeneric.%struct_type.k (%struct_type.k.aa4) = struct_literal (%x.ref)
// CHECK:STDOUT: %impl.elem0.loc10_27.1: @InitFromStructGeneric.%.loc10_27.3 (%.018) = impl_witness_access constants.%Copy.lookup_impl_witness.4df, element0 [symbolic = %impl.elem0.loc10_27.2 (constants.%impl.elem0.170)]
// CHECK:STDOUT: %bound_method.loc10_27.1: <bound method> = bound_method %x.ref, %impl.elem0.loc10_27.1
@@ -259,16 +259,16 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT: %.loc10_27.2: %Copy.type = converted constants.%T.as_type.74b, %Copy.facet.loc10_27.2 [symbolic = %Copy.facet.loc10_27.3 (constants.%Copy.facet.3f0)]
// CHECK:STDOUT: %specific_impl_fn.loc10_27.1: <specific function> = specific_impl_function %impl.elem0.loc10_27.1, @Copy.WithSelf.Op(constants.%Copy.facet.3f0) [symbolic = %specific_impl_fn.loc10_27.2 (constants.%specific_impl_fn.be5)]
// CHECK:STDOUT: %bound_method.loc10_27.2: <bound method> = bound_method %x.ref, %specific_impl_fn.loc10_27.1
// CHECK:STDOUT: %.loc10_28.2: ref @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) = class_element_access %v.var, element0
// CHECK:STDOUT: %Copy.WithSelf.Op.call.loc10: init @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) to %.loc10_28.2 = call %bound_method.loc10_27.2(%x.ref)
// CHECK:STDOUT: %.loc10_28.3: init @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) to %.loc10_28.2 = in_place_init %Copy.WithSelf.Op.call.loc10
// CHECK:STDOUT: %.loc10_28.2: ref @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) = class_element_access %v.var, element0
// CHECK:STDOUT: %Copy.WithSelf.Op.call.loc10: init @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) to %.loc10_28.2 = call %bound_method.loc10_27.2(%x.ref)
// CHECK:STDOUT: %.loc10_28.3: init @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) to %.loc10_28.2 = in_place_init %Copy.WithSelf.Op.call.loc10
// CHECK:STDOUT: %.loc10_28.4: init @InitFromStructGeneric.%Class.loc10_17.2 (%Class.55b) to %v.var = class_init (%.loc10_28.3)
// CHECK:STDOUT: %.loc10_3.1: init @InitFromStructGeneric.%Class.loc10_17.2 (%Class.55b) = converted %.loc10_28.1, %.loc10_28.4
// CHECK:STDOUT: assign %v.var, %.loc10_3.1
// CHECK:STDOUT: %.loc10_17.1: type = splice_block %Class.loc10_17.1 [symbolic = %Class.loc10_17.2 (constants.%Class.55b)] {
// CHECK:STDOUT: %Class.ref: %Class.type = name_ref Class, file.%Class.decl [concrete = constants.%Class.generic]
// CHECK:STDOUT: %T.ref.loc10: %facet_type = name_ref T, %T.loc9_27.2 [symbolic = %T.loc9_27.1 (constants.%T.283)]
// CHECK:STDOUT: %T.as_type.loc10: type = facet_access_type %T.ref.loc10 [symbolic = %T.as_type.loc9_59.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %T.ref.loc10: %facet_type = name_ref T, %T.loc9_35.2 [symbolic = %T.loc9_35.1 (constants.%T.283)]
// CHECK:STDOUT: %T.as_type.loc10: type = facet_access_type %T.ref.loc10 [symbolic = %T.as_type.loc9_66.1 (constants.%T.as_type.74b)]
// CHECK:STDOUT: %Destroy.facet.loc10_17.1: %Destroy.type = facet_value %T.as_type.loc10, (constants.%Destroy.lookup_impl_witness.28a) [symbolic = %Destroy.facet.loc10_17.2 (constants.%Destroy.facet.16e)]
// CHECK:STDOUT: %.loc10_17.2: %Destroy.type = converted %T.ref.loc10, %Destroy.facet.loc10_17.1 [symbolic = %Destroy.facet.loc10_17.2 (constants.%Destroy.facet.16e)]
// CHECK:STDOUT: %Class.loc10_17.1: type = class_type @Class, @Class(constants.%Destroy.facet.16e) [symbolic = %Class.loc10_17.2 (constants.%Class.55b)]
@@ -280,8 +280,8 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT: }
// CHECK:STDOUT: %v.ref: ref @InitFromStructGeneric.%Class.loc10_17.2 (%Class.55b) = name_ref v, %v
// CHECK:STDOUT: %k.ref: @InitFromStructGeneric.%Class.elem (%Class.elem.b97) = name_ref k, @Class.%.loc5 [concrete = @Class.%.loc5]
// CHECK:STDOUT: %.loc11_11.1: ref @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) = class_element_access %v.ref, element0
// CHECK:STDOUT: %.loc11_11.2: @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) = acquire_value %.loc11_11.1
// CHECK:STDOUT: %.loc11_11.1: ref @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) = class_element_access %v.ref, element0
// CHECK:STDOUT: %.loc11_11.2: @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) = acquire_value %.loc11_11.1
// CHECK:STDOUT: %impl.elem0.loc11: @InitFromStructGeneric.%.loc10_27.3 (%.018) = impl_witness_access constants.%Copy.lookup_impl_witness.4df, element0 [symbolic = %impl.elem0.loc10_27.2 (constants.%impl.elem0.170)]
// CHECK:STDOUT: %bound_method.loc11_11.1: <bound method> = bound_method %.loc11_11.2, %impl.elem0.loc11
// CHECK:STDOUT: %Copy.facet.loc11_11.1: %Copy.type = facet_value constants.%T.as_type.74b, (constants.%Copy.lookup_impl_witness.4df) [symbolic = %Copy.facet.loc10_27.3 (constants.%Copy.facet.3f0)]
@@ -290,8 +290,8 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT: %.loc11_11.4: %Copy.type = converted constants.%T.as_type.74b, %Copy.facet.loc11_11.2 [symbolic = %Copy.facet.loc10_27.3 (constants.%Copy.facet.3f0)]
// CHECK:STDOUT: %specific_impl_fn.loc11: <specific function> = specific_impl_function %impl.elem0.loc11, @Copy.WithSelf.Op(constants.%Copy.facet.3f0) [symbolic = %specific_impl_fn.loc10_27.2 (constants.%specific_impl_fn.be5)]
// CHECK:STDOUT: %bound_method.loc11_11.2: <bound method> = bound_method %.loc11_11.2, %specific_impl_fn.loc11
// CHECK:STDOUT: %.loc9_65.1: ref @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) = splice_block %return.param {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call.loc11: init @InitFromStructGeneric.%T.as_type.loc9_59.1 (%T.as_type.74b) to %.loc9_65.1 = call %bound_method.loc11_11.2(%.loc11_11.2)
// CHECK:STDOUT: %.loc9_72.1: ref @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) = splice_block %return.param {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call.loc11: init @InitFromStructGeneric.%T.as_type.loc9_66.1 (%T.as_type.74b) to %.loc9_72.1 = call %bound_method.loc11_11.2(%.loc11_11.2)
// CHECK:STDOUT: %impl.elem0.loc10_3.1: @InitFromStructGeneric.%.loc10_3.4 (%.0da) = impl_witness_access constants.%Destroy.lookup_impl_witness.62e, element0 [symbolic = %impl.elem0.loc10_3.2 (constants.%impl.elem0.730)]
// CHECK:STDOUT: %bound_method.loc10_3.1: <bound method> = bound_method %v.var, %impl.elem0.loc10_3.1
// CHECK:STDOUT: %Destroy.facet.loc10_3.1: %Destroy.type = facet_value constants.%Class.55b, (constants.%Destroy.lookup_impl_witness.62e) [symbolic = %Destroy.facet.loc10_3.3 (constants.%Destroy.facet.25e)]
@@ -374,15 +374,15 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @InitFromStructGeneric(constants.%T.283) {
// CHECK:STDOUT: %T.patt.loc9_27.2 => constants.%T.patt.478
// CHECK:STDOUT: %T.loc9_27.1 => constants.%T.283
// CHECK:STDOUT: %T.as_type.loc9_59.1 => constants.%T.as_type.74b
// CHECK:STDOUT: %T.patt.loc9_35.2 => constants.%T.patt.478
// CHECK:STDOUT: %T.loc9_35.1 => constants.%T.283
// CHECK:STDOUT: %T.as_type.loc9_66.1 => constants.%T.as_type.74b
// CHECK:STDOUT: %pattern_type.loc9 => constants.%pattern_type.44a
// CHECK:STDOUT: %x.param_patt.loc9_57.2 => constants.%x.param_patt.e3c
// CHECK:STDOUT: %x.patt.loc9_57.2 => constants.%x.patt.a06
// CHECK:STDOUT: %.loc9_65.2 => constants.%.2b9
// CHECK:STDOUT: %return.param_patt.loc9_65.2 => constants.%return.param_patt.7e9
// CHECK:STDOUT: %return.patt.loc9_62.2 => constants.%return.patt.c4f
// CHECK:STDOUT: %x.param_patt.loc9_64.2 => constants.%x.param_patt.e3c
// CHECK:STDOUT: %x.patt.loc9_64.2 => constants.%x.patt.a06
// CHECK:STDOUT: %.loc9_72.2 => constants.%.2b9
// CHECK:STDOUT: %return.param_patt.loc9_72.2 => constants.%return.param_patt.7e9
// CHECK:STDOUT: %return.patt.loc9_69.2 => constants.%return.patt.c4f
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- adapt.carbon
@@ -453,31 +453,31 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: %InitFromAdaptedGeneric.decl: %InitFromAdaptedGeneric.type = fn_decl @InitFromAdaptedGeneric [concrete = constants.%InitFromAdaptedGeneric] {
// CHECK:STDOUT: %T.patt.loc9_28.1: %pattern_type.e81 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_28.2 (constants.%T.patt.fe6)]
// CHECK:STDOUT: %x.param_patt.loc9_43.1: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = value_param_pattern [symbolic = %x.param_patt.loc9_43.2 (constants.%x.param_patt.1f4)]
// CHECK:STDOUT: %x.patt.loc9_43.1: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = at_binding_pattern x, %x.param_patt.loc9_43.1 [symbolic = %x.patt.loc9_43.2 (constants.%x.patt.f93)]
// CHECK:STDOUT: %return.param_patt.loc9_51.1: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc9_51.2 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc9_48.1: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc9_51.1, %.loc9_51.3 [symbolic = %return.patt.loc9_48.2 (constants.%return.patt.f44)]
// CHECK:STDOUT: %T.patt.loc9_36.1: %pattern_type.e81 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_36.2 (constants.%T.patt.fe6)]
// CHECK:STDOUT: %x.param_patt.loc9_50.1: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = value_param_pattern [symbolic = %x.param_patt.loc9_50.2 (constants.%x.param_patt.1f4)]
// CHECK:STDOUT: %x.patt.loc9_50.1: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = at_binding_pattern x, %x.param_patt.loc9_50.1 [symbolic = %x.patt.loc9_50.2 (constants.%x.patt.f93)]
// CHECK:STDOUT: %return.param_patt.loc9_58.1: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc9_58.2 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc9_55.1: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc9_58.1, %.loc9_58.3 [symbolic = %return.patt.loc9_55.2 (constants.%return.patt.f44)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %T.ref.loc9_51: %Copy.type = name_ref T, %T.loc9_28.2 [symbolic = %T.loc9_28.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc9_51: type = facet_access_type %T.ref.loc9_51 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc9_51.3: type = converted %T.ref.loc9_51, %T.as_type.loc9_51 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc9_51.4: Core.Form = init_form %.loc9_51.3 [symbolic = %.loc9_51.2 (constants.%.1ce700.2)]
// CHECK:STDOUT: %.loc9_35: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %T.ref.loc9_58: %Copy.type = name_ref T, %T.loc9_36.2 [symbolic = %T.loc9_36.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc9_58: type = facet_access_type %T.ref.loc9_58 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc9_58.3: type = converted %T.ref.loc9_58, %T.as_type.loc9_58 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc9_58.4: Core.Form = init_form %.loc9_58.3 [symbolic = %.loc9_58.2 (constants.%.1ce700.2)]
// CHECK:STDOUT: %.loc9_42: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
// CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc9_28.2: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc9_28.1 (constants.%T.f84)]
// CHECK:STDOUT: %x.param: @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) = value_param call_param0
// CHECK:STDOUT: %.loc9_45.1: type = splice_block %.loc9_45.2 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)] {
// CHECK:STDOUT: %T.ref.loc9_45: %Copy.type = name_ref T, %T.loc9_28.2 [symbolic = %T.loc9_28.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc9_45.2: type = facet_access_type %T.ref.loc9_45 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc9_45.2: type = converted %T.ref.loc9_45, %T.as_type.loc9_45.2 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)]
// CHECK:STDOUT: %T.loc9_36.2: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc9_36.1 (constants.%T.f84)]
// CHECK:STDOUT: %x.param: @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) = value_param call_param0
// CHECK:STDOUT: %.loc9_52.1: type = splice_block %.loc9_52.2 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)] {
// CHECK:STDOUT: %T.ref.loc9_52: %Copy.type = name_ref T, %T.loc9_36.2 [symbolic = %T.loc9_36.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc9_52.2: type = facet_access_type %T.ref.loc9_52 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc9_52.2: type = converted %T.ref.loc9_52, %T.as_type.loc9_52.2 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %x: @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) = wrapper_binding x, %x.param
// CHECK:STDOUT: %return.param: ref @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) = out_param call_param1
// CHECK:STDOUT: %return: ref @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) = return_slot %return.param
// CHECK:STDOUT: %x: @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) = wrapper_binding x, %x.param
// CHECK:STDOUT: %return.param: ref @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) = out_param call_param1
// CHECK:STDOUT: %return: ref @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %InitFromAdaptedSpecific.decl: %InitFromAdaptedSpecific.type = fn_decl @InitFromAdaptedSpecific [concrete = constants.%InitFromAdaptedSpecific] {
// CHECK:STDOUT: %x.param_patt: %pattern_type.6b6 = value_param_pattern [concrete = constants.%x.param_patt.cee]
@@ -495,50 +495,50 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @InitFromAdaptedGeneric(%T.loc9_28.2: %Copy.type) {
// CHECK:STDOUT: %T.patt.loc9_28.2: %pattern_type.e81 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_28.2 (constants.%T.patt.fe6)]
// CHECK:STDOUT: %T.loc9_28.1: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc9_28.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc9_45.1: type = facet_access_type %T.loc9_28.1 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)]
// CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc9_45.1 [symbolic = %pattern_type (constants.%pattern_type.2c66b4.2)]
// CHECK:STDOUT: %x.param_patt.loc9_43.2: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = value_param_pattern [symbolic = %x.param_patt.loc9_43.2 (constants.%x.param_patt.1f4)]
// CHECK:STDOUT: %x.patt.loc9_43.2: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = at_binding_pattern x, %x.param_patt.loc9_43.2 [symbolic = %x.patt.loc9_43.2 (constants.%x.patt.f93)]
// CHECK:STDOUT: %.loc9_51.2: Core.Form = init_form %T.as_type.loc9_45.1 [symbolic = %.loc9_51.2 (constants.%.1ce700.2)]
// CHECK:STDOUT: %return.param_patt.loc9_51.2: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc9_51.2 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc9_48.2: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc9_51.2, %T.as_type.loc9_45.1 [symbolic = %return.patt.loc9_48.2 (constants.%return.patt.f44)]
// CHECK:STDOUT: generic fn @InitFromAdaptedGeneric(%T.loc9_36.2: %Copy.type) {
// CHECK:STDOUT: %T.patt.loc9_36.2: %pattern_type.e81 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_36.2 (constants.%T.patt.fe6)]
// CHECK:STDOUT: %T.loc9_36.1: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc9_36.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc9_52.1: type = facet_access_type %T.loc9_36.1 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)]
// CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc9_52.1 [symbolic = %pattern_type (constants.%pattern_type.2c66b4.2)]
// CHECK:STDOUT: %x.param_patt.loc9_50.2: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = value_param_pattern [symbolic = %x.param_patt.loc9_50.2 (constants.%x.param_patt.1f4)]
// CHECK:STDOUT: %x.patt.loc9_50.2: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = at_binding_pattern x, %x.param_patt.loc9_50.2 [symbolic = %x.patt.loc9_50.2 (constants.%x.patt.f93)]
// CHECK:STDOUT: %.loc9_58.2: Core.Form = init_form %T.as_type.loc9_52.1 [symbolic = %.loc9_58.2 (constants.%.1ce700.2)]
// CHECK:STDOUT: %return.param_patt.loc9_58.2: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc9_58.2 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc9_55.2: @InitFromAdaptedGeneric.%pattern_type (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc9_58.2, %T.as_type.loc9_52.1 [symbolic = %return.patt.loc9_55.2 (constants.%return.patt.f44)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete.loc9: <witness> = require_complete_type %T.as_type.loc9_45.1 [symbolic = %require_complete.loc9 (constants.%require_complete.d83)]
// CHECK:STDOUT: %Adapt.loc10_23.2: type = class_type @Adapt, @Adapt(%T.as_type.loc9_45.1) [symbolic = %Adapt.loc10_23.2 (constants.%Adapt.210)]
// CHECK:STDOUT: %require_complete.loc9: <witness> = require_complete_type %T.as_type.loc9_52.1 [symbolic = %require_complete.loc9 (constants.%require_complete.d83)]
// CHECK:STDOUT: %Adapt.loc10_23.2: type = class_type @Adapt, @Adapt(%T.as_type.loc9_52.1) [symbolic = %Adapt.loc10_23.2 (constants.%Adapt.210)]
// CHECK:STDOUT: %require_complete.loc10: <witness> = require_complete_type %Adapt.loc10_23.2 [symbolic = %require_complete.loc10 (constants.%require_complete.29a)]
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc9_28.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.2)]
// CHECK:STDOUT: %.loc10_26.5: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc9_28.1 [symbolic = %.loc10_26.5 (constants.%.c29)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc9_28.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c)]
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc9_36.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.2)]
// CHECK:STDOUT: %.loc10_26.5: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc9_36.1 [symbolic = %.loc10_26.5 (constants.%.c29)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc9_36.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c)]
// CHECK:STDOUT: %impl.elem0.loc10_26.2: @InitFromAdaptedGeneric.%.loc10_26.5 (%.c29) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_26.2 (constants.%impl.elem0.bd2)]
// CHECK:STDOUT: %specific_impl_fn.loc10_26.2: <specific function> = specific_impl_function %impl.elem0.loc10_26.2, @Copy.WithSelf.Op(%T.loc9_28.1) [symbolic = %specific_impl_fn.loc10_26.2 (constants.%specific_impl_fn.e2a)]
// CHECK:STDOUT: %specific_impl_fn.loc10_26.2: <specific function> = specific_impl_function %impl.elem0.loc10_26.2, @Copy.WithSelf.Op(%T.loc9_36.1) [symbolic = %specific_impl_fn.loc10_26.2 (constants.%specific_impl_fn.e2a)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%x.param: @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type)) -> out %return.param: @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) {
// CHECK:STDOUT: fn(%x.param: @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type)) -> out %return.param: @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %x.ref: @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) = name_ref x, %x
// CHECK:STDOUT: %x.ref: @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) = name_ref x, %x
// CHECK:STDOUT: %Adapt.ref: %Adapt.type = name_ref Adapt, file.%Adapt.decl [concrete = constants.%Adapt.generic]
// CHECK:STDOUT: %T.ref.loc10_22: %Copy.type = name_ref T, %T.loc9_28.2 [symbolic = %T.loc9_28.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc10_23: type = facet_access_type %T.ref.loc10_22 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc10_23: type = converted %T.ref.loc10_22, %T.as_type.loc10_23 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)]
// CHECK:STDOUT: %T.ref.loc10_22: %Copy.type = name_ref T, %T.loc9_36.2 [symbolic = %T.loc9_36.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc10_23: type = facet_access_type %T.ref.loc10_22 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc10_23: type = converted %T.ref.loc10_22, %T.as_type.loc10_23 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)]
// CHECK:STDOUT: %Adapt.loc10_23.1: type = class_type @Adapt, @Adapt(constants.%T.as_type) [symbolic = %Adapt.loc10_23.2 (constants.%Adapt.210)]
// CHECK:STDOUT: %.loc10_13.1: @InitFromAdaptedGeneric.%Adapt.loc10_23.2 (%Adapt.210) = as_compatible %x.ref
// CHECK:STDOUT: %.loc10_13.2: @InitFromAdaptedGeneric.%Adapt.loc10_23.2 (%Adapt.210) = converted %x.ref, %.loc10_13.1
// CHECK:STDOUT: %T.ref.loc10_29: %Copy.type = name_ref T, %T.loc9_28.2 [symbolic = %T.loc9_28.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc10_29: type = facet_access_type %T.ref.loc10_29 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc10_29: type = converted %T.ref.loc10_29, %T.as_type.loc10_29 [symbolic = %T.as_type.loc9_45.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc10_26.1: @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) = as_compatible %.loc10_13.2
// CHECK:STDOUT: %.loc10_26.2: @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) = converted %.loc10_13.2, %.loc10_26.1
// CHECK:STDOUT: %T.ref.loc10_29: %Copy.type = name_ref T, %T.loc9_36.2 [symbolic = %T.loc9_36.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc10_29: type = facet_access_type %T.ref.loc10_29 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc10_29: type = converted %T.ref.loc10_29, %T.as_type.loc10_29 [symbolic = %T.as_type.loc9_52.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc10_26.1: @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) = as_compatible %.loc10_13.2
// CHECK:STDOUT: %.loc10_26.2: @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) = converted %.loc10_13.2, %.loc10_26.1
// CHECK:STDOUT: %impl.elem0.loc10_26.1: @InitFromAdaptedGeneric.%.loc10_26.5 (%.c29) = impl_witness_access constants.%Copy.lookup_impl_witness.d9c, element0 [symbolic = %impl.elem0.loc10_26.2 (constants.%impl.elem0.bd2)]
// CHECK:STDOUT: %bound_method.loc10_26.1: <bound method> = bound_method %.loc10_26.2, %impl.elem0.loc10_26.1
// CHECK:STDOUT: %.loc10_26.3: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc9_28.1 (constants.%T.f84)]
// CHECK:STDOUT: %.loc10_26.4: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc9_28.1 (constants.%T.f84)]
// CHECK:STDOUT: %.loc10_26.3: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc9_36.1 (constants.%T.f84)]
// CHECK:STDOUT: %.loc10_26.4: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc9_36.1 (constants.%T.f84)]
// CHECK:STDOUT: %specific_impl_fn.loc10_26.1: <specific function> = specific_impl_function %impl.elem0.loc10_26.1, @Copy.WithSelf.Op(constants.%T.f84) [symbolic = %specific_impl_fn.loc10_26.2 (constants.%specific_impl_fn.e2a)]
// CHECK:STDOUT: %bound_method.loc10_26.2: <bound method> = bound_method %.loc10_26.2, %specific_impl_fn.loc10_26.1
// CHECK:STDOUT: %.loc9_51.1: ref @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) = splice_block %return.param {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @InitFromAdaptedGeneric.%T.as_type.loc9_45.1 (%T.as_type) to %.loc9_51.1 = call %bound_method.loc10_26.2(%.loc10_26.2)
// CHECK:STDOUT: %.loc9_58.1: ref @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) = splice_block %return.param {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @InitFromAdaptedGeneric.%T.as_type.loc9_52.1 (%T.as_type) to %.loc9_58.1 = call %bound_method.loc10_26.2(%.loc10_26.2)
// CHECK:STDOUT: return %Copy.WithSelf.Op.call to %return.param
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
@@ -567,14 +567,14 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @InitFromAdaptedGeneric(constants.%T.f84) {
// CHECK:STDOUT: %T.patt.loc9_28.2 => constants.%T.patt.fe6
// CHECK:STDOUT: %T.loc9_28.1 => constants.%T.f84
// CHECK:STDOUT: %T.as_type.loc9_45.1 => constants.%T.as_type
// CHECK:STDOUT: %T.patt.loc9_36.2 => constants.%T.patt.fe6
// CHECK:STDOUT: %T.loc9_36.1 => constants.%T.f84
// CHECK:STDOUT: %T.as_type.loc9_52.1 => constants.%T.as_type
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.2c66b4.2
// CHECK:STDOUT: %x.param_patt.loc9_43.2 => constants.%x.param_patt.1f4
// CHECK:STDOUT: %x.patt.loc9_43.2 => constants.%x.patt.f93
// CHECK:STDOUT: %.loc9_51.2 => constants.%.1ce700.2
// CHECK:STDOUT: %return.param_patt.loc9_51.2 => constants.%return.param_patt.bf4475.2
// CHECK:STDOUT: %return.patt.loc9_48.2 => constants.%return.patt.f44
// CHECK:STDOUT: %x.param_patt.loc9_50.2 => constants.%x.param_patt.1f4
// CHECK:STDOUT: %x.patt.loc9_50.2 => constants.%x.patt.f93
// CHECK:STDOUT: %.loc9_58.2 => constants.%.1ce700.2
// CHECK:STDOUT: %return.param_patt.loc9_58.2 => constants.%return.param_patt.bf4475.2
// CHECK:STDOUT: %return.patt.loc9_55.2 => constants.%return.patt.f44
// CHECK:STDOUT: }
// CHECK:STDOUT:
+17 -17
View File
@@ -14,7 +14,7 @@
library "[[@TEST_NAME]]";
class Class(T:! Core.Copy) {
class Class(T: Core.Copy) {
var x: T;
fn Get(self) -> T {
@@ -52,11 +52,11 @@ fn AddrMethodCall(p: Class(i32)*) -> i32 {
library "[[@TEST_NAME]]";
class Class(T:! type) {
class Class(T: type) {
fn Make() -> Class(T) { return {}; }
}
fn StaticMemberFunctionCall(T:! type) -> Class(T) {
fn StaticMemberFunctionCall(generic T: type) -> Class(T) {
//@dump-sem-ir-begin
return Class(T).Make();
//@dump-sem-ir-end
@@ -442,25 +442,25 @@ fn StaticMemberFunctionCall(T:! type) -> Class(T) {
// CHECK:STDOUT: %Class.Make.specific_fn: <specific function> = specific_function %Class.Make, @Class.Make(%T) [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @StaticMemberFunctionCall(%T.loc8_30.2: type) {
// CHECK:STDOUT: generic fn @StaticMemberFunctionCall(%T.loc8_38.2: type) {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Class.loc8_49.1 [symbolic = %require_complete (constants.%require_complete)]
// CHECK:STDOUT: %Class.Make.type: type = fn_type @Class.Make, @Class(%T.loc8_30.1) [symbolic = %Class.Make.type (constants.%Class.Make.type)]
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Class.loc8_56.1 [symbolic = %require_complete (constants.%require_complete)]
// CHECK:STDOUT: %Class.Make.type: type = fn_type @Class.Make, @Class(%T.loc8_38.1) [symbolic = %Class.Make.type (constants.%Class.Make.type)]
// CHECK:STDOUT: %Class.Make: @StaticMemberFunctionCall.%Class.Make.type (%Class.Make.type) = struct_value () [symbolic = %Class.Make (constants.%Class.Make)]
// CHECK:STDOUT: %Class.Make.specific_fn.loc10_18.2: <specific function> = specific_function %Class.Make, @Class.Make(%T.loc8_30.1) [symbolic = %Class.Make.specific_fn.loc10_18.2 (constants.%Class.Make.specific_fn)]
// CHECK:STDOUT: %Class.Make.specific_fn.loc10_18.2: <specific function> = specific_function %Class.Make, @Class.Make(%T.loc8_38.1) [symbolic = %Class.Make.specific_fn.loc10_18.2 (constants.%Class.Make.specific_fn)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn() -> out %return.param: @StaticMemberFunctionCall.%Class.loc8_49.1 (%Class) {
// CHECK:STDOUT: fn() -> out %return.param: @StaticMemberFunctionCall.%Class.loc8_56.1 (%Class) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Class.ref.loc10: %Class.type = name_ref Class, file.%Class.decl [concrete = constants.%Class.generic]
// CHECK:STDOUT: %T.ref.loc10: type = name_ref T, %T.loc8_30.2 [symbolic = %T.loc8_30.1 (constants.%T)]
// CHECK:STDOUT: %Class.loc10: type = class_type @Class, @Class(constants.%T) [symbolic = %Class.loc8_49.1 (constants.%Class)]
// CHECK:STDOUT: %T.ref.loc10: type = name_ref T, %T.loc8_38.2 [symbolic = %T.loc8_38.1 (constants.%T)]
// CHECK:STDOUT: %Class.loc10: type = class_type @Class, @Class(constants.%T) [symbolic = %Class.loc8_56.1 (constants.%Class)]
// CHECK:STDOUT: %.loc10: @StaticMemberFunctionCall.%Class.Make.type (%Class.Make.type) = specific_constant @Class.%Class.Make.decl, @Class(constants.%T) [symbolic = %Class.Make (constants.%Class.Make)]
// CHECK:STDOUT: %Make.ref: @StaticMemberFunctionCall.%Class.Make.type (%Class.Make.type) = name_ref Make, %.loc10 [symbolic = %Class.Make (constants.%Class.Make)]
// CHECK:STDOUT: %Class.Make.specific_fn.loc10_18.1: <specific function> = specific_function %Make.ref, @Class.Make(constants.%T) [symbolic = %Class.Make.specific_fn.loc10_18.2 (constants.%Class.Make.specific_fn)]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %Class.Make.call: init @StaticMemberFunctionCall.%Class.loc8_49.1 (%Class) to %.loc8_49.1 = call %Class.Make.specific_fn.loc10_18.1()
// CHECK:STDOUT: %Class.Make.call: init @StaticMemberFunctionCall.%Class.loc8_56.1 (%Class) to %.loc8_56.1 = call %Class.Make.specific_fn.loc10_18.1()
// CHECK:STDOUT: return %Class.Make.call to %return.param
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
@@ -468,12 +468,12 @@ fn StaticMemberFunctionCall(T:! type) -> Class(T) {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @StaticMemberFunctionCall(constants.%T) {
// CHECK:STDOUT: %T.patt.loc8_30.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc8_30.1 => constants.%T
// CHECK:STDOUT: %Class.loc8_49.1 => constants.%Class
// CHECK:STDOUT: %.loc8_49.2 => constants.%.030
// CHECK:STDOUT: %T.patt.loc8_38.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc8_38.1 => constants.%T
// CHECK:STDOUT: %Class.loc8_56.1 => constants.%Class
// CHECK:STDOUT: %.loc8_56.2 => constants.%.030
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.36e
// CHECK:STDOUT: %return.param_patt.loc8_49.2 => constants.%return.param_patt
// CHECK:STDOUT: %return.patt.loc8_39.2 => constants.%return.patt
// CHECK:STDOUT: %return.param_patt.loc8_56.2 => constants.%return.param_patt
// CHECK:STDOUT: %return.patt.loc8_46.2 => constants.%return.patt
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -15,7 +15,7 @@
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
class Class(T:! Core.Copy) {
class Class(T: Core.Copy) {
fn F(n: T) -> T {
return n;
}
@@ -33,7 +33,7 @@ class Class(T:! Core.Copy) {
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
class C(T:! Core.Copy) {
class C(T: Core.Copy) {
fn F() {
// CHECK:STDERR: fail_member_inline_missing_self_dot.carbon:[[@LINE+4]]:5: error: expression cannot be used as a value [UseOfNonExprAsValue]
// CHECK:STDERR: data;
+41 -41
View File
@@ -14,22 +14,22 @@
library "[[@TEST_NAME]]";
base class Base(T:! type) {
base class Base(T: type) {
var b: T;
}
class Derived(T:! type) {
class Derived(T: type) {
extend base: Base(T);
var d: T;
}
fn AccessDerived[T:! Core.Copy](x: Derived(T)) -> T {
fn AccessDerived[T: Core.Copy](x: Derived(T)) -> T {
//@dump-sem-ir-begin
return x.d;
//@dump-sem-ir-end
}
fn AccessBase[T:! Core.Copy](x: Derived(T)) -> T {
fn AccessBase[T: Core.Copy](x: Derived(T)) -> T {
//@dump-sem-ir-begin
return x.b;
//@dump-sem-ir-end
@@ -43,16 +43,16 @@ fn AccessConcrete(x: Derived(i32)) -> i32 {
library "[[@TEST_NAME]]";
base class Base(T:! type) {
base class Base(T: type) {
var b: T;
}
class Derived(T:! type) {
class Derived(T: type) {
extend base: Base(T);
var d: T;
}
fn AccessMissingBase[T:! type](x: Base(T)) -> T {
fn AccessMissingBase[T: type](x: Base(T)) -> T {
// CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Base(T)` [MemberNameNotFoundInSpecificScope]
// CHECK:STDERR: return x.nonesuch;
// CHECK:STDERR: ^~~~~~~~~~
@@ -60,7 +60,7 @@ fn AccessMissingBase[T:! type](x: Base(T)) -> T {
return x.nonesuch;
}
fn AccessMissingDerived[T:! type](x: Derived(T)) -> T {
fn AccessMissingDerived[T: type](x: Derived(T)) -> T {
// CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Derived(T)` [MemberNameNotFoundInSpecificScope]
// CHECK:STDERR: return x.nonesuch;
// CHECK:STDERR: ^~~~~~~~~~
@@ -110,20 +110,20 @@ fn AccessMissingConcrete(x: Derived(i32)) -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived.loc13_45.1, %T.as_type.loc13_45.1 [symbolic = %Derived.elem (constants.%Derived.elem.eb3)]
// CHECK:STDOUT: %require_complete.loc15: <witness> = require_complete_type %T.as_type.loc13_45.1 [symbolic = %require_complete.loc15 (constants.%require_complete.d83)]
// CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived.loc13_44.1, %T.as_type.loc13_44.1 [symbolic = %Derived.elem (constants.%Derived.elem.eb3)]
// CHECK:STDOUT: %require_complete.loc15: <witness> = require_complete_type %T.as_type.loc13_44.1 [symbolic = %require_complete.loc15 (constants.%require_complete.d83)]
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc13_19.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.2)]
// CHECK:STDOUT: %.loc15_11.5: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc13_19.1 [symbolic = %.loc15_11.5 (constants.%.c29)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc13_19.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c)]
// CHECK:STDOUT: %impl.elem0.loc15_11.2: @AccessDerived.%.loc15_11.5 (%.c29) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_11.2 (constants.%impl.elem0.bd2)]
// CHECK:STDOUT: %specific_impl_fn.loc15_11.2: <specific function> = specific_impl_function %impl.elem0.loc15_11.2, @Copy.WithSelf.Op(%T.loc13_19.1) [symbolic = %specific_impl_fn.loc15_11.2 (constants.%specific_impl_fn.e2a)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%x.param: @AccessDerived.%Derived.loc13_45.1 (%Derived.e87)) -> out %return.param: @AccessDerived.%T.as_type.loc13_45.1 (%T.as_type) {
// CHECK:STDOUT: fn(%x.param: @AccessDerived.%Derived.loc13_44.1 (%Derived.e87)) -> out %return.param: @AccessDerived.%T.as_type.loc13_44.1 (%T.as_type) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %x.ref: @AccessDerived.%Derived.loc13_45.1 (%Derived.e87) = name_ref x, %x
// CHECK:STDOUT: %x.ref: @AccessDerived.%Derived.loc13_44.1 (%Derived.e87) = name_ref x, %x
// CHECK:STDOUT: %d.ref: @AccessDerived.%Derived.elem (%Derived.elem.eb3) = name_ref d, @Derived.%.loc10 [concrete = @Derived.%.loc10]
// CHECK:STDOUT: %.loc15_11.1: ref @AccessDerived.%T.as_type.loc13_45.1 (%T.as_type) = class_element_access %x.ref, element1
// CHECK:STDOUT: %.loc15_11.2: @AccessDerived.%T.as_type.loc13_45.1 (%T.as_type) = acquire_value %.loc15_11.1
// CHECK:STDOUT: %.loc15_11.1: ref @AccessDerived.%T.as_type.loc13_44.1 (%T.as_type) = class_element_access %x.ref, element1
// CHECK:STDOUT: %.loc15_11.2: @AccessDerived.%T.as_type.loc13_44.1 (%T.as_type) = acquire_value %.loc15_11.1
// CHECK:STDOUT: %impl.elem0.loc15_11.1: @AccessDerived.%.loc15_11.5 (%.c29) = impl_witness_access constants.%Copy.lookup_impl_witness.d9c, element0 [symbolic = %impl.elem0.loc15_11.2 (constants.%impl.elem0.bd2)]
// CHECK:STDOUT: %bound_method.loc15_11.1: <bound method> = bound_method %.loc15_11.2, %impl.elem0.loc15_11.1
// CHECK:STDOUT: %.loc15_11.3: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc13_19.1 (constants.%T.f84)]
@@ -131,7 +131,7 @@ fn AccessMissingConcrete(x: Derived(i32)) -> i32 {
// CHECK:STDOUT: %specific_impl_fn.loc15_11.1: <specific function> = specific_impl_function %impl.elem0.loc15_11.1, @Copy.WithSelf.Op(constants.%T.f84) [symbolic = %specific_impl_fn.loc15_11.2 (constants.%specific_impl_fn.e2a)]
// CHECK:STDOUT: %bound_method.loc15_11.2: <bound method> = bound_method %.loc15_11.2, %specific_impl_fn.loc15_11.1
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @AccessDerived.%T.as_type.loc13_45.1 (%T.as_type) to %.loc13_51.1 = call %bound_method.loc15_11.2(%.loc15_11.2)
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @AccessDerived.%T.as_type.loc13_44.1 (%T.as_type) to %.loc13_50.1 = call %bound_method.loc15_11.2(%.loc15_11.2)
// CHECK:STDOUT: return %Copy.WithSelf.Op.call to %return.param
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
@@ -143,25 +143,25 @@ fn AccessMissingConcrete(x: Derived(i32)) -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %Base: type = class_type @Base, @Base(%T.as_type.loc19_42.1) [symbolic = %Base (constants.%Base.146)]
// CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %T.as_type.loc19_42.1 [symbolic = %Base.elem (constants.%Base.elem.209)]
// CHECK:STDOUT: %Base: type = class_type @Base, @Base(%T.as_type.loc19_41.1) [symbolic = %Base (constants.%Base.146)]
// CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %T.as_type.loc19_41.1 [symbolic = %Base.elem (constants.%Base.elem.209)]
// CHECK:STDOUT: %require_complete.loc21_11: <witness> = require_complete_type %Base [symbolic = %require_complete.loc21_11 (constants.%require_complete.0fb)]
// CHECK:STDOUT: %require_complete.loc21_13: <witness> = require_complete_type %T.as_type.loc19_42.1 [symbolic = %require_complete.loc21_13 (constants.%require_complete.d83)]
// CHECK:STDOUT: %require_complete.loc21_13: <witness> = require_complete_type %T.as_type.loc19_41.1 [symbolic = %require_complete.loc21_13 (constants.%require_complete.d83)]
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc19_16.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.2)]
// CHECK:STDOUT: %.loc21_11.8: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc19_16.1 [symbolic = %.loc21_11.8 (constants.%.c29)]
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc19_16.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c)]
// CHECK:STDOUT: %impl.elem0.loc21_11.2: @AccessBase.%.loc21_11.8 (%.c29) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc21_11.2 (constants.%impl.elem0.bd2)]
// CHECK:STDOUT: %specific_impl_fn.loc21_11.2: <specific function> = specific_impl_function %impl.elem0.loc21_11.2, @Copy.WithSelf.Op(%T.loc19_16.1) [symbolic = %specific_impl_fn.loc21_11.2 (constants.%specific_impl_fn.e2a)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%x.param: @AccessBase.%Derived.loc19_42.1 (%Derived.e87)) -> out %return.param: @AccessBase.%T.as_type.loc19_42.1 (%T.as_type) {
// CHECK:STDOUT: fn(%x.param: @AccessBase.%Derived.loc19_41.1 (%Derived.e87)) -> out %return.param: @AccessBase.%T.as_type.loc19_41.1 (%T.as_type) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %x.ref: @AccessBase.%Derived.loc19_42.1 (%Derived.e87) = name_ref x, %x
// CHECK:STDOUT: %x.ref: @AccessBase.%Derived.loc19_41.1 (%Derived.e87) = name_ref x, %x
// CHECK:STDOUT: %b.ref: @AccessBase.%Base.elem (%Base.elem.209) = name_ref b, @Base.%.loc5 [concrete = @Base.%.loc5]
// CHECK:STDOUT: %.loc21_11.1: @AccessBase.%Base (%Base.146) = as_compatible %x.ref
// CHECK:STDOUT: %.loc21_11.2: ref @AccessBase.%Base (%Base.146) = class_element_access %.loc21_11.1, element0
// CHECK:STDOUT: %.loc21_11.3: ref @AccessBase.%Base (%Base.146) = converted %x.ref, %.loc21_11.2
// CHECK:STDOUT: %.loc21_11.4: ref @AccessBase.%T.as_type.loc19_42.1 (%T.as_type) = class_element_access %.loc21_11.3, element0
// CHECK:STDOUT: %.loc21_11.5: @AccessBase.%T.as_type.loc19_42.1 (%T.as_type) = acquire_value %.loc21_11.4
// CHECK:STDOUT: %.loc21_11.4: ref @AccessBase.%T.as_type.loc19_41.1 (%T.as_type) = class_element_access %.loc21_11.3, element0
// CHECK:STDOUT: %.loc21_11.5: @AccessBase.%T.as_type.loc19_41.1 (%T.as_type) = acquire_value %.loc21_11.4
// CHECK:STDOUT: %impl.elem0.loc21_11.1: @AccessBase.%.loc21_11.8 (%.c29) = impl_witness_access constants.%Copy.lookup_impl_witness.d9c, element0 [symbolic = %impl.elem0.loc21_11.2 (constants.%impl.elem0.bd2)]
// CHECK:STDOUT: %bound_method.loc21_11.1: <bound method> = bound_method %.loc21_11.5, %impl.elem0.loc21_11.1
// CHECK:STDOUT: %.loc21_11.6: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc19_16.1 (constants.%T.f84)]
@@ -169,7 +169,7 @@ fn AccessMissingConcrete(x: Derived(i32)) -> i32 {
// CHECK:STDOUT: %specific_impl_fn.loc21_11.1: <specific function> = specific_impl_function %impl.elem0.loc21_11.1, @Copy.WithSelf.Op(constants.%T.f84) [symbolic = %specific_impl_fn.loc21_11.2 (constants.%specific_impl_fn.e2a)]
// CHECK:STDOUT: %bound_method.loc21_11.2: <bound method> = bound_method %.loc21_11.5, %specific_impl_fn.loc21_11.1
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @AccessBase.%T.as_type.loc19_42.1 (%T.as_type) to %.loc19_48.1 = call %bound_method.loc21_11.2(%.loc21_11.5)
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @AccessBase.%T.as_type.loc19_41.1 (%T.as_type) to %.loc19_47.1 = call %bound_method.loc21_11.2(%.loc21_11.5)
// CHECK:STDOUT: return %Copy.WithSelf.Op.call to %return.param
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
@@ -179,28 +179,28 @@ fn AccessMissingConcrete(x: Derived(i32)) -> i32 {
// CHECK:STDOUT: specific @AccessDerived(constants.%T.f84) {
// CHECK:STDOUT: %T.patt.loc13_19.2 => constants.%T.patt.fe6
// CHECK:STDOUT: %T.loc13_19.1 => constants.%T.f84
// CHECK:STDOUT: %T.as_type.loc13_45.1 => constants.%T.as_type
// CHECK:STDOUT: %Derived.loc13_45.1 => constants.%Derived.e87
// CHECK:STDOUT: %pattern_type.loc13_34 => constants.%pattern_type.ebc
// CHECK:STDOUT: %x.param_patt.loc13_34.2 => constants.%x.param_patt.203
// CHECK:STDOUT: %x.patt.loc13_34.2 => constants.%x.patt.c37
// CHECK:STDOUT: %.loc13_51.2 => constants.%.1ce700.2
// CHECK:STDOUT: %pattern_type.loc13_51 => constants.%pattern_type.2c66b4.2
// CHECK:STDOUT: %return.param_patt.loc13_51.2 => constants.%return.param_patt.bf4475.2
// CHECK:STDOUT: %return.patt.loc13_48.2 => constants.%return.patt.f44
// CHECK:STDOUT: %T.as_type.loc13_44.1 => constants.%T.as_type
// CHECK:STDOUT: %Derived.loc13_44.1 => constants.%Derived.e87
// CHECK:STDOUT: %pattern_type.loc13_33 => constants.%pattern_type.ebc
// CHECK:STDOUT: %x.param_patt.loc13_33.2 => constants.%x.param_patt.203
// CHECK:STDOUT: %x.patt.loc13_33.2 => constants.%x.patt.c37
// CHECK:STDOUT: %.loc13_50.2 => constants.%.1ce700.2
// CHECK:STDOUT: %pattern_type.loc13_50 => constants.%pattern_type.2c66b4.2
// CHECK:STDOUT: %return.param_patt.loc13_50.2 => constants.%return.param_patt.bf4475.2
// CHECK:STDOUT: %return.patt.loc13_47.2 => constants.%return.patt.f44
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @AccessBase(constants.%T.f84) {
// CHECK:STDOUT: %T.patt.loc19_16.2 => constants.%T.patt.fe6
// CHECK:STDOUT: %T.loc19_16.1 => constants.%T.f84
// CHECK:STDOUT: %T.as_type.loc19_42.1 => constants.%T.as_type
// CHECK:STDOUT: %Derived.loc19_42.1 => constants.%Derived.e87
// CHECK:STDOUT: %pattern_type.loc19_31 => constants.%pattern_type.ebc
// CHECK:STDOUT: %x.param_patt.loc19_31.2 => constants.%x.param_patt.203
// CHECK:STDOUT: %x.patt.loc19_31.2 => constants.%x.patt.c37
// CHECK:STDOUT: %.loc19_48.2 => constants.%.1ce700.2
// CHECK:STDOUT: %pattern_type.loc19_48 => constants.%pattern_type.2c66b4.2
// CHECK:STDOUT: %return.param_patt.loc19_48.2 => constants.%return.param_patt.bf4475.2
// CHECK:STDOUT: %return.patt.loc19_45.2 => constants.%return.patt.f44
// CHECK:STDOUT: %T.as_type.loc19_41.1 => constants.%T.as_type
// CHECK:STDOUT: %Derived.loc19_41.1 => constants.%Derived.e87
// CHECK:STDOUT: %pattern_type.loc19_30 => constants.%pattern_type.ebc
// CHECK:STDOUT: %x.param_patt.loc19_30.2 => constants.%x.param_patt.203
// CHECK:STDOUT: %x.patt.loc19_30.2 => constants.%x.patt.c37
// CHECK:STDOUT: %.loc19_47.2 => constants.%.1ce700.2
// CHECK:STDOUT: %pattern_type.loc19_47 => constants.%pattern_type.2c66b4.2
// CHECK:STDOUT: %return.param_patt.loc19_47.2 => constants.%return.param_patt.bf4475.2
// CHECK:STDOUT: %return.patt.loc19_44.2 => constants.%return.patt.f44
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -15,17 +15,17 @@
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
class Class(T:! Core.Copy) {
class Class(T: Core.Copy) {
fn F(n: T) -> T;
fn G(self) -> T;
var n: T;
}
fn Class(T:! Core.Copy).F(n: T) -> T {
fn Class(T: Core.Copy).F(n: T) -> T {
return n;
}
fn Class(T:! Core.Copy).G(self) -> T {
fn Class(T: Core.Copy).G(self) -> T {
return self.n;
}
//@dump-sem-ir-end
@@ -35,13 +35,13 @@ fn Class(T:! Core.Copy).G(self) -> T {
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
class A(T:! type) {
class B(_:! T) {
class A(T: type) {
class B(_: T) {
fn F(self, a: T);
}
}
fn A(T:! type).B(_:! T).F(unused self, unused a: T) {}
fn A(T: type).B(_: T).F(unused self, unused a: T) {}
//@dump-sem-ir-end
// --- fail_mismatched_not_generic_vs_generic.carbon
@@ -53,19 +53,19 @@ class NotGeneric {
}
// CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE+7]]:4: error: redeclaration differs because of parameter list [RedeclParamListDiffers]
// CHECK:STDERR: fn NotGeneric(unused T:! type).F() {}
// CHECK:STDERR: fn NotGeneric(unused T: type).F() {}
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE-7]]:1: note: previously declared without parameter list [RedeclParamListPrevious]
// CHECK:STDERR: class NotGeneric {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn NotGeneric(unused T:! type).F() {}
fn NotGeneric(unused T: type).F() {}
// --- fail_mismatched_too_few_args.carbon
library "[[@TEST_NAME]]";
class Generic(unused T:! type) {
class Generic(unused T: type) {
fn TooFew();
}
@@ -73,8 +73,8 @@ class Generic(unused T:! type) {
// CHECK:STDERR: fn Generic().TooFew() {}
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_mismatched_too_few_args.carbon:[[@LINE-7]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious]
// CHECK:STDERR: class Generic(unused T:! type) {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: class Generic(unused T: type) {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn Generic().TooFew() {}
@@ -82,35 +82,35 @@ fn Generic().TooFew() {}
library "[[@TEST_NAME]]";
class Generic(T:! type) {
class Generic(T: type) {
fn TooMany();
}
// CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE+7]]:4: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers]
// CHECK:STDERR: fn Generic(unused T:! type, unused U:! type).TooMany() {}
// CHECK:STDERR: fn Generic(unused T: type, unused U: type).TooMany() {}
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE-7]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious]
// CHECK:STDERR: class Generic(T:! type) {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: class Generic(T: type) {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn Generic(unused T:! type, unused U:! type).TooMany() {}
fn Generic(unused T: type, unused U: type).TooMany() {}
// --- fail_mismatched_wrong_arg_type.carbon
library "[[@TEST_NAME]]";
class Generic(unused T:! type) {
class Generic(unused T: type) {
fn WrongType();
}
// CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE+7]]:19: error: type `<pattern for ()>` of parameter 1 in redeclaration differs from previous parameter type `<pattern for type>` [RedeclParamDiffersType]
// CHECK:STDERR: fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: fn Generic(unused T: ()).WrongType() {}
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE-7]]:22: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
// CHECK:STDERR: class Generic(unused T:! type) {
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: class Generic(unused T: type) {
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
fn Generic(unused T:! ()).WrongType() {}
fn Generic(unused T: ()).WrongType() {}
// CHECK:STDOUT: --- basic.carbon
@@ -176,23 +176,23 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %n.param_patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = value_param_pattern [symbolic = %n.param_patt.loc6 (constants.%n.param_patt)]
// CHECK:STDOUT: %n.patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = at_binding_pattern n, %n.param_patt.loc11 [symbolic = %n.patt.loc6 (constants.%n.patt.8c9)]
// CHECK:STDOUT: %return.param_patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc6 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc11, %.loc11_36.2 [symbolic = %return.patt.loc6 (constants.%return.patt.f44)]
// CHECK:STDOUT: %return.patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc11, %.loc11_35.2 [symbolic = %return.patt.loc6 (constants.%return.patt.f44)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc11_18: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %.loc11_17: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
// CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc11: %Copy.type = symbolic_binding T, 0 [symbolic = @Class.%T.loc5_14.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.ref.loc11_36: %Copy.type = name_ref T, %T.loc11 [symbolic = %T.loc6 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc11_36: type = facet_access_type %T.ref.loc11_36 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc11_36.2: type = converted %T.ref.loc11_36, %T.as_type.loc11_36 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc11_36.3: Core.Form = init_form %.loc11_36.2 [symbolic = %.loc6_17.1 (constants.%.1ce700.2)]
// CHECK:STDOUT: %T.ref.loc11_35: %Copy.type = name_ref T, %T.loc11 [symbolic = %T.loc6 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc11_35: type = facet_access_type %T.ref.loc11_35 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc11_35.2: type = converted %T.ref.loc11_35, %T.as_type.loc11_35 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc11_35.3: Core.Form = init_form %.loc11_35.2 [symbolic = %.loc6_17.1 (constants.%.1ce700.2)]
// CHECK:STDOUT: %n.param.loc11: @Class.F.%T.as_type.loc6_11.1 (%T.as_type) = value_param call_param0
// CHECK:STDOUT: %.loc11_30.1: type = splice_block %.loc11_30.2 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)] {
// CHECK:STDOUT: %T.ref.loc11_30: %Copy.type = name_ref T, %T.loc11 [symbolic = %T.loc6 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc11_30: type = facet_access_type %T.ref.loc11_30 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc11_30.2: type = converted %T.ref.loc11_30, %T.as_type.loc11_30 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc11_29.1: type = splice_block %.loc11_29.2 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)] {
// CHECK:STDOUT: %T.ref.loc11_29: %Copy.type = name_ref T, %T.loc11 [symbolic = %T.loc6 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc11_29: type = facet_access_type %T.ref.loc11_29 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc11_29.2: type = converted %T.ref.loc11_29, %T.as_type.loc11_29 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n.loc11: @Class.F.%T.as_type.loc6_11.1 (%T.as_type) = wrapper_binding n, %n.param.loc11
// CHECK:STDOUT: %return.param.loc11: ref @Class.F.%T.as_type.loc6_11.1 (%T.as_type) = out_param call_param1
@@ -202,9 +202,9 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %self.param_patt.loc15: @Class.G.%pattern_type.loc7_8 (%pattern_type.e18) = value_param_pattern [symbolic = %self.param_patt.loc7 (constants.%self.param_patt.aaa)]
// CHECK:STDOUT: %self.patt.loc15: @Class.G.%pattern_type.loc7_8 (%pattern_type.e18) = at_binding_pattern self, %self.param_patt.loc15 [symbolic = %self.patt.loc7 (constants.%self.patt.d8a)]
// CHECK:STDOUT: %return.param_patt.loc15: @Class.G.%pattern_type.loc7_17 (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc7 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc15: @Class.G.%pattern_type.loc7_17 (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc15, %.loc15_36.2 [symbolic = %return.patt.loc7 (constants.%return.patt.f44)]
// CHECK:STDOUT: %return.patt.loc15: @Class.G.%pattern_type.loc7_17 (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc15, %.loc15_35.2 [symbolic = %return.patt.loc7 (constants.%return.patt.f44)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc15_18: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %.loc15_17: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
// CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
@@ -212,12 +212,12 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %T.loc15: %Copy.type = symbolic_binding T, 0 [symbolic = @Class.%T.loc5_14.1 (constants.%T.f84)]
// CHECK:STDOUT: %T.ref.loc15: %Copy.type = name_ref T, %T.loc15 [symbolic = %T.loc7 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc15: type = facet_access_type %T.ref.loc15 [symbolic = %T.as_type.loc7_17.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc15_36.2: type = converted %T.ref.loc15, %T.as_type.loc15 [symbolic = %T.as_type.loc7_17.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc15_36.3: Core.Form = init_form %.loc15_36.2 [symbolic = %.loc7_17.1 (constants.%.1ce700.2)]
// CHECK:STDOUT: %.loc15_35.2: type = converted %T.ref.loc15, %T.as_type.loc15 [symbolic = %T.as_type.loc7_17.1 (constants.%T.as_type)]
// CHECK:STDOUT: %.loc15_35.3: Core.Form = init_form %.loc15_35.2 [symbolic = %.loc7_17.1 (constants.%.1ce700.2)]
// CHECK:STDOUT: %self.param.loc15: @Class.G.%Class (%Class) = value_param call_param0
// CHECK:STDOUT: %.loc15_27.1: type = splice_block %Self.ref.loc15 [symbolic = %Class (constants.%Class)] {
// CHECK:STDOUT: %.loc15_27.2: type = specific_constant constants.%Class, @Class(constants.%T.f84) [symbolic = %Class (constants.%Class)]
// CHECK:STDOUT: %Self.ref.loc15: type = name_ref Self, %.loc15_27.2 [symbolic = %Class (constants.%Class)]
// CHECK:STDOUT: %.loc15_26.1: type = splice_block %Self.ref.loc15 [symbolic = %Class (constants.%Class)] {
// CHECK:STDOUT: %.loc15_26.2: type = specific_constant constants.%Class, @Class(constants.%T.f84) [symbolic = %Class (constants.%Class)]
// CHECK:STDOUT: %Self.ref.loc15: type = name_ref Self, %.loc15_26.2 [symbolic = %Class (constants.%Class)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %self.loc15: @Class.G.%Class (%Class) = wrapper_binding self, %self.param.loc15
// CHECK:STDOUT: %return.param.loc15: ref @Class.G.%T.as_type.loc7_17.1 (%T.as_type) = out_param call_param1
@@ -248,7 +248,7 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %n.param_patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = value_param_pattern [symbolic = %n.param_patt.loc6 (constants.%n.param_patt)]
// CHECK:STDOUT: %n.patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = at_binding_pattern n, %n.param_patt.loc11 [symbolic = %n.patt.loc6 (constants.%n.patt.8c9)]
// CHECK:STDOUT: %return.param_patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc6 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc11, %.loc11_36.2 [symbolic = %return.patt.loc6 (constants.%return.patt.f44)]
// CHECK:STDOUT: %return.patt.loc11: @Class.F.%pattern_type (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc11, %.loc11_35.2 [symbolic = %return.patt.loc6 (constants.%return.patt.f44)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %T.ref.loc6_17: %Copy.type = name_ref T, @Class.%T.loc5_14.2 [symbolic = %T.loc6 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc6_17: type = facet_access_type %T.ref.loc6_17 [symbolic = %T.as_type.loc6_11.1 (constants.%T.as_type)]
@@ -268,7 +268,7 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %self.param_patt.loc15: @Class.G.%pattern_type.loc7_8 (%pattern_type.e18) = value_param_pattern [symbolic = %self.param_patt.loc7 (constants.%self.param_patt.aaa)]
// CHECK:STDOUT: %self.patt.loc15: @Class.G.%pattern_type.loc7_8 (%pattern_type.e18) = at_binding_pattern self, %self.param_patt.loc15 [symbolic = %self.patt.loc7 (constants.%self.patt.d8a)]
// CHECK:STDOUT: %return.param_patt.loc15: @Class.G.%pattern_type.loc7_17 (%pattern_type.2c66b4.2) = out_param_pattern [symbolic = %return.param_patt.loc7 (constants.%return.param_patt.bf4475.2)]
// CHECK:STDOUT: %return.patt.loc15: @Class.G.%pattern_type.loc7_17 (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc15, %.loc15_36.2 [symbolic = %return.patt.loc7 (constants.%return.patt.f44)]
// CHECK:STDOUT: %return.patt.loc15: @Class.G.%pattern_type.loc7_17 (%pattern_type.2c66b4.2) = return_slot_pattern %return.param_patt.loc15, %.loc15_35.2 [symbolic = %return.patt.loc7 (constants.%return.patt.f44)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %T.ref.loc7: %Copy.type = name_ref T, @Class.%T.loc5_14.2 [symbolic = %T.loc7 (constants.%T.f84)]
// CHECK:STDOUT: %T.as_type.loc7_17.2: type = facet_access_type %T.ref.loc7 [symbolic = %T.as_type.loc7_17.1 (constants.%T.as_type)]
@@ -323,8 +323,8 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %.loc12_10.2: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc6 (constants.%T.f84)]
// CHECK:STDOUT: %specific_impl_fn.loc12_10.1: <specific function> = specific_impl_function %impl.elem0.loc12_10.1, @Copy.WithSelf.Op(constants.%T.f84) [symbolic = %specific_impl_fn.loc12_10.2 (constants.%specific_impl_fn.e2a)]
// CHECK:STDOUT: %bound_method.loc12_10.2: <bound method> = bound_method %n.ref, %specific_impl_fn.loc12_10.1
// CHECK:STDOUT: %.loc11_36.1: ref @Class.F.%T.as_type.loc6_11.1 (%T.as_type) = splice_block %return.param.loc11 {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @Class.F.%T.as_type.loc6_11.1 (%T.as_type) to %.loc11_36.1 = call %bound_method.loc12_10.2(%n.ref)
// CHECK:STDOUT: %.loc11_35.1: ref @Class.F.%T.as_type.loc6_11.1 (%T.as_type) = splice_block %return.param.loc11 {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @Class.F.%T.as_type.loc6_11.1 (%T.as_type) to %.loc11_35.1 = call %bound_method.loc12_10.2(%n.ref)
// CHECK:STDOUT: return %Copy.WithSelf.Op.call to %return.param.loc11
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
@@ -365,8 +365,8 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %.loc16_14.4: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc7 (constants.%T.f84)]
// CHECK:STDOUT: %specific_impl_fn.loc16_14.1: <specific function> = specific_impl_function %impl.elem0.loc16_14.1, @Copy.WithSelf.Op(constants.%T.f84) [symbolic = %specific_impl_fn.loc16_14.2 (constants.%specific_impl_fn.e2a)]
// CHECK:STDOUT: %bound_method.loc16_14.2: <bound method> = bound_method %.loc16_14.2, %specific_impl_fn.loc16_14.1
// CHECK:STDOUT: %.loc15_36.1: ref @Class.G.%T.as_type.loc7_17.1 (%T.as_type) = splice_block %return.param.loc15 {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @Class.G.%T.as_type.loc7_17.1 (%T.as_type) to %.loc15_36.1 = call %bound_method.loc16_14.2(%.loc16_14.2)
// CHECK:STDOUT: %.loc15_35.1: ref @Class.G.%T.as_type.loc7_17.1 (%T.as_type) = splice_block %return.param.loc15 {}
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @Class.G.%T.as_type.loc7_17.1 (%T.as_type) to %.loc15_35.1 = call %bound_method.loc16_14.2(%.loc16_14.2)
// CHECK:STDOUT: return %Copy.WithSelf.Op.call to %return.param.loc15
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
@@ -450,9 +450,9 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %A.decl: %A.type = class_decl @A [concrete = constants.%A.generic] {
// CHECK:STDOUT: %T.patt.loc5_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc5_10.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc5_13.1: type = splice_block %.loc5_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc5_12.1: type = splice_block %.loc5_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc5_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc5_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc5_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc5_10.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -462,24 +462,24 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %a.param_patt.loc11: @B.F.%pattern_type.loc7_17 (%pattern_type.51d) = value_param_pattern [symbolic = %a.param_patt.loc7 (constants.%a.param_patt)]
// CHECK:STDOUT: %a.patt.loc11: @B.F.%pattern_type.loc7_17 (%pattern_type.51d) = at_binding_pattern a, %a.param_patt.loc11 [symbolic = %a.patt.loc7 (constants.%a.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc11_10.1: type = splice_block %.loc11_10.2 [concrete = type] {
// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc11_7: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc11_10.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc11_9.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc11: type = symbolic_binding T, 0 [symbolic = @A.%T.loc5_10.1 (constants.%T)]
// CHECK:STDOUT: %.loc11_22: type = splice_block %T.ref.loc11_22 [symbolic = @B.%T (constants.%T)] {
// CHECK:STDOUT: %.Self.frozen.loc11_19: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %T.ref.loc11_22: type = name_ref T, %T.loc11 [symbolic = @B.%T (constants.%T)]
// CHECK:STDOUT: %.loc11_20: type = splice_block %T.ref.loc11_20 [symbolic = @B.%T (constants.%T)] {
// CHECK:STDOUT: %.Self.frozen.loc11_18: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %T.ref.loc11_20: type = name_ref T, %T.loc11 [symbolic = @B.%T (constants.%T)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc11: @B.%T (%T) = symbolic_binding _, 1 [symbolic = @B.%_.loc6_12.1 (constants.%_)]
// CHECK:STDOUT: %self.param.loc11: @B.F.%B (%B) = value_param call_param0
// CHECK:STDOUT: %.loc11_34.1: type = splice_block %Self.ref.loc11 [symbolic = %B (constants.%B)] {
// CHECK:STDOUT: %.loc11_34.2: type = specific_constant constants.%B, @B(constants.%T, constants.%_) [symbolic = %B (constants.%B)]
// CHECK:STDOUT: %Self.ref.loc11: type = name_ref Self, %.loc11_34.2 [symbolic = %B (constants.%B)]
// CHECK:STDOUT: %.loc11_32.1: type = splice_block %Self.ref.loc11 [symbolic = %B (constants.%B)] {
// CHECK:STDOUT: %.loc11_32.2: type = specific_constant constants.%B, @B(constants.%T, constants.%_) [symbolic = %B (constants.%B)]
// CHECK:STDOUT: %Self.ref.loc11: type = name_ref Self, %.loc11_32.2 [symbolic = %B (constants.%B)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %self.loc11: @B.F.%B (%B) = wrapper_binding self, %self.param.loc11
// CHECK:STDOUT: %a.param.loc11: @B.F.%T.loc7 (%T) = value_param call_param1
// CHECK:STDOUT: %T.ref.loc11_50: type = name_ref T, %T.loc11 [symbolic = %T.loc7 (constants.%T)]
// CHECK:STDOUT: %T.ref.loc11_48: type = name_ref T, %T.loc11 [symbolic = %T.loc7 (constants.%T)]
// CHECK:STDOUT: %a.loc11: @B.F.%T.loc7 (%T) = wrapper_binding a, %a.param.loc11
// CHECK:STDOUT: }
// CHECK:STDOUT: }
@@ -561,8 +561,8 @@ fn Generic(unused T:! ()).WrongType() {}
// CHECK:STDOUT: %a.patt.loc7: @B.F.%pattern_type.loc7_17 (%pattern_type.51d) = at_binding_pattern a, %a.param_patt.loc7 [symbolic = %a.patt.loc7 (constants.%a.patt)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete.loc11_34: <witness> = require_complete_type %B [symbolic = %require_complete.loc11_34 (constants.%require_complete.0e8)]
// CHECK:STDOUT: %require_complete.loc11_48: <witness> = require_complete_type %T.loc7 [symbolic = %require_complete.loc11_48 (constants.%require_complete.944)]
// CHECK:STDOUT: %require_complete.loc11_32: <witness> = require_complete_type %B [symbolic = %require_complete.loc11_32 (constants.%require_complete.0e8)]
// CHECK:STDOUT: %require_complete.loc11_46: <witness> = require_complete_type %T.loc7 [symbolic = %require_complete.loc11_46 (constants.%require_complete.944)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%self.param.loc11: @B.F.%B (%B), %a.param.loc11: @B.F.%T.loc7 (%T)) {
// CHECK:STDOUT: !entry:
+4 -4
View File
@@ -16,7 +16,7 @@
library "[[@TEST_NAME]]";
class Outer(T:! Core.Copy) {
class Outer(T: Core.Copy) {
class Inner {
var n: T;
}
@@ -33,7 +33,7 @@ fn Test() -> i32 {
library "[[@TEST_NAME]]";
class Outer(T:! type) {
class Outer(T: type) {
interface Inner {
fn F(self) -> T;
}
@@ -598,9 +598,9 @@ fn Test() -> i32 {
// CHECK:STDOUT: %Outer.decl: %Outer.type = class_decl @Outer [concrete = constants.%Outer.generic] {
// CHECK:STDOUT: %T.patt.loc4_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_16.1: type = splice_block %.loc4_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
// CHECK:STDOUT: }
+141 -141
View File
@@ -15,10 +15,10 @@
class A {}
class B {}
class Class(T:! type) {
fn Get(U:! type) -> (T, U) { return Get(U); }
fn GetNoDeduce(x: T, U:! type) -> (T, U) { return GetNoDeduce(x, U); }
fn F[U:! type](self: Class(U)) -> U { return self.F(); }
class Class(T: type) {
fn Get(generic U: type) -> (T, U) { return Get(U); }
fn GetNoDeduce(x: T, generic U: type) -> (T, U) { return GetNoDeduce(x, U); }
fn F[U: type](self: Class(U)) -> U { return self.F(); }
}
fn CallGenericMethod(c: Class(A)) -> (A, B) {
@@ -156,9 +156,9 @@ fn CallMethodSelfDeduce(c: Class(A)) -> A {
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc18_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_14.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc18_16.1: type = splice_block %.loc18_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc18_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc18_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc18_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc18_14.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -254,67 +254,67 @@ fn CallMethodSelfDeduce(c: Class(A)) -> A {
// CHECK:STDOUT:
// CHECK:STDOUT: class {
// CHECK:STDOUT: %Class.Get.decl: @Class.%Class.Get.type (%Class.Get.type.49d) = fn_decl @Class.Get [symbolic = @Class.%Class.Get (constants.%Class.Get.ceb)] {
// CHECK:STDOUT: %U.patt.loc19_11.1: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc19_11.2 (constants.%U.patt)]
// CHECK:STDOUT: %return.param_patt.loc19_28.1: @Class.Get.%pattern_type (%pattern_type.eee) = out_param_pattern [symbolic = %return.param_patt.loc19_28.2 (constants.%return.param_patt.a41)]
// CHECK:STDOUT: %return.patt.loc19_20.1: @Class.Get.%pattern_type (%pattern_type.eee) = return_slot_pattern %return.param_patt.loc19_28.1, %.loc19_28.4 [symbolic = %return.patt.loc19_20.2 (constants.%return.patt.453)]
// CHECK:STDOUT: %U.patt.loc19_19.1: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc19_19.2 (constants.%U.patt)]
// CHECK:STDOUT: %return.param_patt.loc19_35.1: @Class.Get.%pattern_type (%pattern_type.eee) = out_param_pattern [symbolic = %return.param_patt.loc19_35.2 (constants.%return.param_patt.a41)]
// CHECK:STDOUT: %return.patt.loc19_27.1: @Class.Get.%pattern_type (%pattern_type.eee) = return_slot_pattern %return.param_patt.loc19_35.1, %.loc19_35.4 [symbolic = %return.patt.loc19_27.2 (constants.%return.patt.453)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %T.ref: type = name_ref T, @Class.%T.loc18_14.2 [symbolic = %T (constants.%T)]
// CHECK:STDOUT: %U.ref.loc19_27: type = name_ref U, %U.loc19_11.2 [symbolic = %U.loc19_11.1 (constants.%U)]
// CHECK:STDOUT: %.loc19_28.3: %tuple.type.24b = tuple_literal (%T.ref, %U.ref.loc19_27) [symbolic = %tuple (constants.%tuple.4b9)]
// CHECK:STDOUT: %.loc19_28.4: type = converted %.loc19_28.3, constants.%tuple.type.a5e [symbolic = %tuple.type (constants.%tuple.type.a5e)]
// CHECK:STDOUT: %.loc19_28.5: Core.Form = init_form %.loc19_28.4 [symbolic = %.loc19_28.2 (constants.%.f18)]
// CHECK:STDOUT: %.loc19_14.1: type = splice_block %.loc19_14.2 [concrete = type] {
// CHECK:STDOUT: %U.ref.loc19_34: type = name_ref U, %U.loc19_19.2 [symbolic = %U.loc19_19.1 (constants.%U)]
// CHECK:STDOUT: %.loc19_35.3: %tuple.type.24b = tuple_literal (%T.ref, %U.ref.loc19_34) [symbolic = %tuple (constants.%tuple.4b9)]
// CHECK:STDOUT: %.loc19_35.4: type = converted %.loc19_35.3, constants.%tuple.type.a5e [symbolic = %tuple.type (constants.%tuple.type.a5e)]
// CHECK:STDOUT: %.loc19_35.5: Core.Form = init_form %.loc19_35.4 [symbolic = %.loc19_35.2 (constants.%.f18)]
// CHECK:STDOUT: %.loc19_21.1: type = splice_block %.loc19_21.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc19_14.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc19_21.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc19_11.2: type = symbolic_binding U, 1 [symbolic = %U.loc19_11.1 (constants.%U)]
// CHECK:STDOUT: %U.loc19_19.2: type = symbolic_binding U, 1 [symbolic = %U.loc19_19.1 (constants.%U)]
// CHECK:STDOUT: %return.param: ref @Class.Get.%tuple.type (%tuple.type.a5e) = out_param call_param0
// CHECK:STDOUT: %return: ref @Class.Get.%tuple.type (%tuple.type.a5e) = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Class.GetNoDeduce.decl: @Class.%Class.GetNoDeduce.type (%Class.GetNoDeduce.type.83e) = fn_decl @Class.GetNoDeduce [symbolic = @Class.%Class.GetNoDeduce (constants.%Class.GetNoDeduce.a04)] {
// CHECK:STDOUT: %x.param_patt.loc20_19.1: @Class.GetNoDeduce.%pattern_type.loc20_19 (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc20_19.2 (constants.%x.param_patt.91d)]
// CHECK:STDOUT: %x.patt.loc20_19.1: @Class.GetNoDeduce.%pattern_type.loc20_19 (%pattern_type.51d) = at_binding_pattern x, %x.param_patt.loc20_19.1 [symbolic = %x.patt.loc20_19.2 (constants.%x.patt.800)]
// CHECK:STDOUT: %U.patt.loc20_25.1: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc20_25.2 (constants.%U.patt)]
// CHECK:STDOUT: %return.param_patt.loc20_42.1: @Class.GetNoDeduce.%pattern_type.loc20_42 (%pattern_type.eee) = out_param_pattern [symbolic = %return.param_patt.loc20_42.2 (constants.%return.param_patt.a41)]
// CHECK:STDOUT: %return.patt.loc20_34.1: @Class.GetNoDeduce.%pattern_type.loc20_42 (%pattern_type.eee) = return_slot_pattern %return.param_patt.loc20_42.1, %.loc20_42.4 [symbolic = %return.patt.loc20_34.2 (constants.%return.patt.453)]
// CHECK:STDOUT: %U.patt.loc20_33.1: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc20_33.2 (constants.%U.patt)]
// CHECK:STDOUT: %return.param_patt.loc20_49.1: @Class.GetNoDeduce.%pattern_type.loc20_49 (%pattern_type.eee) = out_param_pattern [symbolic = %return.param_patt.loc20_49.2 (constants.%return.param_patt.a41)]
// CHECK:STDOUT: %return.patt.loc20_41.1: @Class.GetNoDeduce.%pattern_type.loc20_49 (%pattern_type.eee) = return_slot_pattern %return.param_patt.loc20_49.1, %.loc20_49.4 [symbolic = %return.patt.loc20_41.2 (constants.%return.patt.453)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %T.ref.loc20_38: type = name_ref T, @Class.%T.loc18_14.2 [symbolic = %T (constants.%T)]
// CHECK:STDOUT: %U.ref.loc20_41: type = name_ref U, %U.loc20_25.2 [symbolic = %U.loc20_25.1 (constants.%U)]
// CHECK:STDOUT: %.loc20_42.3: %tuple.type.24b = tuple_literal (%T.ref.loc20_38, %U.ref.loc20_41) [symbolic = %tuple (constants.%tuple.4b9)]
// CHECK:STDOUT: %.loc20_42.4: type = converted %.loc20_42.3, constants.%tuple.type.a5e [symbolic = %tuple.type (constants.%tuple.type.a5e)]
// CHECK:STDOUT: %.loc20_42.5: Core.Form = init_form %.loc20_42.4 [symbolic = %.loc20_42.2 (constants.%.f18)]
// CHECK:STDOUT: %T.ref.loc20_45: type = name_ref T, @Class.%T.loc18_14.2 [symbolic = %T (constants.%T)]
// CHECK:STDOUT: %U.ref.loc20_48: type = name_ref U, %U.loc20_33.2 [symbolic = %U.loc20_33.1 (constants.%U)]
// CHECK:STDOUT: %.loc20_49.3: %tuple.type.24b = tuple_literal (%T.ref.loc20_45, %U.ref.loc20_48) [symbolic = %tuple (constants.%tuple.4b9)]
// CHECK:STDOUT: %.loc20_49.4: type = converted %.loc20_49.3, constants.%tuple.type.a5e [symbolic = %tuple.type (constants.%tuple.type.a5e)]
// CHECK:STDOUT: %.loc20_49.5: Core.Form = init_form %.loc20_49.4 [symbolic = %.loc20_49.2 (constants.%.f18)]
// CHECK:STDOUT: %x.param: @Class.GetNoDeduce.%T (%T) = value_param call_param0
// CHECK:STDOUT: %T.ref.loc20_21: type = name_ref T, @Class.%T.loc18_14.2 [symbolic = %T (constants.%T)]
// CHECK:STDOUT: %x: @Class.GetNoDeduce.%T (%T) = wrapper_binding x, %x.param
// CHECK:STDOUT: %.loc20_28.1: type = splice_block %.loc20_28.2 [concrete = type] {
// CHECK:STDOUT: %.loc20_35.1: type = splice_block %.loc20_35.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc20_28.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc20_35.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc20_25.2: type = symbolic_binding U, 1 [symbolic = %U.loc20_25.1 (constants.%U)]
// CHECK:STDOUT: %U.loc20_33.2: type = symbolic_binding U, 1 [symbolic = %U.loc20_33.1 (constants.%U)]
// CHECK:STDOUT: %return.param: ref @Class.GetNoDeduce.%tuple.type (%tuple.type.a5e) = out_param call_param1
// CHECK:STDOUT: %return: ref @Class.GetNoDeduce.%tuple.type (%tuple.type.a5e) = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Class.F.decl: @Class.%Class.F.type (%Class.F.type.982) = fn_decl @Class.F [symbolic = @Class.%Class.F (constants.%Class.F.c63)] {
// CHECK:STDOUT: %U.patt.loc21_9.1: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc21_9.2 (constants.%U.patt)]
// CHECK:STDOUT: %self.param_patt.loc21_22.1: @Class.F.%pattern_type.loc21_22 (%pattern_type.cc0) = value_param_pattern [symbolic = %self.param_patt.loc21_22.2 (constants.%self.param_patt.814)]
// CHECK:STDOUT: %self.patt.loc21_22.1: @Class.F.%pattern_type.loc21_22 (%pattern_type.cc0) = at_binding_pattern self, %self.param_patt.loc21_22.1 [symbolic = %self.patt.loc21_22.2 (constants.%self.patt.868)]
// CHECK:STDOUT: %return.param_patt.loc21_37.1: @Class.F.%pattern_type.loc21_37 (%pattern_type.946) = out_param_pattern [symbolic = %return.param_patt.loc21_37.2 (constants.%return.param_patt.6dd)]
// CHECK:STDOUT: %return.patt.loc21_34.1: @Class.F.%pattern_type.loc21_37 (%pattern_type.946) = return_slot_pattern %return.param_patt.loc21_37.1, %U.ref.loc21_37 [symbolic = %return.patt.loc21_34.2 (constants.%return.patt.4dd)]
// CHECK:STDOUT: %self.param_patt.loc21_21.1: @Class.F.%pattern_type.loc21_21 (%pattern_type.cc0) = value_param_pattern [symbolic = %self.param_patt.loc21_21.2 (constants.%self.param_patt.814)]
// CHECK:STDOUT: %self.patt.loc21_21.1: @Class.F.%pattern_type.loc21_21 (%pattern_type.cc0) = at_binding_pattern self, %self.param_patt.loc21_21.1 [symbolic = %self.patt.loc21_21.2 (constants.%self.patt.868)]
// CHECK:STDOUT: %return.param_patt.loc21_36.1: @Class.F.%pattern_type.loc21_36 (%pattern_type.946) = out_param_pattern [symbolic = %return.param_patt.loc21_36.2 (constants.%return.param_patt.6dd)]
// CHECK:STDOUT: %return.patt.loc21_33.1: @Class.F.%pattern_type.loc21_36 (%pattern_type.946) = return_slot_pattern %return.param_patt.loc21_36.1, %U.ref.loc21_36 [symbolic = %return.patt.loc21_33.2 (constants.%return.patt.4dd)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %U.ref.loc21_37: type = name_ref U, %U.loc21_9.2 [symbolic = %U.loc21_9.1 (constants.%U)]
// CHECK:STDOUT: %.loc21_37.3: Core.Form = init_form %U.ref.loc21_37 [symbolic = %.loc21_37.2 (constants.%.822)]
// CHECK:STDOUT: %.loc21_12.1: type = splice_block %.loc21_12.2 [concrete = type] {
// CHECK:STDOUT: %U.ref.loc21_36: type = name_ref U, %U.loc21_9.2 [symbolic = %U.loc21_9.1 (constants.%U)]
// CHECK:STDOUT: %.loc21_36.3: Core.Form = init_form %U.ref.loc21_36 [symbolic = %.loc21_36.2 (constants.%.822)]
// CHECK:STDOUT: %.loc21_11.1: type = splice_block %.loc21_11.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc21_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc21_11.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc21_9.2: type = symbolic_binding U, 1 [symbolic = %U.loc21_9.1 (constants.%U)]
// CHECK:STDOUT: %self.param: @Class.F.%Class.loc21_31.1 (%Class.d74) = value_param call_param0
// CHECK:STDOUT: %.loc21_31: type = splice_block %Class.loc21_31.2 [symbolic = %Class.loc21_31.1 (constants.%Class.d74)] {
// CHECK:STDOUT: %self.param: @Class.F.%Class.loc21_30.1 (%Class.d74) = value_param call_param0
// CHECK:STDOUT: %.loc21_30: type = splice_block %Class.loc21_30.2 [symbolic = %Class.loc21_30.1 (constants.%Class.d74)] {
// CHECK:STDOUT: %Class.ref: %Class.type = name_ref Class, file.%Class.decl [concrete = constants.%Class.generic]
// CHECK:STDOUT: %U.ref.loc21_30: type = name_ref U, %U.loc21_9.2 [symbolic = %U.loc21_9.1 (constants.%U)]
// CHECK:STDOUT: %Class.loc21_31.2: type = class_type @Class, @Class(constants.%U) [symbolic = %Class.loc21_31.1 (constants.%Class.d74)]
// CHECK:STDOUT: %U.ref.loc21_29: type = name_ref U, %U.loc21_9.2 [symbolic = %U.loc21_9.1 (constants.%U)]
// CHECK:STDOUT: %Class.loc21_30.2: type = class_type @Class, @Class(constants.%U) [symbolic = %Class.loc21_30.1 (constants.%Class.d74)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %self: @Class.F.%Class.loc21_31.1 (%Class.d74) = wrapper_binding self, %self.param
// CHECK:STDOUT: %self: @Class.F.%Class.loc21_30.1 (%Class.d74) = wrapper_binding self, %self.param
// CHECK:STDOUT: %return.param: ref @Class.F.%U.loc21_9.1 (%U) = out_param call_param1
// CHECK:STDOUT: %return: ref @Class.F.%U.loc21_9.1 (%U) = return_slot %return.param
// CHECK:STDOUT: }
@@ -331,66 +331,66 @@ fn CallMethodSelfDeduce(c: Class(A)) -> A {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @Class.Get(@Class.%T.loc18_14.2: type, %U.loc19_11.2: type) {
// CHECK:STDOUT: %U.patt.loc19_11.2: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc19_11.2 (constants.%U.patt)]
// CHECK:STDOUT: %U.loc19_11.1: type = symbolic_binding U, 1 [symbolic = %U.loc19_11.1 (constants.%U)]
// CHECK:STDOUT: generic fn @Class.Get(@Class.%T.loc18_14.2: type, %U.loc19_19.2: type) {
// CHECK:STDOUT: %U.patt.loc19_19.2: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc19_19.2 (constants.%U.patt)]
// CHECK:STDOUT: %U.loc19_19.1: type = symbolic_binding U, 1 [symbolic = %U.loc19_19.1 (constants.%U)]
// CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
// CHECK:STDOUT: %tuple: %tuple.type.24b = tuple_value (%T, %U.loc19_11.1) [symbolic = %tuple (constants.%tuple.4b9)]
// CHECK:STDOUT: %tuple.type: type = tuple_type (%T, %U.loc19_11.1) [symbolic = %tuple.type (constants.%tuple.type.a5e)]
// CHECK:STDOUT: %.loc19_28.2: Core.Form = init_form %tuple.type [symbolic = %.loc19_28.2 (constants.%.f18)]
// CHECK:STDOUT: %tuple: %tuple.type.24b = tuple_value (%T, %U.loc19_19.1) [symbolic = %tuple (constants.%tuple.4b9)]
// CHECK:STDOUT: %tuple.type: type = tuple_type (%T, %U.loc19_19.1) [symbolic = %tuple.type (constants.%tuple.type.a5e)]
// CHECK:STDOUT: %.loc19_35.2: Core.Form = init_form %tuple.type [symbolic = %.loc19_35.2 (constants.%.f18)]
// CHECK:STDOUT: %pattern_type: type = pattern_type %tuple.type [symbolic = %pattern_type (constants.%pattern_type.eee)]
// CHECK:STDOUT: %return.param_patt.loc19_28.2: @Class.Get.%pattern_type (%pattern_type.eee) = out_param_pattern [symbolic = %return.param_patt.loc19_28.2 (constants.%return.param_patt.a41)]
// CHECK:STDOUT: %return.patt.loc19_20.2: @Class.Get.%pattern_type (%pattern_type.eee) = return_slot_pattern %return.param_patt.loc19_28.2, %tuple.type [symbolic = %return.patt.loc19_20.2 (constants.%return.patt.453)]
// CHECK:STDOUT: %return.param_patt.loc19_35.2: @Class.Get.%pattern_type (%pattern_type.eee) = out_param_pattern [symbolic = %return.param_patt.loc19_35.2 (constants.%return.param_patt.a41)]
// CHECK:STDOUT: %return.patt.loc19_27.2: @Class.Get.%pattern_type (%pattern_type.eee) = return_slot_pattern %return.param_patt.loc19_35.2, %tuple.type [symbolic = %return.patt.loc19_27.2 (constants.%return.patt.453)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %tuple.type [symbolic = %require_complete (constants.%require_complete.220)]
// CHECK:STDOUT: %Class.Get.type: type = fn_type @Class.Get, @Class(%T) [symbolic = %Class.Get.type (constants.%Class.Get.type.49d)]
// CHECK:STDOUT: %Class.Get: @Class.Get.%Class.Get.type (%Class.Get.type.49d) = struct_value () [symbolic = %Class.Get (constants.%Class.Get.ceb)]
// CHECK:STDOUT: %Class.Get.specific_fn.loc19_39.2: <specific function> = specific_function %Class.Get, @Class.Get(%T, %U.loc19_11.1) [symbolic = %Class.Get.specific_fn.loc19_39.2 (constants.%Class.Get.specific_fn.ba5)]
// CHECK:STDOUT: %Class.Get.specific_fn.loc19_46.2: <specific function> = specific_function %Class.Get, @Class.Get(%T, %U.loc19_19.1) [symbolic = %Class.Get.specific_fn.loc19_46.2 (constants.%Class.Get.specific_fn.ba5)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn() -> out %return.param: @Class.Get.%tuple.type (%tuple.type.a5e) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc19_39: @Class.Get.%Class.Get.type (%Class.Get.type.49d) = specific_constant @Class.%Class.Get.decl, @Class(constants.%T) [symbolic = %Class.Get (constants.%Class.Get.ceb)]
// CHECK:STDOUT: %Get.ref: @Class.Get.%Class.Get.type (%Class.Get.type.49d) = name_ref Get, %.loc19_39 [symbolic = %Class.Get (constants.%Class.Get.ceb)]
// CHECK:STDOUT: %U.ref.loc19_43: type = name_ref U, %U.loc19_11.2 [symbolic = %U.loc19_11.1 (constants.%U)]
// CHECK:STDOUT: %Class.Get.specific_fn.loc19_39.1: <specific function> = specific_function %Get.ref, @Class.Get(constants.%T, constants.%U) [symbolic = %Class.Get.specific_fn.loc19_39.2 (constants.%Class.Get.specific_fn.ba5)]
// CHECK:STDOUT: %.loc19_28.1: ref @Class.Get.%tuple.type (%tuple.type.a5e) = splice_block %return.param {}
// CHECK:STDOUT: %Class.Get.call: init @Class.Get.%tuple.type (%tuple.type.a5e) to %.loc19_28.1 = call %Class.Get.specific_fn.loc19_39.1()
// CHECK:STDOUT: %.loc19_46: @Class.Get.%Class.Get.type (%Class.Get.type.49d) = specific_constant @Class.%Class.Get.decl, @Class(constants.%T) [symbolic = %Class.Get (constants.%Class.Get.ceb)]
// CHECK:STDOUT: %Get.ref: @Class.Get.%Class.Get.type (%Class.Get.type.49d) = name_ref Get, %.loc19_46 [symbolic = %Class.Get (constants.%Class.Get.ceb)]
// CHECK:STDOUT: %U.ref.loc19_50: type = name_ref U, %U.loc19_19.2 [symbolic = %U.loc19_19.1 (constants.%U)]
// CHECK:STDOUT: %Class.Get.specific_fn.loc19_46.1: <specific function> = specific_function %Get.ref, @Class.Get(constants.%T, constants.%U) [symbolic = %Class.Get.specific_fn.loc19_46.2 (constants.%Class.Get.specific_fn.ba5)]
// CHECK:STDOUT: %.loc19_35.1: ref @Class.Get.%tuple.type (%tuple.type.a5e) = splice_block %return.param {}
// CHECK:STDOUT: %Class.Get.call: init @Class.Get.%tuple.type (%tuple.type.a5e) to %.loc19_35.1 = call %Class.Get.specific_fn.loc19_46.1()
// CHECK:STDOUT: return %Class.Get.call to %return.param
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @Class.GetNoDeduce(@Class.%T.loc18_14.2: type, %U.loc20_25.2: type) {
// CHECK:STDOUT: generic fn @Class.GetNoDeduce(@Class.%T.loc18_14.2: type, %U.loc20_33.2: type) {
// CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
// CHECK:STDOUT: %pattern_type.loc20_19: type = pattern_type %T [symbolic = %pattern_type.loc20_19 (constants.%pattern_type.51d)]
// CHECK:STDOUT: %x.param_patt.loc20_19.2: @Class.GetNoDeduce.%pattern_type.loc20_19 (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc20_19.2 (constants.%x.param_patt.91d)]
// CHECK:STDOUT: %x.patt.loc20_19.2: @Class.GetNoDeduce.%pattern_type.loc20_19 (%pattern_type.51d) = at_binding_pattern x, %x.param_patt.loc20_19.2 [symbolic = %x.patt.loc20_19.2 (constants.%x.patt.800)]
// CHECK:STDOUT: %U.patt.loc20_25.2: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc20_25.2 (constants.%U.patt)]
// CHECK:STDOUT: %U.loc20_25.1: type = symbolic_binding U, 1 [symbolic = %U.loc20_25.1 (constants.%U)]
// CHECK:STDOUT: %tuple: %tuple.type.24b = tuple_value (%T, %U.loc20_25.1) [symbolic = %tuple (constants.%tuple.4b9)]
// CHECK:STDOUT: %tuple.type: type = tuple_type (%T, %U.loc20_25.1) [symbolic = %tuple.type (constants.%tuple.type.a5e)]
// CHECK:STDOUT: %.loc20_42.2: Core.Form = init_form %tuple.type [symbolic = %.loc20_42.2 (constants.%.f18)]
// CHECK:STDOUT: %pattern_type.loc20_42: type = pattern_type %tuple.type [symbolic = %pattern_type.loc20_42 (constants.%pattern_type.eee)]
// CHECK:STDOUT: %return.param_patt.loc20_42.2: @Class.GetNoDeduce.%pattern_type.loc20_42 (%pattern_type.eee) = out_param_pattern [symbolic = %return.param_patt.loc20_42.2 (constants.%return.param_patt.a41)]
// CHECK:STDOUT: %return.patt.loc20_34.2: @Class.GetNoDeduce.%pattern_type.loc20_42 (%pattern_type.eee) = return_slot_pattern %return.param_patt.loc20_42.2, %tuple.type [symbolic = %return.patt.loc20_34.2 (constants.%return.patt.453)]
// CHECK:STDOUT: %U.patt.loc20_33.2: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc20_33.2 (constants.%U.patt)]
// CHECK:STDOUT: %U.loc20_33.1: type = symbolic_binding U, 1 [symbolic = %U.loc20_33.1 (constants.%U)]
// CHECK:STDOUT: %tuple: %tuple.type.24b = tuple_value (%T, %U.loc20_33.1) [symbolic = %tuple (constants.%tuple.4b9)]
// CHECK:STDOUT: %tuple.type: type = tuple_type (%T, %U.loc20_33.1) [symbolic = %tuple.type (constants.%tuple.type.a5e)]
// CHECK:STDOUT: %.loc20_49.2: Core.Form = init_form %tuple.type [symbolic = %.loc20_49.2 (constants.%.f18)]
// CHECK:STDOUT: %pattern_type.loc20_49: type = pattern_type %tuple.type [symbolic = %pattern_type.loc20_49 (constants.%pattern_type.eee)]
// CHECK:STDOUT: %return.param_patt.loc20_49.2: @Class.GetNoDeduce.%pattern_type.loc20_49 (%pattern_type.eee) = out_param_pattern [symbolic = %return.param_patt.loc20_49.2 (constants.%return.param_patt.a41)]
// CHECK:STDOUT: %return.patt.loc20_41.2: @Class.GetNoDeduce.%pattern_type.loc20_49 (%pattern_type.eee) = return_slot_pattern %return.param_patt.loc20_49.2, %tuple.type [symbolic = %return.patt.loc20_41.2 (constants.%return.patt.453)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T [symbolic = %require_complete (constants.%require_complete.944)]
// CHECK:STDOUT: %Class.GetNoDeduce.type: type = fn_type @Class.GetNoDeduce, @Class(%T) [symbolic = %Class.GetNoDeduce.type (constants.%Class.GetNoDeduce.type.83e)]
// CHECK:STDOUT: %Class.GetNoDeduce: @Class.GetNoDeduce.%Class.GetNoDeduce.type (%Class.GetNoDeduce.type.83e) = struct_value () [symbolic = %Class.GetNoDeduce (constants.%Class.GetNoDeduce.a04)]
// CHECK:STDOUT: %Class.GetNoDeduce.specific_fn.loc20_53.2: <specific function> = specific_function %Class.GetNoDeduce, @Class.GetNoDeduce(%T, %U.loc20_25.1) [symbolic = %Class.GetNoDeduce.specific_fn.loc20_53.2 (constants.%Class.GetNoDeduce.specific_fn.def)]
// CHECK:STDOUT: %Class.GetNoDeduce.specific_fn.loc20_60.2: <specific function> = specific_function %Class.GetNoDeduce, @Class.GetNoDeduce(%T, %U.loc20_33.1) [symbolic = %Class.GetNoDeduce.specific_fn.loc20_60.2 (constants.%Class.GetNoDeduce.specific_fn.def)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%x.param: @Class.GetNoDeduce.%T (%T)) -> out %return.param: @Class.GetNoDeduce.%tuple.type (%tuple.type.a5e) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc20_53: @Class.GetNoDeduce.%Class.GetNoDeduce.type (%Class.GetNoDeduce.type.83e) = specific_constant @Class.%Class.GetNoDeduce.decl, @Class(constants.%T) [symbolic = %Class.GetNoDeduce (constants.%Class.GetNoDeduce.a04)]
// CHECK:STDOUT: %GetNoDeduce.ref: @Class.GetNoDeduce.%Class.GetNoDeduce.type (%Class.GetNoDeduce.type.83e) = name_ref GetNoDeduce, %.loc20_53 [symbolic = %Class.GetNoDeduce (constants.%Class.GetNoDeduce.a04)]
// CHECK:STDOUT: %.loc20_60: @Class.GetNoDeduce.%Class.GetNoDeduce.type (%Class.GetNoDeduce.type.83e) = specific_constant @Class.%Class.GetNoDeduce.decl, @Class(constants.%T) [symbolic = %Class.GetNoDeduce (constants.%Class.GetNoDeduce.a04)]
// CHECK:STDOUT: %GetNoDeduce.ref: @Class.GetNoDeduce.%Class.GetNoDeduce.type (%Class.GetNoDeduce.type.83e) = name_ref GetNoDeduce, %.loc20_60 [symbolic = %Class.GetNoDeduce (constants.%Class.GetNoDeduce.a04)]
// CHECK:STDOUT: %x.ref: @Class.GetNoDeduce.%T (%T) = name_ref x, %x
// CHECK:STDOUT: %U.ref.loc20_68: type = name_ref U, %U.loc20_25.2 [symbolic = %U.loc20_25.1 (constants.%U)]
// CHECK:STDOUT: %Class.GetNoDeduce.specific_fn.loc20_53.1: <specific function> = specific_function %GetNoDeduce.ref, @Class.GetNoDeduce(constants.%T, constants.%U) [symbolic = %Class.GetNoDeduce.specific_fn.loc20_53.2 (constants.%Class.GetNoDeduce.specific_fn.def)]
// CHECK:STDOUT: %.loc20_42.1: ref @Class.GetNoDeduce.%tuple.type (%tuple.type.a5e) = splice_block %return.param {}
// CHECK:STDOUT: %Class.GetNoDeduce.call: init @Class.GetNoDeduce.%tuple.type (%tuple.type.a5e) to %.loc20_42.1 = call %Class.GetNoDeduce.specific_fn.loc20_53.1(%x.ref)
// CHECK:STDOUT: %U.ref.loc20_75: type = name_ref U, %U.loc20_33.2 [symbolic = %U.loc20_33.1 (constants.%U)]
// CHECK:STDOUT: %Class.GetNoDeduce.specific_fn.loc20_60.1: <specific function> = specific_function %GetNoDeduce.ref, @Class.GetNoDeduce(constants.%T, constants.%U) [symbolic = %Class.GetNoDeduce.specific_fn.loc20_60.2 (constants.%Class.GetNoDeduce.specific_fn.def)]
// CHECK:STDOUT: %.loc20_49.1: ref @Class.GetNoDeduce.%tuple.type (%tuple.type.a5e) = splice_block %return.param {}
// CHECK:STDOUT: %Class.GetNoDeduce.call: init @Class.GetNoDeduce.%tuple.type (%tuple.type.a5e) to %.loc20_49.1 = call %Class.GetNoDeduce.specific_fn.loc20_60.1(%x.ref)
// CHECK:STDOUT: return %Class.GetNoDeduce.call to %return.param
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
@@ -400,31 +400,31 @@ fn CallMethodSelfDeduce(c: Class(A)) -> A {
// CHECK:STDOUT: generic fn @Class.F(@Class.%T.loc18_14.2: type, %U.loc21_9.2: type) {
// CHECK:STDOUT: %U.patt.loc21_9.2: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc21_9.2 (constants.%U.patt)]
// CHECK:STDOUT: %U.loc21_9.1: type = symbolic_binding U, 1 [symbolic = %U.loc21_9.1 (constants.%U)]
// CHECK:STDOUT: %Class.loc21_31.1: type = class_type @Class, @Class(%U.loc21_9.1) [symbolic = %Class.loc21_31.1 (constants.%Class.d74)]
// CHECK:STDOUT: %pattern_type.loc21_22: type = pattern_type %Class.loc21_31.1 [symbolic = %pattern_type.loc21_22 (constants.%pattern_type.cc0)]
// CHECK:STDOUT: %self.param_patt.loc21_22.2: @Class.F.%pattern_type.loc21_22 (%pattern_type.cc0) = value_param_pattern [symbolic = %self.param_patt.loc21_22.2 (constants.%self.param_patt.814)]
// CHECK:STDOUT: %self.patt.loc21_22.2: @Class.F.%pattern_type.loc21_22 (%pattern_type.cc0) = at_binding_pattern self, %self.param_patt.loc21_22.2 [symbolic = %self.patt.loc21_22.2 (constants.%self.patt.868)]
// CHECK:STDOUT: %.loc21_37.2: Core.Form = init_form %U.loc21_9.1 [symbolic = %.loc21_37.2 (constants.%.822)]
// CHECK:STDOUT: %pattern_type.loc21_37: type = pattern_type %U.loc21_9.1 [symbolic = %pattern_type.loc21_37 (constants.%pattern_type.946)]
// CHECK:STDOUT: %return.param_patt.loc21_37.2: @Class.F.%pattern_type.loc21_37 (%pattern_type.946) = out_param_pattern [symbolic = %return.param_patt.loc21_37.2 (constants.%return.param_patt.6dd)]
// CHECK:STDOUT: %return.patt.loc21_34.2: @Class.F.%pattern_type.loc21_37 (%pattern_type.946) = return_slot_pattern %return.param_patt.loc21_37.2, %U.loc21_9.1 [symbolic = %return.patt.loc21_34.2 (constants.%return.patt.4dd)]
// CHECK:STDOUT: %Class.loc21_30.1: type = class_type @Class, @Class(%U.loc21_9.1) [symbolic = %Class.loc21_30.1 (constants.%Class.d74)]
// CHECK:STDOUT: %pattern_type.loc21_21: type = pattern_type %Class.loc21_30.1 [symbolic = %pattern_type.loc21_21 (constants.%pattern_type.cc0)]
// CHECK:STDOUT: %self.param_patt.loc21_21.2: @Class.F.%pattern_type.loc21_21 (%pattern_type.cc0) = value_param_pattern [symbolic = %self.param_patt.loc21_21.2 (constants.%self.param_patt.814)]
// CHECK:STDOUT: %self.patt.loc21_21.2: @Class.F.%pattern_type.loc21_21 (%pattern_type.cc0) = at_binding_pattern self, %self.param_patt.loc21_21.2 [symbolic = %self.patt.loc21_21.2 (constants.%self.patt.868)]
// CHECK:STDOUT: %.loc21_36.2: Core.Form = init_form %U.loc21_9.1 [symbolic = %.loc21_36.2 (constants.%.822)]
// CHECK:STDOUT: %pattern_type.loc21_36: type = pattern_type %U.loc21_9.1 [symbolic = %pattern_type.loc21_36 (constants.%pattern_type.946)]
// CHECK:STDOUT: %return.param_patt.loc21_36.2: @Class.F.%pattern_type.loc21_36 (%pattern_type.946) = out_param_pattern [symbolic = %return.param_patt.loc21_36.2 (constants.%return.param_patt.6dd)]
// CHECK:STDOUT: %return.patt.loc21_33.2: @Class.F.%pattern_type.loc21_36 (%pattern_type.946) = return_slot_pattern %return.param_patt.loc21_36.2, %U.loc21_9.1 [symbolic = %return.patt.loc21_33.2 (constants.%return.patt.4dd)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Class.loc21_31.1 [symbolic = %require_complete (constants.%require_complete.716)]
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Class.loc21_30.1 [symbolic = %require_complete (constants.%require_complete.716)]
// CHECK:STDOUT: %Class.F.type: type = fn_type @Class.F, @Class(%U.loc21_9.1) [symbolic = %Class.F.type (constants.%Class.F.type.6df)]
// CHECK:STDOUT: %Class.F: @Class.F.%Class.F.type (%Class.F.type.6df) = struct_value () [symbolic = %Class.F (constants.%Class.F.c29)]
// CHECK:STDOUT: %Class.F.specific_fn.loc21_52.2: <specific function> = specific_function %Class.F, @Class.F(%U.loc21_9.1, %U.loc21_9.1) [symbolic = %Class.F.specific_fn.loc21_52.2 (constants.%Class.F.specific_fn.844)]
// CHECK:STDOUT: %Class.F.specific_fn.loc21_51.2: <specific function> = specific_function %Class.F, @Class.F(%U.loc21_9.1, %U.loc21_9.1) [symbolic = %Class.F.specific_fn.loc21_51.2 (constants.%Class.F.specific_fn.844)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%self.param: @Class.F.%Class.loc21_31.1 (%Class.d74)) -> out %return.param: @Class.F.%U.loc21_9.1 (%U) {
// CHECK:STDOUT: fn(%self.param: @Class.F.%Class.loc21_30.1 (%Class.d74)) -> out %return.param: @Class.F.%U.loc21_9.1 (%U) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %self.ref: @Class.F.%Class.loc21_31.1 (%Class.d74) = name_ref self, %self
// CHECK:STDOUT: %.loc21_52: @Class.F.%Class.F.type (%Class.F.type.6df) = specific_constant @Class.%Class.F.decl, @Class(constants.%U) [symbolic = %Class.F (constants.%Class.F.c29)]
// CHECK:STDOUT: %F.ref: @Class.F.%Class.F.type (%Class.F.type.6df) = name_ref F, %.loc21_52 [symbolic = %Class.F (constants.%Class.F.c29)]
// CHECK:STDOUT: %self.ref: @Class.F.%Class.loc21_30.1 (%Class.d74) = name_ref self, %self
// CHECK:STDOUT: %.loc21_51: @Class.F.%Class.F.type (%Class.F.type.6df) = specific_constant @Class.%Class.F.decl, @Class(constants.%U) [symbolic = %Class.F (constants.%Class.F.c29)]
// CHECK:STDOUT: %F.ref: @Class.F.%Class.F.type (%Class.F.type.6df) = name_ref F, %.loc21_51 [symbolic = %Class.F (constants.%Class.F.c29)]
// CHECK:STDOUT: %Class.F.bound: <bound method> = bound_method %self.ref, %F.ref
// CHECK:STDOUT: %Class.F.specific_fn.loc21_52.1: <specific function> = specific_function %F.ref, @Class.F(constants.%U, constants.%U) [symbolic = %Class.F.specific_fn.loc21_52.2 (constants.%Class.F.specific_fn.844)]
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %self.ref, %Class.F.specific_fn.loc21_52.1
// CHECK:STDOUT: %.loc21_37.1: ref @Class.F.%U.loc21_9.1 (%U) = splice_block %return.param {}
// CHECK:STDOUT: %Class.F.call: init @Class.F.%U.loc21_9.1 (%U) to %.loc21_37.1 = call %bound_method(%self.ref)
// CHECK:STDOUT: %Class.F.specific_fn.loc21_51.1: <specific function> = specific_function %F.ref, @Class.F(constants.%U, constants.%U) [symbolic = %Class.F.specific_fn.loc21_51.2 (constants.%Class.F.specific_fn.844)]
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %self.ref, %Class.F.specific_fn.loc21_51.1
// CHECK:STDOUT: %.loc21_36.1: ref @Class.F.%U.loc21_9.1 (%U) = splice_block %return.param {}
// CHECK:STDOUT: %Class.F.call: init @Class.F.%U.loc21_9.1 (%U) to %.loc21_36.1 = call %bound_method(%self.ref)
// CHECK:STDOUT: return %Class.F.call to %return.param
// CHECK:STDOUT:
// CHECK:STDOUT: !observes:
@@ -504,21 +504,21 @@ fn CallMethodSelfDeduce(c: Class(A)) -> A {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class.Get(constants.%T, constants.%U) {
// CHECK:STDOUT: %U.patt.loc19_11.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc19_11.1 => constants.%U
// CHECK:STDOUT: %U.patt.loc19_19.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc19_19.1 => constants.%U
// CHECK:STDOUT: %T => constants.%T
// CHECK:STDOUT: %tuple => constants.%tuple.4b9
// CHECK:STDOUT: %tuple.type => constants.%tuple.type.a5e
// CHECK:STDOUT: %.loc19_28.2 => constants.%.f18
// CHECK:STDOUT: %.loc19_35.2 => constants.%.f18
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.eee
// CHECK:STDOUT: %return.param_patt.loc19_28.2 => constants.%return.param_patt.a41
// CHECK:STDOUT: %return.patt.loc19_20.2 => constants.%return.patt.453
// CHECK:STDOUT: %return.param_patt.loc19_35.2 => constants.%return.param_patt.a41
// CHECK:STDOUT: %return.patt.loc19_27.2 => constants.%return.patt.453
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete => constants.%require_complete.220
// CHECK:STDOUT: %Class.Get.type => constants.%Class.Get.type.49d
// CHECK:STDOUT: %Class.Get => constants.%Class.Get.ceb
// CHECK:STDOUT: %Class.Get.specific_fn.loc19_39.2 => constants.%Class.Get.specific_fn.ba5
// CHECK:STDOUT: %Class.Get.specific_fn.loc19_46.2 => constants.%Class.Get.specific_fn.ba5
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class.GetNoDeduce(constants.%T, constants.%U) {
@@ -526,20 +526,20 @@ fn CallMethodSelfDeduce(c: Class(A)) -> A {
// CHECK:STDOUT: %pattern_type.loc20_19 => constants.%pattern_type.51d
// CHECK:STDOUT: %x.param_patt.loc20_19.2 => constants.%x.param_patt.91d
// CHECK:STDOUT: %x.patt.loc20_19.2 => constants.%x.patt.800
// CHECK:STDOUT: %U.patt.loc20_25.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc20_25.1 => constants.%U
// CHECK:STDOUT: %U.patt.loc20_33.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc20_33.1 => constants.%U
// CHECK:STDOUT: %tuple => constants.%tuple.4b9
// CHECK:STDOUT: %tuple.type => constants.%tuple.type.a5e
// CHECK:STDOUT: %.loc20_42.2 => constants.%.f18
// CHECK:STDOUT: %pattern_type.loc20_42 => constants.%pattern_type.eee
// CHECK:STDOUT: %return.param_patt.loc20_42.2 => constants.%return.param_patt.a41
// CHECK:STDOUT: %return.patt.loc20_34.2 => constants.%return.patt.453
// CHECK:STDOUT: %.loc20_49.2 => constants.%.f18
// CHECK:STDOUT: %pattern_type.loc20_49 => constants.%pattern_type.eee
// CHECK:STDOUT: %return.param_patt.loc20_49.2 => constants.%return.param_patt.a41
// CHECK:STDOUT: %return.patt.loc20_41.2 => constants.%return.patt.453
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete => constants.%require_complete.944
// CHECK:STDOUT: %Class.GetNoDeduce.type => constants.%Class.GetNoDeduce.type.83e
// CHECK:STDOUT: %Class.GetNoDeduce => constants.%Class.GetNoDeduce.a04
// CHECK:STDOUT: %Class.GetNoDeduce.specific_fn.loc20_53.2 => constants.%Class.GetNoDeduce.specific_fn.def
// CHECK:STDOUT: %Class.GetNoDeduce.specific_fn.loc20_60.2 => constants.%Class.GetNoDeduce.specific_fn.def
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class(constants.%U) {
@@ -558,33 +558,33 @@ fn CallMethodSelfDeduce(c: Class(A)) -> A {
// CHECK:STDOUT: specific @Class.F(constants.%T, constants.%U) {
// CHECK:STDOUT: %U.patt.loc21_9.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc21_9.1 => constants.%U
// CHECK:STDOUT: %Class.loc21_31.1 => constants.%Class.d74
// CHECK:STDOUT: %pattern_type.loc21_22 => constants.%pattern_type.cc0
// CHECK:STDOUT: %self.param_patt.loc21_22.2 => constants.%self.param_patt.814
// CHECK:STDOUT: %self.patt.loc21_22.2 => constants.%self.patt.868
// CHECK:STDOUT: %.loc21_37.2 => constants.%.822
// CHECK:STDOUT: %pattern_type.loc21_37 => constants.%pattern_type.946
// CHECK:STDOUT: %return.param_patt.loc21_37.2 => constants.%return.param_patt.6dd
// CHECK:STDOUT: %return.patt.loc21_34.2 => constants.%return.patt.4dd
// CHECK:STDOUT: %Class.loc21_30.1 => constants.%Class.d74
// CHECK:STDOUT: %pattern_type.loc21_21 => constants.%pattern_type.cc0
// CHECK:STDOUT: %self.param_patt.loc21_21.2 => constants.%self.param_patt.814
// CHECK:STDOUT: %self.patt.loc21_21.2 => constants.%self.patt.868
// CHECK:STDOUT: %.loc21_36.2 => constants.%.822
// CHECK:STDOUT: %pattern_type.loc21_36 => constants.%pattern_type.946
// CHECK:STDOUT: %return.param_patt.loc21_36.2 => constants.%return.param_patt.6dd
// CHECK:STDOUT: %return.patt.loc21_33.2 => constants.%return.patt.4dd
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class.F(constants.%U, constants.%U) {
// CHECK:STDOUT: %U.patt.loc21_9.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc21_9.1 => constants.%U
// CHECK:STDOUT: %Class.loc21_31.1 => constants.%Class.d74
// CHECK:STDOUT: %pattern_type.loc21_22 => constants.%pattern_type.cc0
// CHECK:STDOUT: %self.param_patt.loc21_22.2 => constants.%self.param_patt.814
// CHECK:STDOUT: %self.patt.loc21_22.2 => constants.%self.patt.868
// CHECK:STDOUT: %.loc21_37.2 => constants.%.822
// CHECK:STDOUT: %pattern_type.loc21_37 => constants.%pattern_type.946
// CHECK:STDOUT: %return.param_patt.loc21_37.2 => constants.%return.param_patt.6dd
// CHECK:STDOUT: %return.patt.loc21_34.2 => constants.%return.patt.4dd
// CHECK:STDOUT: %Class.loc21_30.1 => constants.%Class.d74
// CHECK:STDOUT: %pattern_type.loc21_21 => constants.%pattern_type.cc0
// CHECK:STDOUT: %self.param_patt.loc21_21.2 => constants.%self.param_patt.814
// CHECK:STDOUT: %self.patt.loc21_21.2 => constants.%self.patt.868
// CHECK:STDOUT: %.loc21_36.2 => constants.%.822
// CHECK:STDOUT: %pattern_type.loc21_36 => constants.%pattern_type.946
// CHECK:STDOUT: %return.param_patt.loc21_36.2 => constants.%return.param_patt.6dd
// CHECK:STDOUT: %return.patt.loc21_33.2 => constants.%return.patt.4dd
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete => constants.%require_complete.716
// CHECK:STDOUT: %Class.F.type => constants.%Class.F.type.6df
// CHECK:STDOUT: %Class.F => constants.%Class.F.c29
// CHECK:STDOUT: %Class.F.specific_fn.loc21_52.2 => constants.%Class.F.specific_fn.844
// CHECK:STDOUT: %Class.F.specific_fn.loc21_51.2 => constants.%Class.F.specific_fn.844
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class(constants.%A) {
@@ -601,21 +601,21 @@ fn CallMethodSelfDeduce(c: Class(A)) -> A {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class.Get(constants.%A, constants.%B) {
// CHECK:STDOUT: %U.patt.loc19_11.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc19_11.1 => constants.%B
// CHECK:STDOUT: %U.patt.loc19_19.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc19_19.1 => constants.%B
// CHECK:STDOUT: %T => constants.%A
// CHECK:STDOUT: %tuple => constants.%tuple.9aa
// CHECK:STDOUT: %tuple.type => constants.%tuple.type.1e7
// CHECK:STDOUT: %.loc19_28.2 => constants.%.7f5
// CHECK:STDOUT: %.loc19_35.2 => constants.%.7f5
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.7c6
// CHECK:STDOUT: %return.param_patt.loc19_28.2 => constants.%return.param_patt.1be
// CHECK:STDOUT: %return.patt.loc19_20.2 => constants.%return.patt.709
// CHECK:STDOUT: %return.param_patt.loc19_35.2 => constants.%return.param_patt.1be
// CHECK:STDOUT: %return.patt.loc19_27.2 => constants.%return.patt.709
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete => constants.%complete_type.c44
// CHECK:STDOUT: %Class.Get.type => constants.%Class.Get.type.9a5
// CHECK:STDOUT: %Class.Get => constants.%Class.Get.e47
// CHECK:STDOUT: %Class.Get.specific_fn.loc19_39.2 => constants.%Class.Get.specific_fn.0ec
// CHECK:STDOUT: %Class.Get.specific_fn.loc19_46.2 => constants.%Class.Get.specific_fn.0ec
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class.GetNoDeduce(constants.%A, constants.%B) {
@@ -623,38 +623,38 @@ fn CallMethodSelfDeduce(c: Class(A)) -> A {
// CHECK:STDOUT: %pattern_type.loc20_19 => constants.%pattern_type.9ef
// CHECK:STDOUT: %x.param_patt.loc20_19.2 => constants.%x.param_patt.4c3
// CHECK:STDOUT: %x.patt.loc20_19.2 => constants.%x.patt.313
// CHECK:STDOUT: %U.patt.loc20_25.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc20_25.1 => constants.%B
// CHECK:STDOUT: %U.patt.loc20_33.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc20_33.1 => constants.%B
// CHECK:STDOUT: %tuple => constants.%tuple.9aa
// CHECK:STDOUT: %tuple.type => constants.%tuple.type.1e7
// CHECK:STDOUT: %.loc20_42.2 => constants.%.7f5
// CHECK:STDOUT: %pattern_type.loc20_42 => constants.%pattern_type.7c6
// CHECK:STDOUT: %return.param_patt.loc20_42.2 => constants.%return.param_patt.1be
// CHECK:STDOUT: %return.patt.loc20_34.2 => constants.%return.patt.709
// CHECK:STDOUT: %.loc20_49.2 => constants.%.7f5
// CHECK:STDOUT: %pattern_type.loc20_49 => constants.%pattern_type.7c6
// CHECK:STDOUT: %return.param_patt.loc20_49.2 => constants.%return.param_patt.1be
// CHECK:STDOUT: %return.patt.loc20_41.2 => constants.%return.patt.709
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete => constants.%complete_type.357
// CHECK:STDOUT: %Class.GetNoDeduce.type => constants.%Class.GetNoDeduce.type.7e9
// CHECK:STDOUT: %Class.GetNoDeduce => constants.%Class.GetNoDeduce.c1e
// CHECK:STDOUT: %Class.GetNoDeduce.specific_fn.loc20_53.2 => constants.%Class.GetNoDeduce.specific_fn.931
// CHECK:STDOUT: %Class.GetNoDeduce.specific_fn.loc20_60.2 => constants.%Class.GetNoDeduce.specific_fn.931
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Class.F(constants.%A, constants.%A) {
// CHECK:STDOUT: %U.patt.loc21_9.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc21_9.1 => constants.%A
// CHECK:STDOUT: %Class.loc21_31.1 => constants.%Class.30a
// CHECK:STDOUT: %pattern_type.loc21_22 => constants.%pattern_type.89e
// CHECK:STDOUT: %self.param_patt.loc21_22.2 => constants.%self.param_patt.225
// CHECK:STDOUT: %self.patt.loc21_22.2 => constants.%self.patt.39c
// CHECK:STDOUT: %.loc21_37.2 => constants.%.cbf
// CHECK:STDOUT: %pattern_type.loc21_37 => constants.%pattern_type.9ef
// CHECK:STDOUT: %return.param_patt.loc21_37.2 => constants.%return.param_patt.f0c
// CHECK:STDOUT: %return.patt.loc21_34.2 => constants.%return.patt.a6d
// CHECK:STDOUT: %Class.loc21_30.1 => constants.%Class.30a
// CHECK:STDOUT: %pattern_type.loc21_21 => constants.%pattern_type.89e
// CHECK:STDOUT: %self.param_patt.loc21_21.2 => constants.%self.param_patt.225
// CHECK:STDOUT: %self.patt.loc21_21.2 => constants.%self.patt.39c
// CHECK:STDOUT: %.loc21_36.2 => constants.%.cbf
// CHECK:STDOUT: %pattern_type.loc21_36 => constants.%pattern_type.9ef
// CHECK:STDOUT: %return.param_patt.loc21_36.2 => constants.%return.param_patt.f0c
// CHECK:STDOUT: %return.patt.loc21_33.2 => constants.%return.patt.a6d
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete => constants.%complete_type.357
// CHECK:STDOUT: %Class.F.type => constants.%Class.F.type.e68
// CHECK:STDOUT: %Class.F => constants.%Class.F.805
// CHECK:STDOUT: %Class.F.specific_fn.loc21_52.2 => constants.%Class.F.specific_fn.0bd
// CHECK:STDOUT: %Class.F.specific_fn.loc21_51.2 => constants.%Class.F.specific_fn.0bd
// CHECK:STDOUT: }
// CHECK:STDOUT:
+65 -65
View File
@@ -16,9 +16,9 @@
library "[[@TEST_NAME]]";
class Generic(T:! type);
class Generic(T: type);
class Generic(T:! type) {
class Generic(T: type) {
}
// --- fail_mismatch_param_list.carbon
@@ -27,13 +27,13 @@ library "[[@TEST_NAME]]";
class A;
// CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter list [RedeclParamListDiffers]
// CHECK:STDERR: class A(T:! type) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: class A(T: type) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE-4]]:1: note: previously declared without parameter list [RedeclParamListPrevious]
// CHECK:STDERR: class A;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
class A(T:! type) {}
class A(T: type) {}
// --- fail_mismatch_implicit_param_list.carbon
@@ -41,15 +41,15 @@ library "[[@TEST_NAME]]";
class A {}
class B(N:! A);
class B(N: A);
// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE+7]]:1: error: redeclaration differs because of implicit parameter list [RedeclParamListDiffers]
// CHECK:STDERR: class B[T:! type](N:! T) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: class B[T: type](N: T) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE-4]]:1: note: previously declared without implicit parameter list [RedeclParamListPrevious]
// CHECK:STDERR: class B(N:! A);
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR: class B(N: A);
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
class B[T:! type](N:! T) {}
class B[T: type](N: T) {}
// --- fail_mismatch_param_count.carbon
@@ -57,15 +57,15 @@ library "[[@TEST_NAME]]";
class A {}
class C(T:! type);
class C(T: type);
// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers]
// CHECK:STDERR: class C(T:! type, U:! A) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: class C(T: type, U: A) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious]
// CHECK:STDERR: class C(T:! type);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
// CHECK:STDERR: class C(T: type);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR:
class C(T:! type, U:! A) {}
class C(T: type, U: A) {}
// --- fail_mismatch_param_type.carbon
@@ -73,29 +73,29 @@ library "[[@TEST_NAME]]";
class A {}
class D(T:! type);
class D(T: type);
// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE+7]]:9: error: type `<pattern for A>` of parameter 1 in redeclaration differs from previous parameter type `<pattern for type>` [RedeclParamDiffersType]
// CHECK:STDERR: class D(T:! A) {}
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: class D(T: A) {}
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE-4]]:9: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
// CHECK:STDERR: class D(T:! type);
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: class D(T: type);
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
class D(T:! A) {}
class D(T: A) {}
// --- fail_mismatch_param_name.carbon
library "[[@TEST_NAME]]";
class E(T:! type);
class E(T: type);
// CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE+7]]:9: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
// CHECK:STDERR: class E(U:! type) {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: class E(U: type) {}
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE-4]]:9: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
// CHECK:STDERR: class E(T:! type);
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: class E(T: type);
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
class E(U:! type) {}
class E(U: type) {}
// CHECK:STDOUT: --- valid.carbon
// CHECK:STDOUT:
@@ -128,18 +128,18 @@ class E(U:! type) {}
// CHECK:STDOUT: %Generic.decl.loc4: %Generic.type = class_decl @Generic [concrete = constants.%Generic.generic] {
// CHECK:STDOUT: %T.patt.loc6: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_19.1: type = splice_block %.loc4_19.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_18.1: type = splice_block %.loc4_18.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc4: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_19.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_18.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_16.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_16.1 (constants.%T)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Generic.decl.loc6: %Generic.type = class_decl @Generic [concrete = constants.%Generic.generic] {
// CHECK:STDOUT: %T.patt.loc6: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc6_19.1: type = splice_block %.loc6_19.2 [concrete = type] {
// CHECK:STDOUT: %.loc6_18.1: type = splice_block %.loc6_18.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc6: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc6_19.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc6_18.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc6: type = symbolic_binding T, 0 [symbolic = %T.loc4_16.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -198,9 +198,9 @@ class E(U:! type) {}
// CHECK:STDOUT: %A.decl.loc12: %A.type = class_decl @A.loc12 [concrete = constants.%A.generic] {
// CHECK:STDOUT: %T.patt.loc12_10.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_10.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc12_13.1: type = splice_block %.loc12_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc12_12.1: type = splice_block %.loc12_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc12_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc12_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc12_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc12_10.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -278,18 +278,18 @@ class E(U:! type) {}
// CHECK:STDOUT: }
// CHECK:STDOUT: %B.decl.loc14: %B.type.7937a9.2 = class_decl @B.loc14 [concrete = constants.%B.generic.60ca48.2] {
// CHECK:STDOUT: %T.patt.loc14_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt)]
// CHECK:STDOUT: %N.patt.loc14_20.1: @B.loc14.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc14_20.2 (constants.%N.patt.9f0)]
// CHECK:STDOUT: %N.patt.loc14_19.1: @B.loc14.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc14_19.2 (constants.%N.patt.9f0)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc14_13.1: type = splice_block %.loc14_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc14_12.1: type = splice_block %.loc14_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc14_10: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc14_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc14_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc14_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T)]
// CHECK:STDOUT: %.loc14_23: type = splice_block %T.ref [symbolic = %T.loc14_10.1 (constants.%T)] {
// CHECK:STDOUT: %.Self.frozen.loc14_20: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc14_21: type = splice_block %T.ref [symbolic = %T.loc14_10.1 (constants.%T)] {
// CHECK:STDOUT: %.Self.frozen.loc14_19: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_10.2 [symbolic = %T.loc14_10.1 (constants.%T)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %N.loc14_20.2: @B.loc14.%T.loc14_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc14_20.1 (constants.%N.bd9)]
// CHECK:STDOUT: %N.loc14_19.2: @B.loc14.%T.loc14_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc14_19.1 (constants.%N.bd9)]
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -308,12 +308,12 @@ class E(U:! type) {}
// CHECK:STDOUT: class;
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic class @B.loc14(%T.loc14_10.2: type, %N.loc14_20.2: @B.loc14.%T.loc14_10.1 (%T)) {
// CHECK:STDOUT: generic class @B.loc14(%T.loc14_10.2: type, %N.loc14_19.2: @B.loc14.%T.loc14_10.1 (%T)) {
// CHECK:STDOUT: %T.patt.loc14_10.2: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.loc14_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T)]
// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc14_10.1 [symbolic = %pattern_type (constants.%pattern_type.51d)]
// CHECK:STDOUT: %N.patt.loc14_20.2: @B.loc14.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc14_20.2 (constants.%N.patt.9f0)]
// CHECK:STDOUT: %N.loc14_20.1: @B.loc14.%T.loc14_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc14_20.1 (constants.%N.bd9)]
// CHECK:STDOUT: %N.patt.loc14_19.2: @B.loc14.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc14_19.2 (constants.%N.patt.9f0)]
// CHECK:STDOUT: %N.loc14_19.1: @B.loc14.%T.loc14_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc14_19.1 (constants.%N.bd9)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT:
@@ -335,8 +335,8 @@ class E(U:! type) {}
// CHECK:STDOUT: %T.patt.loc14_10.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc14_10.1 => constants.%T
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
// CHECK:STDOUT: %N.patt.loc14_20.2 => constants.%N.patt.9f0
// CHECK:STDOUT: %N.loc14_20.1 => constants.%N.bd9
// CHECK:STDOUT: %N.patt.loc14_19.2 => constants.%N.patt.9f0
// CHECK:STDOUT: %N.loc14_19.1 => constants.%N.bd9
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_mismatch_param_count.carbon
@@ -378,26 +378,26 @@ class E(U:! type) {}
// CHECK:STDOUT: %C.decl.loc6: %C.type.a601fe.1 = class_decl @C.loc6 [concrete = constants.%C.generic.4b4597.1] {
// CHECK:STDOUT: %T.patt.loc6_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_10.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc6_13.1: type = splice_block %.loc6_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc6_12.1: type = splice_block %.loc6_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc6_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc6_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc6_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_10.1 (constants.%T)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.decl.loc14: %C.type.a601fe.2 = class_decl @C.loc14 [concrete = constants.%C.generic.4b4597.2] {
// CHECK:STDOUT: %T.patt.loc14_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt)]
// CHECK:STDOUT: %U.patt.loc14_20.1: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc14_20.2 (constants.%U.patt)]
// CHECK:STDOUT: %U.patt.loc14_19.1: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc14_19.2 (constants.%U.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc14_13.1: type = splice_block %.loc14_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc14_12.1: type = splice_block %.loc14_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen.loc14_10: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc14_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc14_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc14_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T)]
// CHECK:STDOUT: %.loc14_23: type = splice_block %A.ref [concrete = constants.%A] {
// CHECK:STDOUT: %.Self.frozen.loc14_20: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc14_21: type = splice_block %A.ref [concrete = constants.%A] {
// CHECK:STDOUT: %.Self.frozen.loc14_19: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc14_20.2: %A = symbolic_binding U, 1 [symbolic = %U.loc14_20.1 (constants.%U)]
// CHECK:STDOUT: %U.loc14_19.2: %A = symbolic_binding U, 1 [symbolic = %U.loc14_19.1 (constants.%U)]
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -416,11 +416,11 @@ class E(U:! type) {}
// CHECK:STDOUT: class;
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic class @C.loc14(%T.loc14_10.2: type, %U.loc14_20.2: %A) {
// CHECK:STDOUT: generic class @C.loc14(%T.loc14_10.2: type, %U.loc14_19.2: %A) {
// CHECK:STDOUT: %T.patt.loc14_10.2: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_10.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.loc14_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_10.1 (constants.%T)]
// CHECK:STDOUT: %U.patt.loc14_20.2: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc14_20.2 (constants.%U.patt)]
// CHECK:STDOUT: %U.loc14_20.1: %A = symbolic_binding U, 1 [symbolic = %U.loc14_20.1 (constants.%U)]
// CHECK:STDOUT: %U.patt.loc14_19.2: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc14_19.2 (constants.%U.patt)]
// CHECK:STDOUT: %U.loc14_19.1: %A = symbolic_binding U, 1 [symbolic = %U.loc14_19.1 (constants.%U)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT:
@@ -441,8 +441,8 @@ class E(U:! type) {}
// CHECK:STDOUT: specific @C.loc14(constants.%T, constants.%U) {
// CHECK:STDOUT: %T.patt.loc14_10.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc14_10.1 => constants.%T
// CHECK:STDOUT: %U.patt.loc14_20.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc14_20.1 => constants.%U
// CHECK:STDOUT: %U.patt.loc14_19.2 => constants.%U.patt
// CHECK:STDOUT: %U.loc14_19.1 => constants.%U
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_mismatch_param_type.carbon
@@ -484,9 +484,9 @@ class E(U:! type) {}
// CHECK:STDOUT: %D.decl.loc6: %D.type.ff75f2.1 = class_decl @D.loc6 [concrete = constants.%D.generic.7223e9.1] {
// CHECK:STDOUT: %T.patt.loc6_10.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_10.2 (constants.%T.patt.d47)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc6_13.1: type = splice_block %.loc6_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc6_12.1: type = splice_block %.loc6_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc6_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc6_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc6_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_10.1 (constants.%T.67d)]
// CHECK:STDOUT: }
@@ -576,18 +576,18 @@ class E(U:! type) {}
// CHECK:STDOUT: %E.decl.loc4: %E.type.0b1ef1.1 = class_decl @E.loc4 [concrete = constants.%E.generic.5469ef.1] {
// CHECK:STDOUT: %T.patt.loc4_10.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_10.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_13.1: type = splice_block %.loc4_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_12.1: type = splice_block %.loc4_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_10.1 (constants.%T)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %E.decl.loc12: %E.type.0b1ef1.2 = class_decl @E.loc12 [concrete = constants.%E.generic.5469ef.2] {
// CHECK:STDOUT: %U.patt.loc12_10.1: %pattern_type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_10.2 (constants.%U.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc12_13.1: type = splice_block %.loc12_13.2 [concrete = type] {
// CHECK:STDOUT: %.loc12_12.1: type = splice_block %.loc12_12.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc12_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc12_12.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc12_10.2: type = symbolic_binding U, 0 [symbolic = %U.loc12_10.1 (constants.%U)]
// CHECK:STDOUT: }
+3 -3
View File
@@ -12,7 +12,7 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/self.carbon
class Class(T:! type) {
class Class(T: type) {
// `Self` is the same as `Class(T)` here.
// TODO: Find a better way to test two types are the same.
fn MakeSelf() -> Self { return {}; }
@@ -84,9 +84,9 @@ class Class(T:! type) {
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc15_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_14.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc15_17.1: type = splice_block %.loc15_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc15_16.1: type = splice_block %.loc15_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc15_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc15_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc15_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc15_14.1 (constants.%T)]
// CHECK:STDOUT: }
+8 -8
View File
@@ -33,8 +33,8 @@ var w: EmptyParams() = v;
library "[[@TEST_NAME]]";
class Outer(T:! type) {
class Inner(U:! type) {
class Outer(T: type) {
class Inner(U: type) {
}
}
@@ -54,7 +54,7 @@ var w: Outer({}*).Inner({.a: i32}*) = v;
library "[[@TEST_NAME]]";
class C(N:! i32) {}
class C(N: i32) {}
// CHECK:STDERR: fail_int_value.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `C(123)` [ConversionFailure]
// CHECK:STDERR: var v: C(123) = ();
@@ -74,7 +74,7 @@ class D {
var b: i32;
}
class E(F:! D) {}
class E(F: D) {}
// CHECK:STDERR: fail_class_param.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `E({.a = 3, .b = 4})` to `E({.a = 1, .b = 2})` [ConversionFailure]
// CHECK:STDERR: var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D);
@@ -264,9 +264,9 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D);
// CHECK:STDOUT: %Outer.decl: %Outer.type = class_decl @Outer [concrete = constants.%Outer.generic] {
// CHECK:STDOUT: %T.patt.loc4_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt.d47)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc4_16.1: type = splice_block %.loc4_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc4_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc4_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T.67d)]
// CHECK:STDOUT: }
@@ -316,9 +316,9 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D);
// CHECK:STDOUT: %Inner.decl: @Outer.%Inner.type (%Inner.type.8f7) = class_decl @Inner [symbolic = @Outer.%Inner.generic (constants.%Inner.generic.b3a)] {
// CHECK:STDOUT: %U.patt.loc5_16.1: %pattern_type.98f = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc5_16.2 (constants.%U.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc5_19.1: type = splice_block %.loc5_19.2 [concrete = type] {
// CHECK:STDOUT: %.loc5_18.1: type = splice_block %.loc5_18.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc5_19.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc5_18.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %U.loc5_16.2: type = symbolic_binding U, 1 [symbolic = %U.loc5_16.1 (constants.%U)]
// CHECK:STDOUT: }
@@ -12,7 +12,7 @@
class I {}
class Class(T:! type) {
class Class(T: type) {
var a: T;
fn F(self, n: T);
}
@@ -20,18 +20,18 @@ class Class(T:! type) {
// TODO: The follow-on errors here aren't great. Investigate whether we can
// enter the scope anyway if the parameters don't match.
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+15]]:17: error: type `<pattern for I>` of parameter 1 in redeclaration differs from previous parameter type `<pattern for type>` [RedeclParamDiffersType]
// CHECK:STDERR: fn Class(unused N:! I).F(unused self, unused n: T) {}
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fn Class(unused N: I).F(unused self, unused n: T) {}
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE-10]]:13: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
// CHECK:STDERR: class Class(T:! type) {
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: class Class(T: type) {
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+8]]:33: error: name `Self` not found [NameNotFound]
// CHECK:STDERR: fn Class(unused N:! I).F(unused self, unused n: T) {}
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+8]]:32: error: name `Self` not found [NameNotFound]
// CHECK:STDERR: fn Class(unused N: I).F(unused self, unused n: T) {}
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+4]]:49: error: name `T` not found [NameNotFound]
// CHECK:STDERR: fn Class(unused N:! I).F(unused self, unused n: T) {}
// CHECK:STDERR: ^
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+4]]:48: error: name `T` not found [NameNotFound]
// CHECK:STDERR: fn Class(unused N: I).F(unused self, unused n: T) {}
// CHECK:STDERR: ^
// CHECK:STDERR:
fn Class(unused N:! I).F(unused self, unused n: T) {}
fn Class(unused N: I).F(unused self, unused n: T) {}
+11 -11
View File
@@ -12,12 +12,12 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/method/generic_method.carbon
class Class(T:! type) {
class Class(T: type) {
var a: T;
fn F(self, n: T);
}
fn Class(T:! type).F(unused self, unused n: T) {}
fn Class(T: type).F(unused self, unused n: T) {}
// CHECK:STDOUT: --- generic_method.carbon
@@ -63,9 +63,9 @@ fn Class(T:! type).F(unused self, unused n: T) {}
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
// CHECK:STDOUT: %T.patt.loc15_14.1: %pattern_type.98f = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_14.2 (constants.%T.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc15_17.1: type = splice_block %.loc15_17.2 [concrete = type] {
// CHECK:STDOUT: %.loc15_16.1: type = splice_block %.loc15_16.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc15_17.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc15_16.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc15_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc15_14.1 (constants.%T)]
// CHECK:STDOUT: }
@@ -75,15 +75,15 @@ fn Class(T:! type).F(unused self, unused n: T) {}
// CHECK:STDOUT: %n.param_patt.loc20: @Class.F.%pattern_type.loc17_15 (%pattern_type.51d) = value_param_pattern [symbolic = %n.param_patt.loc17 (constants.%n.param_patt)]
// CHECK:STDOUT: %n.patt.loc20: @Class.F.%pattern_type.loc17_15 (%pattern_type.51d) = at_binding_pattern n, %n.param_patt.loc20 [symbolic = %n.patt.loc17 (constants.%n.patt)]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc20_14.1: type = splice_block %.loc20_14.2 [concrete = type] {
// CHECK:STDOUT: %.loc20_13.1: type = splice_block %.loc20_13.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc20_14.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: %.loc20_13.2: type = type_literal type [concrete = type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc20: type = symbolic_binding T, 0 [symbolic = @Class.%T.loc15_14.1 (constants.%T)]
// CHECK:STDOUT: %self.param.loc20: @Class.F.%Class (%Class) = value_param call_param0
// CHECK:STDOUT: %.loc20_29.1: type = splice_block %Self.ref.loc20 [symbolic = %Class (constants.%Class)] {
// CHECK:STDOUT: %.loc20_29.2: type = specific_constant constants.%Class, @Class(constants.%T) [symbolic = %Class (constants.%Class)]
// CHECK:STDOUT: %Self.ref.loc20: type = name_ref Self, %.loc20_29.2 [symbolic = %Class (constants.%Class)]
// CHECK:STDOUT: %.loc20_28.1: type = splice_block %Self.ref.loc20 [symbolic = %Class (constants.%Class)] {
// CHECK:STDOUT: %.loc20_28.2: type = specific_constant constants.%Class, @Class(constants.%T) [symbolic = %Class (constants.%Class)]
// CHECK:STDOUT: %Self.ref.loc20: type = name_ref Self, %.loc20_28.2 [symbolic = %Class (constants.%Class)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %self.loc20: @Class.F.%Class (%Class) = wrapper_binding self, %self.param.loc20
// CHECK:STDOUT: %n.param.loc20: @Class.F.%T.loc17 (%T) = value_param call_param1
@@ -147,8 +147,8 @@ fn Class(T:! type).F(unused self, unused n: T) {}
// CHECK:STDOUT: %n.patt.loc17: @Class.F.%pattern_type.loc17_15 (%pattern_type.51d) = at_binding_pattern n, %n.param_patt.loc17 [symbolic = %n.patt.loc17 (constants.%n.patt)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %require_complete.loc20_29: <witness> = require_complete_type %Class [symbolic = %require_complete.loc20_29 (constants.%require_complete.4d9)]
// CHECK:STDOUT: %require_complete.loc20_43: <witness> = require_complete_type %T.loc17 [symbolic = %require_complete.loc20_43 (constants.%require_complete.944)]
// CHECK:STDOUT: %require_complete.loc20_28: <witness> = require_complete_type %Class [symbolic = %require_complete.loc20_28 (constants.%require_complete.4d9)]
// CHECK:STDOUT: %require_complete.loc20_42: <witness> = require_complete_type %T.loc17 [symbolic = %require_complete.loc20_42 (constants.%require_complete.944)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%self.param.loc20: @Class.F.%Class (%Class), %n.param.loc20: @Class.F.%T.loc17 (%T)) {
// CHECK:STDOUT: !entry:
+27 -27
View File
@@ -248,9 +248,9 @@ fn Derived.F(unused self) -> T2 {
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_generic_virtual_decl.carbon:[[@LINE+3]]:1: error: use of undefined generic function [MissingGenericFunctionDefinition]
// CHECK:STDERR: base class Base(T:! type) {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
base class Base(T:! type) {
// CHECK:STDERR: base class Base(T: type) {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
base class Base(T: type) {
// CHECK:STDERR: fail_generic_virtual_decl.carbon:[[@LINE+4]]:3: note: generic function declared here [MissingGenericFunctionDefinitionHere]
// CHECK:STDERR: virtual fn F(self);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
@@ -266,7 +266,7 @@ library "[[@TEST_NAME]]";
class T1 {
}
base class Base(T:! type) {
base class Base(T: type) {
virtual fn F(unused self, unused t: T) { }
}
@@ -330,29 +330,29 @@ library "[[@TEST_NAME]]";
base class T1 {
// CHECK:STDERR: fail_generic_virtual.carbon:[[@LINE+4]]:3: error: generic virtual function [GenericVirtual]
// CHECK:STDERR: virtual fn F[T:! type](self);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: virtual fn F[T: type](self);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
virtual fn F[T:! type](self);
virtual fn F[T: type](self);
}
// --- fail_generic_virtual_in_generic_class.carbon
library "[[@TEST_NAME]]";
base class T1(T:! type) {
base class T1(T: type) {
// CHECK:STDERR: fail_generic_virtual_in_generic_class.carbon:[[@LINE+4]]:3: error: generic virtual function [GenericVirtual]
// CHECK:STDERR: virtual fn F[T:! type](self);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: virtual fn F[T: type](self);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
virtual fn F[T:! type](self);
virtual fn F[T: type](self);
}
// --- generic_with_virtual.carbon
library "[[@TEST_NAME]]";
base class T1(T:! type) {
base class T1(T: type) {
//@dump-sem-ir-begin
virtual fn F(unused self) { }
//@dump-sem-ir-end
@@ -362,7 +362,7 @@ base class T1(T:! type) {
library "[[@TEST_NAME]]";
base class T1(T:! type) {
base class T1(T: type) {
//@dump-sem-ir-begin
virtual fn F(unused self, unused t: T) { }
//@dump-sem-ir-end
@@ -385,7 +385,7 @@ base class NonGenericBase {
virtual fn F2(unused self) { }
}
base class GenericDerived(T:! type) {
base class GenericDerived(T: type) {
extend base: NonGenericBase;
override fn F2(unused self) { }
virtual fn F3(unused self) { }
@@ -395,7 +395,7 @@ base class GenericDerived(T:! type) {
library "[[@TEST_NAME]]";
base class GenericBase(T:! type) {
base class GenericBase(T: type) {
virtual fn F1(unused self) { }
virtual fn F2(unused self) { }
}
@@ -412,7 +412,7 @@ base class NonGenericDerived {
library "[[@TEST_NAME]]";
base class Base(T:! type) {
base class Base(T: type) {
virtual fn F(unused self, unused t: Base(T)*) { }
}
class T1;
@@ -432,7 +432,7 @@ library "[[@TEST_NAME]]";
class T1;
class T2;
base class Base(T:! type) {
base class Base(T: type) {
virtual fn F(unused self, unused t: T1*) { }
}
@@ -454,10 +454,10 @@ class D1 {
library "[[@TEST_NAME]]";
abstract class Base(T:! type) {
abstract class Base(T: type) {
virtual fn F(unused self, unused t: T*) { }
}
class Derived(T:! type) {
class Derived(T: type) {
extend base: Base(T);
// CHECK:STDERR: fail_impl_generic_generic_mismatch.carbon:[[@LINE+7]]:37: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: override fn F(unused self, unused t: T) { }
@@ -473,10 +473,10 @@ class Derived(T:! type) {
library "[[@TEST_NAME]]";
abstract class Base(T:! type) {
abstract class Base(T: type) {
virtual fn F(unused self, unused t: T) { }
}
class Derived(T:! type) {
class Derived(T: type) {
extend base: Base(T*);
//@dump-sem-ir-begin
override fn F(unused self, unused t: T*) { }
@@ -487,7 +487,7 @@ class Derived(T:! type) {
library "[[@TEST_NAME]]";
abstract class Base(T:! type) {
abstract class Base(T: type) {
abstract fn F(self);
}
@@ -502,7 +502,7 @@ class Derived {
library "[[@TEST_NAME]]";
base class Base(T:! type) {
base class Base(T: type) {
virtual fn F(unused self) { }
}
@@ -519,11 +519,11 @@ var v: Base(T1) = {};
library "[[@TEST_NAME]]";
base class T1(G1:! type) {
base class T1(G1: type) {
virtual fn F(unused self) { }
}
class T2(G2:! type) {
class T2(G2: type) {
extend base: T1(G2);
}
@@ -531,11 +531,11 @@ class T2(G2:! type) {
library "[[@TEST_NAME]]";
base class T1(G1:! type) {
base class T1(G1: type) {
virtual fn F(unused self) { }
}
class T2(G2:! type) {
class T2(G2: type) {
class T3 {
extend base: T1(G2);
}

Some files were not shown because too many files have changed in this diff Show More