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

Misleading error message when (extract-variants :variants <n> <expr>) fails because of a cycle in the egraph #505

Open
gussmith23 opened this issue Jan 2, 2025 · 0 comments

Comments

@gussmith23
Copy link
Contributor

Current egglog extraction fails when there are cycles; see #315.

I just hit an issue where extract-variants fails because of #315, but the error message is misleading. See this example:
https://egraphs-good.github.io/egglog/?program=XQAAgADEAAAAAAAAAAAUHMnnVi1HmurH0_nckuChY4vMVTFLL6zeL8XZl8K_7jEMYHKxoZcOqRi-rAaPNzwGu5xY09mjyi9zsJSE_gyvpIPvMVxi1HwGaAJEGRTIUcM8sV5W10gDMJm7bxCZNbR7oN8Bfg-QmLQbeaAo2guZ33M1Sa0t6tn_2y-QAA%253D%253D

In the console, you'll see the error message

panicked at src/extract.rs:97:60:
extract_variants should be called after extractor initialization

However, the problem isn't due to an uninitialized extractor.

When :variants isn't set, then under the hood extract is called instead of extract_variants. In that case, we get a somewhat clearer error message:

panicked at src/extract.rs:67:17:
No cost for Value { bits: 0 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant