Skip to content

Hit an "impossible error" trying to write some set extensions #737

@ryanprior

Description

@ryanprior

I'm writing a small "set extensions" module and hit a snag.

Sandbox: https://mint-lang.com/sandbox/K2ayJmLpwSd4hA

Code to trigger the "impossible error":

module SetX {
  fun reduce(set : Set(item), initial : memo, function : Function(memo, item, memo)) {
    `#{set}.reduce(#{function}, #{initial})`
  }

  fun intersection(left : Set(item), right : Set(item)) {
    reduce(left, Set.empty, (memo : Set(item), value : item) {
      if(Set.has(left, value) && Set.has(right, value)) {
        Set.add(memo, value)
      } else {
        memo
      }
    })
  }
}

I'm using Mint 0.22.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions