FirebaseExtended / bolt

Bolt Compiler (Firebase Security and Modeling)
Apache License 2.0
896 stars 108 forks source link

Compiles incorrect rules – referencing "this" inside helper function #243

Open lukepighetti opened 5 years ago

lukepighetti commented 5 years ago
type InitialTimestamp extends Number {
  validate() { initial(now) }
}

initial(init) { prior(this) == null ? this == init : this == prior(this) }

compiles to

".validate": "(newData.isNumber() && (this == null ? this == now : this == this))"

Would be nice if this just threw an error at compile time