Skip to content

Commit

Permalink
test(code_gen): add snapshot tests for the group_ir function
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed Mar 23, 2020
1 parent cdbc1d7 commit 8d5f1d5
Show file tree
Hide file tree
Showing 57 changed files with 377 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn add(a:int, b:int):int {\n a+b\n}\n\nfn subtract(a:int, b:int):int {\n a-b\n}\n\nfn multiply(a:int, b:int):int {\n a*b\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn main(a:int):int {\n if a > 4 {\n return a;\n }\n a - 1\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn equals(a:int, b:int):bool { a == b }\nfn not_equals(a:int, b:int):bool { a != b }\nfn less(a:int, b:int):bool { a < b }\nfn less_equal(a:int, b:int):bool { a <= b }\nfn greater(a:int, b:int):bool { a > b }\nfn greater_equal(a:int, b:int):bool { a >= b }\nfn equalsf(a:float, b:float):bool { a == b }\nfn not_equalsf(a:float, b:float):bool { a != b }\nfn lessf(a:float, b:float):bool { a < b }\nfn less_equalf(a:float, b:float):bool { a <= b }\nfn greaterf(a:float, b:float):bool { a > b }\nfn greater_equalf(a:float, b:float):bool { a >= b }"
---
; ModuleID = 'group_name'
source_filename = "group_name"

11 changes: 11 additions & 0 deletions crates/mun_codegen/src/snapshots/test__extern_fn_group_ir.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
source: crates/mun_codegen/src/test.rs
expression: "extern fn add(a:int, b:int): int;\nfn main() {\n add(3,4);\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

%DispatchTable = type { i64 (i64, i64)* }

@dispatchTable = global %DispatchTable zeroinitializer

13 changes: 13 additions & 0 deletions crates/mun_codegen/src/snapshots/test__fibonacci_group_ir.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn fibonacci(n:int):int {\n if n <= 1 {\n n\n } else {\n fibonacci(n-1) + fibonacci(n-2)\n }\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

%DispatchTable = type { i64 (i64)* }

@dispatchTable = global %DispatchTable { i64 (i64)* @fibonacci }

declare i64 @fibonacci(i64)

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn fibonacci(n:int):int {\n let a = 0;\n let b = 1;\n let i = 1;\n loop {\n if i > n {\n return a\n }\n let sum = a + b;\n a = b;\n b = sum;\n i += 1;\n }\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

32 changes: 32 additions & 0 deletions crates/mun_codegen/src/snapshots/test__field_crash_group_ir.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
source: crates/mun_codegen/src/test.rs
expression: "struct(gc) Foo { a: int };\n\nfn main(c:int):int {\n let b = Foo { a: c + 5 }\n b.a\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 }
%struct.MunStructInfo = type { i8 addrspace(4)*, i8 addrspace(4)* addrspace(4)*, %struct.MunTypeInfo addrspace(4)* addrspace(4)*, i16 addrspace(4)*, i16, i8 }
%DispatchTable = type { i8* addrspace(4)* (i8 addrspace(4)*, i8*)*, i8* addrspace(4)* (i8 addrspace(4)*, i8*)* }

@"type_info::<Foo>::name" = private unnamed_addr constant [4 x i8] c"Foo\00"
@"struct_info::<Foo>::name" = private unnamed_addr constant [4 x i8] c"Foo\00"
@"struct_info::<Foo>::field_names" = private unnamed_addr constant [2 x i8] c"a\00"
@0 = private unnamed_addr constant [1 x i8 addrspace(4)*] [i8 addrspace(4)* @"struct_info::<Foo>::field_names"]
@"type_info::<core::i64>::name" = private unnamed_addr constant [10 x i8] c"core::i64\00"
@"type_info::<core::i64>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"G\13;t\97j8\18\D7M\83`\1D\C8\19%", [10 x i8]* @"type_info::<core::i64>::name", i32 64, i8 8, i8 0 }
@"struct_info::<Foo>::field_types" = private unnamed_addr constant [1 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<core::i64>"]
@"struct_info::<Foo>::field_offsets" = private unnamed_addr constant [1 x i16] zeroinitializer
@"type_info::<Foo>" = private unnamed_addr constant { %struct.MunTypeInfo, %struct.MunStructInfo } { %struct.MunTypeInfo { [16 x i8] c"\13V\C6}z\D1c\8D\81k\FB\82-\D2\C2]", [4 x i8]* @"type_info::<Foo>::name", i32 64, i8 8, i8 1 }, %struct.MunStructInfo { [4 x i8]* @"struct_info::<Foo>::name", [1 x i8 addrspace(4)*]* @0, [1 x %struct.MunTypeInfo addrspace(4)*]* @"struct_info::<Foo>::field_types", [1 x i16]* @"struct_info::<Foo>::field_offsets", i16 1, i8 0 } }
@"type_info::<*const TypeInfo>::name" = private unnamed_addr constant [16 x i8] c"*const TypeInfo\00"
@"type_info::<*const TypeInfo>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"=\A1-\1F\C2\A7\88`d\90\F4\B5\BEE}x", [16 x i8]* @"type_info::<*const TypeInfo>::name", i32 64, i8 8, i8 0 }
@"type_info::<*const *mut core::void>::name" = private unnamed_addr constant [23 x i8] c"*const *mut core::void\00"
@"type_info::<*const *mut core::void>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\C5fO\BD\84\DF\06\BFd+\B1\9Abv\CE\00", [23 x i8]* @"type_info::<*const *mut core::void>::name", i32 64, i8 8, i8 0 }
@"type_info::<*const core::void>::name" = private unnamed_addr constant [18 x i8] c"*const core::void\00"
@"type_info::<*const core::void>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\EF\D3\E0ac~\5C\D4\EF\AE\B1}\CA\BE\DA\16", [18 x i8]* @"type_info::<*const core::void>::name", i32 64, i8 8, i8 0 }
@"type_info::<*mut core::void>::name" = private unnamed_addr constant [16 x i8] c"*mut core::void\00"
@"type_info::<*mut core::void>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\F0Y\22\FC\95\9E\7F\CE\08T\B1\A2\CD\A7\FAz", [16 x i8]* @"type_info::<*mut core::void>::name", i32 64, i8 8, i8 0 }
@global_type_table = global [6 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<Foo>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*const TypeInfo>", %struct.MunTypeInfo addrspace(4)* @"type_info::<core::i64>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*const *mut core::void>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*const core::void>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*mut core::void>"]
@dispatchTable = global %DispatchTable zeroinitializer
@allocatorHandle = unnamed_addr global i8* null

48 changes: 48 additions & 0 deletions crates/mun_codegen/src/snapshots/test__field_expr_group_ir.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
source: crates/mun_codegen/src/test.rs
expression: "struct(value) Bar(float, Foo);\nstruct(value) Foo { a: int };\n\nfn bar_0(bar: Bar): float {\n bar.0\n}\n\nfn bar_1(bar: Bar): Foo {\n bar.1\n}\n\nfn bar_1_a(bar: Bar): int {\n bar.1.a\n}\n\nfn foo_a(foo: Foo): int {\n foo.a\n}\n\nfn bar_1_foo_a(bar: Bar): int {\n foo_a(bar_1(bar))\n}\n\nfn main(): int {\n let a: Foo = Foo { a: 5 };\n let b: Bar = Bar(1.23, a);\n let aa_lhs = a.a + 2;\n let aa_rhs = 2 + a.a;\n aa_lhs + aa_rhs\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 }
%struct.MunStructInfo = type { i8 addrspace(4)*, i8 addrspace(4)* addrspace(4)*, %struct.MunTypeInfo addrspace(4)* addrspace(4)*, i16 addrspace(4)*, i16, i8 }
%DispatchTable = type { i8* addrspace(4)* (i8 addrspace(4)*, i8*)*, i8* addrspace(4)* (i8 addrspace(4)*, i8*)*, i64 (%Foo)*, %Foo (%Bar)* }
%Foo = type { i64 }
%Bar = type { double, %Foo }

@"type_info::<Foo>::name" = private unnamed_addr constant [4 x i8] c"Foo\00"
@"struct_info::<Foo>::name" = private unnamed_addr constant [4 x i8] c"Foo\00"
@"struct_info::<Foo>::field_names" = private unnamed_addr constant [2 x i8] c"a\00"
@0 = private unnamed_addr constant [1 x i8 addrspace(4)*] [i8 addrspace(4)* @"struct_info::<Foo>::field_names"]
@"type_info::<core::i64>::name" = private unnamed_addr constant [10 x i8] c"core::i64\00"
@"type_info::<core::i64>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"G\13;t\97j8\18\D7M\83`\1D\C8\19%", [10 x i8]* @"type_info::<core::i64>::name", i32 64, i8 8, i8 0 }
@"struct_info::<Foo>::field_types" = private unnamed_addr constant [1 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<core::i64>"]
@"struct_info::<Foo>::field_offsets" = private unnamed_addr constant [1 x i16] zeroinitializer
@"type_info::<Foo>" = private unnamed_addr constant { %struct.MunTypeInfo, %struct.MunStructInfo } { %struct.MunTypeInfo { [16 x i8] c"\13V\C6}z\D1c\8D\81k\FB\82-\D2\C2]", [4 x i8]* @"type_info::<Foo>::name", i32 64, i8 8, i8 1 }, %struct.MunStructInfo { [4 x i8]* @"struct_info::<Foo>::name", [1 x i8 addrspace(4)*]* @0, [1 x %struct.MunTypeInfo addrspace(4)*]* @"struct_info::<Foo>::field_types", [1 x i16]* @"struct_info::<Foo>::field_offsets", i16 1, i8 1 } }
@"type_info::<*const TypeInfo>::name" = private unnamed_addr constant [16 x i8] c"*const TypeInfo\00"
@"type_info::<*const TypeInfo>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"=\A1-\1F\C2\A7\88`d\90\F4\B5\BEE}x", [16 x i8]* @"type_info::<*const TypeInfo>::name", i32 64, i8 8, i8 0 }
@"type_info::<core::f64>::name" = private unnamed_addr constant [10 x i8] c"core::f64\00"
@"type_info::<core::f64>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"`\DBF\9C?YJ%G\AD4\9F\D5\92%A", [10 x i8]* @"type_info::<core::f64>::name", i32 64, i8 8, i8 0 }
@"type_info::<*const *mut core::void>::name" = private unnamed_addr constant [23 x i8] c"*const *mut core::void\00"
@"type_info::<*const *mut core::void>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\C5fO\BD\84\DF\06\BFd+\B1\9Abv\CE\00", [23 x i8]* @"type_info::<*const *mut core::void>::name", i32 64, i8 8, i8 0 }
@"type_info::<Bar>::name" = private unnamed_addr constant [4 x i8] c"Bar\00"
@"struct_info::<Bar>::name" = private unnamed_addr constant [4 x i8] c"Bar\00"
@"struct_info::<Bar>::field_names" = private unnamed_addr constant [2 x i8] c"0\00"
@"struct_info::<Bar>::field_names.1" = private unnamed_addr constant [2 x i8] c"1\00"
@1 = private unnamed_addr constant [2 x i8 addrspace(4)*] [i8 addrspace(4)* @"struct_info::<Bar>::field_names", i8 addrspace(4)* @"struct_info::<Bar>::field_names.1"]
@"struct_info::<Bar>::field_types" = private unnamed_addr constant [2 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<core::f64>", %struct.MunTypeInfo addrspace(4)* @"type_info::<Foo>"]
@"struct_info::<Bar>::field_offsets" = private unnamed_addr constant [2 x i16] [i16 0, i16 8]
@"type_info::<Bar>" = private unnamed_addr constant { %struct.MunTypeInfo, %struct.MunStructInfo } { %struct.MunTypeInfo { [16 x i8] c"\DD\C3_\88\FAq\B6\EF\14*\E6\1F56FS", [4 x i8]* @"type_info::<Bar>::name", i32 128, i8 8, i8 1 }, %struct.MunStructInfo { [4 x i8]* @"struct_info::<Bar>::name", [2 x i8 addrspace(4)*]* @1, [2 x %struct.MunTypeInfo addrspace(4)*]* @"struct_info::<Bar>::field_types", [2 x i16]* @"struct_info::<Bar>::field_offsets", i16 2, i8 1 } }
@"type_info::<*const core::void>::name" = private unnamed_addr constant [18 x i8] c"*const core::void\00"
@"type_info::<*const core::void>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\EF\D3\E0ac~\5C\D4\EF\AE\B1}\CA\BE\DA\16", [18 x i8]* @"type_info::<*const core::void>::name", i32 64, i8 8, i8 0 }
@"type_info::<*mut core::void>::name" = private unnamed_addr constant [16 x i8] c"*mut core::void\00"
@"type_info::<*mut core::void>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\F0Y\22\FC\95\9E\7F\CE\08T\B1\A2\CD\A7\FAz", [16 x i8]* @"type_info::<*mut core::void>::name", i32 64, i8 8, i8 0 }
@global_type_table = global [8 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<Foo>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*const TypeInfo>", %struct.MunTypeInfo addrspace(4)* @"type_info::<core::i64>", %struct.MunTypeInfo addrspace(4)* @"type_info::<core::f64>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*const *mut core::void>", %struct.MunTypeInfo addrspace(4)* @"type_info::<Bar>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*const core::void>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*mut core::void>"]
@dispatchTable = global %DispatchTable { i8* addrspace(4)* (i8 addrspace(4)*, i8*)* null, i8* addrspace(4)* (i8 addrspace(4)*, i8*)* null, i64 (%Foo)* @foo_a, %Foo (%Bar)* @bar_1 }
@allocatorHandle = unnamed_addr global i8* null

declare i64 @foo_a(%Foo)

declare %Foo @bar_1(%Bar)

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn main(a:int):int {\n a\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn add_impl(a:int, b:int):int {\n a+b\n}\n\nfn add(a:int, b:int):int {\n add_impl(a,b)\n}\n\nfn test():int {\n add(4,5)\n add_impl(4,5)\n add(4,5)\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

%DispatchTable = type { i64 (i64, i64)*, i64 (i64, i64)* }

@dispatchTable = global %DispatchTable { i64 (i64, i64)* @add_impl, i64 (i64, i64)* @add }

declare i64 @add_impl(i64, i64)

declare i64 @add(i64, i64)

7 changes: 7 additions & 0 deletions crates/mun_codegen/src/snapshots/test__function_group_ir.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn main() {\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

33 changes: 33 additions & 0 deletions crates/mun_codegen/src/snapshots/test__gc_struct_group_ir.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
source: crates/mun_codegen/src/test.rs
expression: "struct(gc) Foo { a: int, b: int };\n\nfn foo() {\n let a = Foo { a: 3, b: 4 };\n a.b += 3;\n let b = a;\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 }
%struct.MunStructInfo = type { i8 addrspace(4)*, i8 addrspace(4)* addrspace(4)*, %struct.MunTypeInfo addrspace(4)* addrspace(4)*, i16 addrspace(4)*, i16, i8 }
%DispatchTable = type { i8* addrspace(4)* (i8 addrspace(4)*, i8*)*, i8* addrspace(4)* (i8 addrspace(4)*, i8*)* }

@"type_info::<Foo>::name" = private unnamed_addr constant [4 x i8] c"Foo\00"
@"struct_info::<Foo>::name" = private unnamed_addr constant [4 x i8] c"Foo\00"
@"struct_info::<Foo>::field_names" = private unnamed_addr constant [2 x i8] c"a\00"
@"struct_info::<Foo>::field_names.1" = private unnamed_addr constant [2 x i8] c"b\00"
@0 = private unnamed_addr constant [2 x i8 addrspace(4)*] [i8 addrspace(4)* @"struct_info::<Foo>::field_names", i8 addrspace(4)* @"struct_info::<Foo>::field_names.1"]
@"type_info::<core::i64>::name" = private unnamed_addr constant [10 x i8] c"core::i64\00"
@"type_info::<core::i64>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"G\13;t\97j8\18\D7M\83`\1D\C8\19%", [10 x i8]* @"type_info::<core::i64>::name", i32 64, i8 8, i8 0 }
@"struct_info::<Foo>::field_types" = private unnamed_addr constant [2 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<core::i64>", %struct.MunTypeInfo addrspace(4)* @"type_info::<core::i64>"]
@"struct_info::<Foo>::field_offsets" = private unnamed_addr constant [2 x i16] [i16 0, i16 8]
@"type_info::<Foo>" = private unnamed_addr constant { %struct.MunTypeInfo, %struct.MunStructInfo } { %struct.MunTypeInfo { [16 x i8] c"\13V\C6}z\D1c\8D\81k\FB\82-\D2\C2]", [4 x i8]* @"type_info::<Foo>::name", i32 128, i8 8, i8 1 }, %struct.MunStructInfo { [4 x i8]* @"struct_info::<Foo>::name", [2 x i8 addrspace(4)*]* @0, [2 x %struct.MunTypeInfo addrspace(4)*]* @"struct_info::<Foo>::field_types", [2 x i16]* @"struct_info::<Foo>::field_offsets", i16 2, i8 0 } }
@"type_info::<*const TypeInfo>::name" = private unnamed_addr constant [16 x i8] c"*const TypeInfo\00"
@"type_info::<*const TypeInfo>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"=\A1-\1F\C2\A7\88`d\90\F4\B5\BEE}x", [16 x i8]* @"type_info::<*const TypeInfo>::name", i32 64, i8 8, i8 0 }
@"type_info::<*const *mut core::void>::name" = private unnamed_addr constant [23 x i8] c"*const *mut core::void\00"
@"type_info::<*const *mut core::void>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\C5fO\BD\84\DF\06\BFd+\B1\9Abv\CE\00", [23 x i8]* @"type_info::<*const *mut core::void>::name", i32 64, i8 8, i8 0 }
@"type_info::<*const core::void>::name" = private unnamed_addr constant [18 x i8] c"*const core::void\00"
@"type_info::<*const core::void>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\EF\D3\E0ac~\5C\D4\EF\AE\B1}\CA\BE\DA\16", [18 x i8]* @"type_info::<*const core::void>::name", i32 64, i8 8, i8 0 }
@"type_info::<*mut core::void>::name" = private unnamed_addr constant [16 x i8] c"*mut core::void\00"
@"type_info::<*mut core::void>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\F0Y\22\FC\95\9E\7F\CE\08T\B1\A2\CD\A7\FAz", [16 x i8]* @"type_info::<*mut core::void>::name", i32 64, i8 8, i8 0 }
@global_type_table = global [6 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<Foo>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*const TypeInfo>", %struct.MunTypeInfo addrspace(4)* @"type_info::<core::i64>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*const *mut core::void>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*const core::void>", %struct.MunTypeInfo addrspace(4)* @"type_info::<*mut core::void>"]
@dispatchTable = global %DispatchTable zeroinitializer
@allocatorHandle = unnamed_addr global i8* null

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn foo(a:int):int {\n let b = if a > 3 {\n let c = if a > 4 {\n a+1\n } else {\n a+3\n }\n c\n } else {\n a-1\n }\n b\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn main() {\n let a = 3+3.0;\n let b = 3.0+3;\n}"
---
error 2:13: mismatched type
error 3:15: mismatched type
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn main(a:int):int {\n let b = a+1\n b\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn foo(n:int):int {\n loop {\n if n > 5 {\n break n;\n }\n if n > 10 {\n break 10;\n }\n n += 1;\n }\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn foo() {\n loop {}\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn main(a:int):int {\n if a > 4 {\n return a;\n } else {\n return a - 1;\n }\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn add(a: u8, b: u8): u8 { a+b }\n fn less(a: u16, b: u16): bool { a<b }\n fn greater(a: u32, b: u32): bool { a>b }\n fn equal(a: u64, b: u64): bool { a==b }\n fn greater_equal(a: usize, b: usize): bool { a>=b }\n fn less_equal(a: uint, b: uint): bool { a<=b }\n\n fn iadd(a: i8, b: i8): i8 { a+b }\n fn iless(a: i16, b: i16): bool { a<b }\n fn igreater(a: i32, b: i32): bool { a>b }\n fn iequal(a: i64, b: i64): bool { a==b }\n fn igreater_equal(a: isize, b: isize): bool { a>=b }\n fn iless_equal(a: int, b: int): bool { a<=b }"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn main():int {\n return 5;\n let a = 3; // Nothing regarding this statement should be in the IR\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn main():int {\n 0\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: crates/mun_codegen/src/test.rs
expression: "fn foo(a:int):int {\n let a = a+1;\n {\n let a = a+2;\n }\n a+3\n}\n\nfn bar(a:int):int {\n let a = a+1;\n let a = {\n let a = a+2;\n a\n }\n a+3\n}"
---
; ModuleID = 'group_name'
source_filename = "group_name"

Loading

0 comments on commit 8d5f1d5

Please sign in to comment.