compiler: implement array equality

Implement binops == and != on array types.
This commit is contained in:
Ayke van Laethem
2018-11-15 11:50:47 +01:00
parent 6292a0fd2e
commit 668c1741c3
3 changed files with 41 additions and 0 deletions
+10
View File
@@ -24,6 +24,14 @@ func main() {
println("ab" < "aa")
println("aa" < "ab")
println("array equality")
println(a1 == [2]int{1, 2})
println(a1 != [2]int{1, 2})
println(a1 == [2]int{1, 3})
println(a1 == [2]int{2, 2})
println(a1 == [2]int{2, 1})
println(a1 != [2]int{2, 1})
println("struct equality")
println(s1 == Struct1{3, true})
println(s1 == Struct1{4, true})
@@ -48,6 +56,8 @@ var a = "a"
var s1 = Struct1{3, true}
var s2 = Struct2{"foo", 0.0, 5}
var a1 = [2]int{1, 2}
type Struct1 struct {
i int
b bool
+7
View File
@@ -20,6 +20,13 @@ true
false
false
true
array equality
true
false
false
false
false
true
struct equality
true
false