Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing XlsTypeError when identical structs are defined in two separate files #1500

Open
m-torhan opened this issue Jun 26, 2024 · 0 comments · May be fixed by #1501
Open

Confusing XlsTypeError when identical structs are defined in two separate files #1500

m-torhan opened this issue Jun 26, 2024 · 0 comments · May be fixed by #1501
Assignees

Comments

@m-torhan
Copy link

Describe the bug
When two identical structs are defined in separate files and one is used as the other, the resulting XlsTypeError is confusing.

To Reproduce
Steps to reproduce the behavior:

  1. Write the following code:

foo.x

import bar;

struct Bar {
    a: u1,
}

fn fn_foo() {
    let b = Bar { a: u1:0 };
    bar::fn_bar(b);
}

bar.x

struct Bar {
    a: u1,
}

pub fn fn_bar(arg: Bar) {}
  1. Build DSLX target.
xls_dslx_library(
    name = "bar_dslx",
    srcs = ["bar.x"],
)

xls_dslx_library(
    name = "foo_dslx",
    srcs = ["foo.x"],
    deps = ["bar_dslx"],
)
bazel build //:foo_dslx
  1. Observe the error message:
foo.x:9:17-9:18
0007: fn fn_foo() {
0008:     let b = Bar { a: u1:0 };
0009:     bar::fn_bar(b);
~~~~~~~~~~~~~~~~~~~~~~^ XlsTypeError: Mismatch between parameter and argument types.
Type mismatch:
   Bar { a: uN[1] }
vs Bar { a: uN[1] }
0010: }
Error parsing and type checking DSLX source file: foo.x
Target //:foo_dslx failed to build

Expected behavior
The error should contain information why these types differ.

Environment (this can be helpful for troubleshooting):

  • OS: Arch Linux x86_64
  • Kernel version: 6.9.6-arch1-1
  • XLS hash: def000aaa4ec5745397a21c4eeb051760f08e855
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants