xls icon indicating copy to clipboard operation
xls copied to clipboard

stdlib functions seem to bypass visibility check

Open mikex-oss opened this issue 1 year ago • 0 comments

Describe the bug As part of fixing google/xls#1490, I started seeing a visibility failure for mapped functions like std::is_unsigned_msb_set(at https://github.com/google/xls/blob/main/xls/examples/protobuf/varint_streaming_decode.x#L98).

This led me to realize that we have a number of non-pub functions in there, and some are being used outside of map context without error.

To Reproduce Steps to reproduce the behavior:

  1. Use the following DSLX code snippet:
import std;

fn foo(a: u32) -> u2 {
  std::vslice<u32:1, u32:0>(a)
}

Note that vslice is not public: https://github.com/google/xls/blob/main/xls/dslx/stdlib/std.x#L1002 2. Build the DSLX library. 3. No error is generated.

Expected behavior It should report a build time error:

TypeInferenceError: Attempted to refer to module member fn vslice ... that is not public.

mikex-oss avatar Jul 02 '24 21:07 mikex-oss