temperlang / temper

3 stars 0 forks source link

Connected method call broken into temp assignment #156

Open tjpalmer opened 3 months ago

tjpalmer commented 3 months ago

I wrote some Temper code like this:

let message = "hi";
let end = String.fromCodePoint(message[message.end]) orelse "nope";

Somewhere that call to String.fromCodePoints gets broken into a function assignment then a call. Here's the assignment, for example:

(Call
  (V nym`=`)
  (L t#131)
  (Call (V getStatic) (V String) (V \fromCodePoint)))

And here's the produced tmpl:

t#131 = String.fromCodePoint;
t#130 = (inline nym`String::get`)("hi", (inline nym`String::end`)("hi"));
t#132 = t#131(t#130);

The upshot is that the connected method never resolves. Here's a different example from the same funtest that does get converted:

t#115 = (inline nym`String::fromCodePoint`)(a__24);

I haven't tracked down what causes this, but it would be nice to do both of these things: