// ── ILEmitterTests_New__Deprecated_Amp_IsNotAnError ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Deprecated_Amp_IsNotAnError topic: allocation status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test data Box { n: int } func go() -> int { let b = &Box { n: 7 } return b.n } // ── ILEmitterTests_New__Ident_New_AsFieldName ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Ident_New_AsFieldName topic: allocation status: verified // verified behavior: Test.go(...) == 11 namespace Test data Holder { new: int } func go() -> int { let h = Holder { new: 11 } return h.new } // ── ILEmitterTests_New__Ident_New_AsFunctionName ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Ident_New_AsFunctionName topic: allocation status: verified // verified behavior: Test.go(...) == 7 namespace Test func new() -> int = 7 func go() -> int { return new() } // ── ILEmitterTests_New__Ident_New_AsFunctionParameter ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Ident_New_AsFunctionParameter topic: allocation status: verified // verified behavior: Test.go(...) == 8 namespace Test func inc(new: int) -> int = new + 1 func go() -> int { return inc(7) } // ── ILEmitterTests_New__Ident_New_AsLetThenArithmetic ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Ident_New_AsLetThenArithmetic topic: allocation status: verified // verified behavior: Test.go(...) == 25 namespace Test func go() -> int { let new = 5 return new * new } // ── ILEmitterTests_New__Ident_New_AsLocalVariable ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Ident_New_AsLocalVariable topic: allocation status: verified // verified behavior: Test.go(...) == 5 namespace Test func go() -> int { let new = 5 return new } // ── ILEmitterTests_New__Ident_New_AsLoopVariableName ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Ident_New_AsLoopVariableName topic: allocation status: verified // verified behavior: Test.go(...) == 10 namespace Test func go() -> int { var new = 0 for i in 0..5 { new += i } return new } // ── ILEmitterTests_New__Ident_New_AsMutableVariable ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Ident_New_AsMutableVariable topic: allocation status: verified // verified behavior: Test.go(...) == 3 namespace Test func go() -> int { var new = 1 new += 2 return new } // ── ILEmitterTests_New__Ident_New_FollowedByComparison_NotTriggered ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Ident_New_FollowedByComparison_NotTriggered topic: allocation status: verified // verified behavior: Test.go(...) == 1 namespace Test func go() -> int { let new = 5 return new < 10 ? 1 : 0 } // ── ILEmitterTests_New__Ident_New_LowercaseTypeNotTriggered ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Ident_New_LowercaseTypeNotTriggered topic: allocation status: verified // verified behavior: Test.go(...) == 4 namespace Test func go() -> int { var new = 1 let other = 3 return new + other } // ── ILEmitterTests_New__IL_New_EmitsHeapAllocation ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::IL_New_EmitsHeapAllocation topic: allocation status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test data Node { value: int, next: *Node } func go() -> int { let n = new Node { value: 7, next: nil } return n.value } // ── ILEmitterTests_New__IL_New_LocalIsHeapPointerWrapper ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::IL_New_LocalIsHeapPointerWrapper topic: allocation status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test data Node { value: int, next: *Node } func go() -> int { var n: *Node = new Node { value: 7, next: nil } return n.value } // ── ILEmitterTests_New__Neg_NewExternalGeneric_IsES2144 ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Neg_NewExternalGeneric_IsES2144 topic: allocation status: verified // verified behavior: reports diagnostic ES2144 namespace Test func go() -> int { let xs = new List() return 0 } // ── ILEmitterTests_New__Neg_NewExternalType_IsES2144 ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Neg_NewExternalType_IsES2144 topic: allocation status: verified // verified behavior: reports diagnostic ES2144 namespace Test func go() -> int { let s = new StringBuilder { } return 0 } // ── ILEmitterTests_New__Neg_NewRefData_IsES2003 ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Neg_NewRefData_IsES2003 topic: allocation status: verified // verified behavior: reports diagnostic ES2003 namespace Test ref data R { x: int init(x: int) { self.x = x } } func go() -> int { let r = new R { x: 1 } return r.x } // ── ILEmitterTests_New__New_AsConditionArgument ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_AsConditionArgument topic: allocation status: verified // verified behavior: Test.go(...) == true namespace Test data Box { n: int } func positive(b: *Box) -> bool = b.n > 0 func go() -> bool { if positive(new Box { n: 3 }) { return true } return false } // ── ILEmitterTests_New__New_AsExpressionBodiedReturn ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_AsExpressionBodiedReturn topic: allocation status: verified // verified behavior: Test.go(...) == 3 namespace Test data Point { x: int, y: int } func make() -> *Point = new Point { x: 1, y: 2 } func go() -> int { let p = make() return p.x + p.y } // ── ILEmitterTests_New__New_AsFunctionArgument ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_AsFunctionArgument topic: allocation status: verified // verified behavior: Test.go(...) == 8 namespace Test data Box { n: int } func read(b: *Box) -> int = b.n func go() -> int { return read(new Box { n: 8 }) } // ── ILEmitterTests_New__New_AssignedToFieldThenRead ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_AssignedToFieldThenRead topic: allocation status: verified // verified behavior: Test.go(...) == 42 namespace Test data Inner { v: int } data Holder { var p: *Inner } func go() -> int { var h = Holder { p: nil } h.p = new Inner { v: 42 } return h.p.v } // ── ILEmitterTests_New__New_BuildListInLoop ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_BuildListInLoop topic: allocation status: verified // verified behavior: Test.go(...) == 10 namespace Test data Node { value: int, next: *Node } func go() -> int { var head: *Node = nil var i = 1 while i <= 4 { head = new Node { value: i, next: head } i += 1 } var sum = 0 var cur = head while cur != nil { sum += cur.value cur = cur.next } return sum } // ── ILEmitterTests_New__New_CallsPointerReceiverMethod ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_CallsPointerReceiverMethod topic: allocation status: verified // verified behavior: Test.go(...) == 43 namespace Test data Counter { value: int } func bump(c: *Counter) { c.value += 1 } func go() -> int { var c = new Counter { value: 42 } bump(c) return c.value } // ── ILEmitterTests_New__New_ChainedListBuild_LengthFive ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_ChainedListBuild_LengthFive topic: allocation status: verified // verified behavior: Test.go(...) == 5 namespace Test data Node { value: int, next: *Node } func go() -> int { var head: *Node = nil var i = 0 while i < 5 { head = new Node { value: i, next: head } i += 1 } var c = 0 var cur = head while cur != nil { c += 1 cur = cur.next } return c } // ── ILEmitterTests_New__New_Composite_BoolField ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Composite_BoolField topic: allocation status: verified // verified behavior: Test.go(...) == true namespace Test data Flag { on: bool } func go() -> bool { let f = new Flag { on: true } return f.on } // ── ILEmitterTests_New__New_Composite_DoubleField ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Composite_DoubleField topic: allocation status: verified // verified behavior: Test.go(...) == 2.5 namespace Test data Num { v: double } func go() -> double { let n = new Num { v: 2.5 } return n.v } // ── ILEmitterTests_New__New_Composite_MutatesThroughPointer ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Composite_MutatesThroughPointer topic: allocation status: verified // verified behavior: Test.go(...) == 6 namespace Test data Counter { value: int } func go() -> int { var c = new Counter { value: 1 } c.value += 5 return c.value } // ── ILEmitterTests_New__New_Composite_NewlineSeparatedFields ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Composite_NewlineSeparatedFields topic: allocation status: verified // verified behavior: Test.go(...) == 30 namespace Test data Point { x: int, y: int } func go() -> int { let p = new Point { x: 10 y: 20 } return p.x + p.y } // ── ILEmitterTests_New__New_Composite_ReadsFirstField ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Composite_ReadsFirstField topic: allocation status: verified // verified behavior: Test.go(...) == 3 namespace Test data Point { x: int, y: int } func go() -> int { let p = new Point { x: 3, y: 4 } return p.x } // ── ILEmitterTests_New__New_Composite_ReadsSecondField ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Composite_ReadsSecondField topic: allocation status: verified // verified behavior: Test.go(...) == 4 namespace Test data Point { x: int, y: int } func go() -> int { let p = new Point { x: 3, y: 4 } return p.y } // ── ILEmitterTests_New__New_Composite_StringField ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Composite_StringField topic: allocation status: verified // verified behavior: Test.go(...) == "hi" namespace Test data Label { text: string } func go() -> string { let l = new Label { text: "hi" } return l.text } // ── ILEmitterTests_New__New_Composite_SumsFields ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Composite_SumsFields topic: allocation status: verified // verified behavior: Test.go(...) == 7 namespace Test data Point { x: int, y: int } func go() -> int { let p = new Point { x: 3, y: 4 } return p.x + p.y } // ── ILEmitterTests_New__New_DataWithDefaultField ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_DataWithDefaultField topic: allocation status: verified // verified behavior: Test.go(...) == 8 namespace Test data Box { n: int } func twice(b: *Box) -> int = b.n + b.n func go() -> int { return twice(new Box { n: 4 }) } // ── ILEmitterTests_New__New_DeepLinkedListSum ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_DeepLinkedListSum topic: allocation status: verified // verified behavior: Test.go(...) == 55 namespace Test data Node { value: int, next: *Node } func go() -> int { var head: *Node = nil var i = 1 while i <= 10 { head = new Node { value: i, next: head } i += 1 } var sum = 0 var cur = head while cur != nil { sum += cur.value cur = cur.next } return sum } // ── ILEmitterTests_New__New_ExplicitPointerAnnotation ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_ExplicitPointerAnnotation topic: allocation status: verified // verified behavior: Test.go(...) == 9 namespace Test data Box { n: int } func go() -> int { var b: *Box = new Box { n: 9 } return b.n } // ── ILEmitterTests_New__New_FollowedByMethodCallViaLocal ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_FollowedByMethodCallViaLocal topic: allocation status: verified // verified behavior: Test.go(...) == 50 namespace Test data Box { n: int } func scaled(b: *Box) -> int = b.n * 10 func go() -> int { let b = new Box { n: 5 } return scaled(b) } // ── ILEmitterTests_New__New_Generic_Pair_First ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Generic_Pair_First topic: allocation status: verified // verified behavior: Test.go(...) == 42 namespace Test data Pair { first: A, second: B } func go() -> int { let p = new Pair { first: 42, second: "x" } return p.first } // ── ILEmitterTests_New__New_Generic_Pair_Second ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Generic_Pair_Second topic: allocation status: verified // verified behavior: Test.go(...) == "hello" namespace Test data Pair { first: A, second: B } func go() -> string { let p = new Pair { first: 1, second: "hello" } return p.second } // ── ILEmitterTests_New__New_Generic_SameTypeArgs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Generic_SameTypeArgs topic: allocation status: verified // verified behavior: Test.go(...) == 5 namespace Test data Pair { first: A, second: B } func go() -> int { let p = new Pair { first: 2, second: 3 } return p.first + p.second } // ── ILEmitterTests_New__New_GenericNestedTypeArg ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_GenericNestedTypeArg topic: allocation status: verified // verified behavior: Test.go(...) == 3 namespace Test data Pair { first: A, second: B } func go() -> int { let p = new Pair { first: 1, second: 2 } return p.first + p.second } // ── ILEmitterTests_New__New_InIfBody ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_InIfBody topic: allocation status: verified // verified behavior: Test.go(...) == 5 namespace Test data Box { n: int } func go() -> int { var b = new Box { n: 0 } if true { b = new Box { n: 5 } } return b.n } // ── ILEmitterTests_New__New_InListLiteral_IndexThenMutate ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_InListLiteral_IndexThenMutate topic: allocation status: verified // verified behavior: Test.go(...) == 11 namespace Test data Box { n: int } func go() -> int { let xs = [new Box { n: 10 }, new Box { n: 20 }] xs[0].n += 1 return xs[0].n } // ── ILEmitterTests_New__New_InListLiteral_ThenIndex ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_InListLiteral_ThenIndex topic: allocation status: verified // verified behavior: Test.go(...) == 20 namespace Test data Box { n: int } func go() -> int { let xs = [new Box { n: 10 }, new Box { n: 20 }] return xs[1].n } // ── ILEmitterTests_New__New_InMatchArm ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_InMatchArm topic: allocation status: verified // verified behavior: Test.go(...) == 7 namespace Test data Box { n: int } choice Sel { a, b } func go() -> int { let s = Sel.a() var box = new Box { n: 0 } match s { .a { box = new Box { n: 7 } } .b { box = new Box { n: 9 } } } return box.n } // ── ILEmitterTests_New__New_InStaticFuncBody ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_InStaticFuncBody topic: allocation status: verified // verified behavior: Test.go(...) == 6 namespace Test data Box { n: int } static func Maker { func build(v: int) -> *Box = new Box { n: v } } func go() -> int { let b = Maker.build(6) return b.n } // ── ILEmitterTests_New__New_InTernaryBranch ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_InTernaryBranch topic: allocation status: verified // verified behavior: Test.go(...) == 2 namespace Test data Box { n: int } func go() -> int { let cond = false let b = cond ? new Box { n: 1 } : new Box { n: 2 } return b.n } // ── ILEmitterTests_New__New_InWhileConditionArgument ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_InWhileConditionArgument topic: allocation status: verified // verified behavior: Test.go(...) == 3 namespace Test data Box { n: int } func alive(b: *Box) -> bool = b.n > 0 func go() -> int { var count = 0 var n = 3 while alive(new Box { n: n }) { count += 1 n -= 1 } return count } // ── ILEmitterTests_New__New_LinkedList_NilTailTerminates ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_LinkedList_NilTailTerminates topic: allocation status: verified // verified behavior: Test.go(...) == 10 namespace Test data Node { value: int, next: *Node } func go() -> int { let only = new Node { value: 10, next: nil } return only.value } // ── ILEmitterTests_New__New_LinkedList_PrependReturnsPointer ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_LinkedList_PrependReturnsPointer topic: allocation status: verified // verified behavior: Test.go(...) == 3 namespace Test data Node { value: int, next: *Node } func prepend(head: *Node, value: int) -> *Node { return new Node { value: value, next: head } } func go() -> int { var head: *Node = nil head = prepend(head, 10) head = prepend(head, 20) head = prepend(head, 30) var count = 0 var cur = head while cur != nil { count += 1 cur = cur.next } return count } // ── ILEmitterTests_New__New_LinkedList_SumsThree ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_LinkedList_SumsThree topic: allocation status: verified // verified behavior: Test.go(...) == 6 namespace Test data Node { value: int, next: *Node } func go() -> int { var n3: *Node = new Node { value: 3, next: nil } var n2: *Node = new Node { value: 2, next: n3 } var n1: *Node = new Node { value: 1, next: n2 } var total = 0 var cur = n1 while cur != nil { total += cur.value cur = cur.next } return total } // ── ILEmitterTests_New__New_MultipleInOneExpression ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_MultipleInOneExpression topic: allocation status: verified // verified behavior: Test.go(...) == 3 namespace Test data Box { n: int } func add(a: *Box, b: *Box) -> int = a.n + b.n func go() -> int { return add(new Box { n: 1 }, new Box { n: 2 }) } // ── ILEmitterTests_New__New_MutateLinkedListNode ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_MutateLinkedListNode topic: allocation status: verified // verified behavior: Test.go(...) == 99 namespace Test data Node { var value: int, next: *Node } func go() -> int { var head = new Node { value: 1, next: nil } head.value = 99 return head.value } // ── ILEmitterTests_New__New_NestedInFieldInitializer ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_NestedInFieldInitializer topic: allocation status: verified // verified behavior: Test.go(...) == 30 namespace Test data Inner { n: int } data Outer { inner: *Inner, label: string } func go() -> int { let o = new Outer { inner: new Inner { n: 30 }, label: "x" } return o.inner.n } // ── ILEmitterTests_New__New_NestedThreeLevels ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_NestedThreeLevels topic: allocation status: verified // verified behavior: Test.go(...) == 7 namespace Test data A { n: int } data B { a: *A } data C { b: *B } func go() -> int { let c = new C { b: new B { a: new A { n: 7 } } } return c.b.a.n } // ── ILEmitterTests_New__New_NotNil ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_NotNil topic: allocation status: verified // verified behavior: Test.go(...) == true namespace Test data Box { n: int } func go() -> bool { let b = new Box { n: 1 } return b != nil } // ── ILEmitterTests_New__New_PointerComparedEqual ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_PointerComparedEqual topic: allocation status: verified // verified behavior: Test.go(...) == true namespace Test data Box { n: int } func go() -> bool { let a = new Box { n: 1 } let b = a return a == b } // ── ILEmitterTests_New__New_PointerEmbedding_PromotedAccess ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_PointerEmbedding_PromotedAccess topic: allocation status: verified // verified behavior: Test.go(...) == 15 namespace Test data Vec2 { var x: int, var y: int } data Entity { *Vec2, name: string } func go() -> int { var e = new Entity { Vec2: new Vec2 { x: 10, y: 5 }, name: "p" } e.x += 0 return e.x + e.y } // ── ILEmitterTests_New__New_PointerSatisfiesInterface ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_PointerSatisfiesInterface topic: allocation status: verified // verified behavior: Test.go(...) == 42 namespace Test data Inner { var n: int } func bump(i: *Inner) { i.n += 1 } func value(i: Inner) -> int = i.n data Outer : IBumper { *Inner, label: string } interface IBumper { func bump(), func value() -> int } func twice(b: IBumper) -> int { b.bump() b.bump() return b.value() } func go() -> int { var o: *Outer = new Outer { Inner: new Inner { n: 40 }, label: "x" } return twice(o) } // ── ILEmitterTests_New__New_Positional_AndComposite_SameType ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Positional_AndComposite_SameType topic: allocation status: verified // verified behavior: Test.go(...) == 20 namespace Test data Vec2(x: int, y: int) func go() -> int { let a = new Vec2(3, 4) let b = new Vec2 { x: 6, y: 7 } return a.x + a.y + b.x + b.y } // ── ILEmitterTests_New__New_Positional_ExprArgs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Positional_ExprArgs topic: allocation status: verified // verified behavior: Test.go(...) == 13 namespace Test data Vec2(x: int, y: int) func go() -> int { let a = 5 let v = new Vec2(a + 1, a + 2) return v.x + v.y } // ── ILEmitterTests_New__New_Positional_Mutation ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Positional_Mutation topic: allocation status: verified // verified behavior: Test.go(...) == 15 namespace Test data Vec2(x: int, y: int) func go() -> int { var v = new Vec2(3, 4) v.x = 11 return v.x + v.y } // ── ILEmitterTests_New__New_Positional_OneArg ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Positional_OneArg topic: allocation status: verified // verified behavior: Test.go(...) == 42 namespace Test data Wrap(v: int) func go() -> int { let w = new Wrap(42) return w.v } // ── ILEmitterTests_New__New_Positional_TwoArgs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Positional_TwoArgs topic: allocation status: verified // verified behavior: Test.go(...) == 7 namespace Test data Vec2(x: int, y: int) func go() -> int { let v = new Vec2(3, 4) return v.x + v.y } // ── ILEmitterTests_New__New_PositionalGenericExternal_IsError_List ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_PositionalGenericExternal_IsError_List topic: allocation status: verified // verified behavior: reports diagnostic ES2144 namespace Test func go() -> int { let d = new Dictionary() return 0 } // ── ILEmitterTests_New__New_ReadonlyData ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_ReadonlyData topic: allocation status: verified // verified behavior: Test.go(...) == 5 namespace Test readonly data Point { x: int, y: int } func go() -> int { let p = new Point { x: 2, y: 3 } return p.x + p.y } // ── ILEmitterTests_New__New_ReturnedFromBranch ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_ReturnedFromBranch topic: allocation status: verified // verified behavior: Test.go(...) == 9 namespace Test data Box { n: int } func make(big: bool) -> *Box { if big { return new Box { n: 9 } } return new Box { n: 1 } } func go() -> int { let b = make(true) return b.n } // ── ILEmitterTests_New__New_StringInterpolationViaLocal ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_StringInterpolationViaLocal topic: allocation status: verified // verified behavior: Test.go(...) == "n=5" namespace Test data Box { n: int } func go() -> string { let b = new Box { n: 5 } return "n={b.n}" } // ── ILEmitterTests_New__New_TwoInstances_IndependentIdentity ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_TwoInstances_IndependentIdentity topic: allocation status: verified // verified behavior: Test.go(...) == 3 namespace Test data Box { n: int } func go() -> int { var a = new Box { n: 1 } var b = new Box { n: 2 } a.n += 0 return a.n + b.n } // ── ILEmitterTests_New__New_TwoPointersNotEqual ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_TwoPointersNotEqual topic: allocation status: verified // verified behavior: Test.go(...) == false namespace Test data Box { n: int } func go() -> bool { let a = new Box { n: 1 } let b = new Box { n: 1 } return a == b } // ── ILEmitterTests_New__New_Var_Reassign ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_Var_Reassign topic: allocation status: verified // verified behavior: Test.go(...) == 2 namespace Test data Box { n: int } func go() -> int { var b = new Box { n: 1 } b = new Box { n: 2 } return b.n } // ── ILEmitterTests_New__Equivalence_NewAndAmp_SameResult ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::Equivalence_NewAndAmp_SameResult topic: allocation status: unverified // compiles cleanly (no auto-run claim was extracted) namespace Test data Node { value: int, next: *Node } func go() -> int { var n2: *Node = SPELL Node { value: 2, next: nil } var n1: *Node = SPELL Node { value: 1, next: n2 } return n1.value + n1.next.value } // ── ILEmitterTests_New__IL_NewAndAmp_EmitIdenticalBody ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::IL_NewAndAmp_EmitIdenticalBody topic: allocation status: unverified // compiles cleanly (no auto-run claim was extracted) namespace Test data Node { value: int, next: *Node } func go() -> int { let n = SPELL Node { value: 7, next: nil } return n.value } // ── ILEmitterTests_New__New_EmitsNoDeprecationWarning ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_EmitsNoDeprecationWarning topic: allocation status: unverified // verified behavior: reports diagnostic ES2143 namespace Test data Box { n: int } func go() -> int { let b = new Box { n: 7 } return b.n } // ── ILEmitterTests_New__New_PassedToGenericFunction ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_New.cs::New_PassedToGenericFunction topic: allocation status: unverified // verified behavior: Test.go(...) == 13 namespace Test data Box { n: int } func identity(v: T) -> T = v func go() -> int { let b = identity(new Box { n: 13 }) return b.n }