morganey-lang / Morganey

Lambda Calculus based, interpreted programming language that recognizes Church encoded structures.
43 stars 4 forks source link

Module.load produces duplicate bindings #359

Open rexim opened 7 years ago

rexim commented 7 years ago

Reproduction

It doesn't have any significant side effects (except probably slightly higher memory consumption), so it's easier to reproduce that in the code.

Copy the following code to REPL:

import me.rexim.morganey.module._
{
  new Module(CanonicalPath("std.prelude"))
    .load()
    .map { bindings =>
      bindings
        .map(_.variable.name)
        .groupBy(identity)
        .mapValues(_.length)
    }
}

Expected

All binding counts are 1

Observed

Some bindings are repeated up to 6 times