You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A fetched contract's header constants are not reachable without importing the header again; an unknown facade constructor gets no suggestion #3521
Found while proving the xz facts for #3173 (xz_utils 5.8.4, with get c.xz_utils).
1. Constants. The contract presents Stream.easy_encoder(preset: u32, check_: i32). The value a caller needs is the header's LZMA_CHECK_CRC64:
use contracts.xz_utils
fn main:
match Stream.easy_encoder(6, LZMA_CHECK_CRC64):
...
error: symbol 'LZMA_CHECK_CRC64' is private to its package (declared in '.with/deps/c/xz_utils/5.8.4/contract.w', §18.3)
The program works once the user also writes use c_import("lzma.h"). Two defects:
The message is wrong about the cause and names no fix. The constant is the header's, not the contract's; the fix is importing the header.
Whether use contracts.<lib> should bring the header's constants (and present check_ as the header's enum type, not i32) is a C interop surface question: the user has already said which library they want, and the constants are part of calling it. Needs a ruling.
2. Suggestion. The constructors are named with the common prefix removed (Stream.easy_encoder, Stream.decoder), but writing Stream.lzma_easy_encoder(...) gives only unknown method 'lzma_easy_encoder' for type 'Stream', with no "did you mean". The only way to learn the name was WITH_DUMP_FACADE=1. The report (contract-report.txt) should also state each function's presented name.
Activity
An unknown method names the one most likely meant (#3521) (#3523)
use contracts.<name> sees what a c_import of the library's header sees (
A contract can name a forwarding macro; zlib's facts name the initial…