temperlang / temper

3 stars 0 forks source link

Inference propagates across decls #105

Open tjpalmer opened 8 months ago

tjpalmer commented 8 months ago

Here the type of fuji is implicit:

interface Apple {}
class Fuji extends Apple {}
let fuji = new Fuji();
let apple: Apple = fuji;

I expect it to be Fuji, but instead, it's Apple:

$ describe(0, "frontend.generateCodeStage.after")
...
  @optionalImport let nym`-repl/i0000//chunk.temper`.fuji ⦂ Apple__0;
  nym`-repl/i0000//chunk.temper`.fuji = new Fuji__1();
  @optionalImport let nym`-repl/i0000//chunk.temper`.apple: Apple__0;
  nym`-repl/i0000//chunk.temper`.apple = nym`-repl/i0000//chunk.temper`.fuji;
...

Instead of working from the initializer, it seems to propagate from apple, which seems very wrong to me.