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

Bad error message for incorrect sizeof usage #1677

Open
meheff opened this issue Oct 30, 2024 · 2 comments
Open

Bad error message for incorrect sizeof usage #1677

meheff opened this issue Oct 30, 2024 · 2 comments
Labels
bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end

Comments

@meheff
Copy link
Collaborator

meheff commented Oct 30, 2024

foo.x

pub type foo_t = u32;

main.x

import std;
import foo;

fn f() -> () {
  let s: u32 = std::sizeof(foo::foo_t);
}

Repro:

$ interpreter_main bad.x --dslx_path .
E1030 13:03:32.587061  991027 deduce_invocation.cc:237] INTERNAL: XLS_RET_CHECK failure (third_party/xls/dslx/type_system/deduce_invocation.cc:237) !type->IsMeta() parametric arg: foo::foo_t type: typeof(uN[32])
=== Source Location Trace: ===
third_party/xls/common/status/status_builder.cc:197

0x5601c71a5cc9: xabsl::StatusBuilder::CreateStatusAndConditionallyLog()
0x5601c4049097: xls::dslx::AppendArgsForInstantiation()
0x5601c404957f: xls::dslx::DeduceInvocation()
0x5601c402cc7e: xls::dslx::(anonymous namespace)::DeduceVisitor::HandleInvocation()
...

@meheff meheff added bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end labels Oct 30, 2024
@richmckeever
Copy link
Collaborator

The error at hand probably needs to be fixed for other scenarios, but maybe we should turn sizeof into a builtin and make it work for anything with an exposable size.

@meheff
Copy link
Collaborator Author

meheff commented Oct 30, 2024

+1 to allowing std::sizeof(Type).

copybara-service bot pushed a commit that referenced this issue Oct 31, 2024
For `std::sizeof(non_imported_type)`, a separate parser fix is needed in order to hit this message.

Context: #1677
PiperOrigin-RevId: 691860943
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end
Projects
Status: No status
Development

No branches or pull requests

2 participants