Skip to content

Improve flow typing support for conditional blocks #522

@eric-milles

Description

@eric-milles

Like #521, flow typing needs to account for conditional execution (mainly if/else statements).

def m1(def x) {
  if (x instanceof CharSequence) {
    x = Integer.valueOf(x) // typeof(x) == Integer
  }
  x // typeof(x) == LUB(Object,Integer)
}
def m1(def x) {
  if (predicate()) {
    x = ''
  } else {
    x = new StringBuffer()
  }
  x // typeof(x) == LUB(String,StringBuffer)
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions