hylo icon indicating copy to clipboard operation
hylo copied to clipboard

Detect and diagnose multiple yields in subscripts

Open kyouko-taiga opened this issue 11 months ago • 0 comments

The following program incorrectly compiles and possibly has UB:

subscript s(x: Int): Int {
  yield x
  yield x
}

public fun main() {
  print(s[x: 1])
}

The compiler should detect that there are two yield statements on the same execution path and report a diagnostic.

kyouko-taiga avatar Mar 21 '24 09:03 kyouko-taiga