Skip to content

Commit

Permalink
Closes #783
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Aug 15, 2014
1 parent 453c6c6 commit 023394f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/rock/middle/Comparison.ooc
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ Comparison: class extends Expression {

(lRef, rRef) := (lType getRef(), rType getRef())

lCompound := lRef instanceOf?(CoverDecl) && !lRef as CoverDecl getFromType()
rCompound := rRef instanceOf?(CoverDecl) && !rRef as CoverDecl getFromType()
lCompound := lRef instanceOf?(CoverDecl) && !lRef as CoverDecl getFromType() && lType pointerLevel() == 0
rCompound := rRef instanceOf?(CoverDecl) && !rRef as CoverDecl getFromType() && rType pointerLevel() == 0

if(lCompound || rCompound) {
// if either side are compound covers (structs) - it's illegal.
Expand Down
17 changes: 17 additions & 0 deletions test/compiler/covers/pointer-comparison.ooc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

S: cover {
x, y: Int
}

main: func {
s := (1, 5) as S
a := s&
b := s&

if (!(a == b)) {
"Fail! expected a == b" println()
exit(1)
}

"Pass" println()
}

0 comments on commit 023394f

Please sign in to comment.