Cannot call tag value constructors for tag type imported from another crate.

f831083
Opened by Roy Frostig at 2011-01-27 02:03:10

Suppose foo.rc is compiled as a shared (library) crate, and looks like:

mod bar;

and that bar.rs looks like:

type baz = tag(a(), b(), c());

When we compile a file that looks like:

use foo;
import foo.bar;

fn main() {
    let bar.baz x = bar.a();   // alternatively bar.b() or bar.c()
}

we are told

Fatal error: exception Failure("internal_check_ext_lval: ident a not found in mod item")

in response to our use of bar.a().

Fix whatever is wrong with tags imported from an external crate.

  1. Here's the post-parse AST for the main file:

    import bar = foo.bar
    export *;
    fn main() -> () {
        let mutable bar.baz x;
        x = bar.a();
    }
    mod foo {
        export *;
        mod bar {
            export *;
            type baz = rec(uint tag);
        }
    }
    

    Looks like DWARF for tag types is emitted incorrectly or parsed incorrectly.

    Roy Frostig at 2010-08-23 20:47:37

  2. In fact, DWARF for tag types isn't parsed at all (see the handling of DW_TAG_structure_type at boot/me/dwarf.ml line 2954).

    Patrick Walton at 2010-08-27 00:53:35

  3. The DWARF is parsed as of commit 88c9759347dddb61cb9e9a1e9d524b365857cf67, but the tag constructors still aren't created.

    Patrick Walton at 2010-08-27 18:50:54

  4. This will be fixed when tag types become fully nominal. graydon is working on this right now.

    Patrick Walton at 2010-09-02 17:45:43

  5. Fixed ages ago.

    Graydon Hoare at 2011-01-27 02:03:10