mc icon indicating copy to clipboard operation
mc copied to clipboard

Calling a generic function in an impl definition crashes the compiler

Open typeless opened this issue 3 years ago • 1 comments

This seems to happen only when the caller of the trait, the trait definition and the impl definition are all in different modules.

Here is a repro https://github.com/typeless/myr-bug/blob/main/c.myr#L12

$ mbld
        6m -O obj -I obj -I obj a.myr
Missing decl f
CRASH: 6m -O obj -I obj -I obj a.myr

typeless avatar Apr 19 '22 09:04 typeless

Update: My description of the issue was inaccurate. It seems to be that

  1. A pkg A makes calls to a generic function g defined in pkg B. The generic function g makes calls to a internal function f defined in the same pkg B.
  2. When the generic function g is imported into the pkg A, it's expanded in the pkg A. But in the instantiated g in A, it cannot see the function f defined internally in B.

typeless avatar Apr 21 '22 02:04 typeless