flintlang / flint

The Flint Programming Language for Smart Contracts
MIT License
245 stars 18 forks source link

Error on self.x.y.z with explicit self #470

Open mrRachar opened 5 years ago

mrRachar commented 5 years ago

There seems to be an error when accessing properties explicitly on self. The issue that appears is (on flintlang/flint master) a fatal error on Optional unwrapping. I'm currently working on the MoveIR branch, and have neatened it up there to give the user more information, but the issue seems to be down to it thinking the type of the property being accessed is an integer, which is disallowed. I'm guessing this gets through earlier stages because it should work. The issue exists, for example, in structs.flint:

// Works
public func setBxx(x: Int) mutates (b) {
  b.x.x = x
}

// Does not work
public func setBxx(x: Int) mutates (b) {
  self.b.x.x = x
}

The issue may be more specific; I'm currently working on other issues so may not get the chance to come back an investigate it thoroughly.