hylo-lang / hylo

The Hylo programming language
https://www.hylo-lang.org
Apache License 2.0
1.24k stars 58 forks source link

Force unwrap of nil #1280

Closed dabrahams closed 9 months ago

dabrahams commented 9 months ago

IR/Module+Depolymorphize.swift:634: Fatal error: Unexpectedly found nil while unwrapping an Optional value

On ce7e28ddc

public extension Collection {

  public fun rotate(x p: sink Position) inout -> Position {

    let (s1, m1) = self.swap_nonempty_subrange_prefixes(lhs_start: p)

    return p
  }

  fun swap_nonempty_subrange_prefixes(
    lhs_start: Position
  ) -> {Position, Position} {
    return (lhs_start.copy(), lhs_start.copy())
  }

}

public fun main() {}
kyouko-taiga commented 9 months ago

Minmal reproducer:

trait A { type P: Regular }

public extension A {
  fun g(_ p: sink P) {
    _ = (p.copy(), p.copy())
  }
}

public fun main() {}

The problem occurs during the monomorphization of the tuple's synthesized deinitializer.