Closed Aurel300 closed 5 years ago
The . operator currently has the wrong associativity. The following code:
.
a.b.c
Parses as a.(b.c):
a.(b.c)
BinOp( a (dot) BinOp( b (dot) c ) )
The AST should instead look like (a.b).c:
(a.b).c
BinOp( BinOp( a (dot) b ) (dot) c )
This seems to be the cause of compiler crashes when testing nested structs. The following should compile, but currently does not:
struct Inner { var x: Int init() { self.x = 3 } } struct Outer { var inner: Inner init() { self.inner = Inner() } } contract Test {} Test :: (any) { public init() { var s: Outer = Outer() s.inner.x = 5 } }
The
.
operator currently has the wrong associativity. The following code:Parses as
a.(b.c)
:The AST should instead look like
(a.b).c
:This seems to be the cause of compiler crashes when testing nested structs. The following should compile, but currently does not: