-
-
Notifications
You must be signed in to change notification settings - Fork 822
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
fix[ux]: raise VersionException
with source info
#3920
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #3920 +/- ##
===========================================
- Coverage 90.03% 51.22% -38.82%
===========================================
Files 95 95
Lines 14411 14411
Branches 3193 3193
===========================================
- Hits 12975 7382 -5593
- Misses 1011 6436 +5425
- Partials 425 593 +168 ☔ View full report in Codecov by Sentry. |
This reverts commit 6ed0436.
vyper/ast/pre_parser.py
Outdated
@@ -176,7 +177,7 @@ def pre_parse(code: str) -> tuple[Settings, ModificationOffsets, dict, str]: | |||
if settings.compiler_version is not None: | |||
raise StructureException("compiler version specified twice!", start) | |||
compiler_version = contents.removeprefix("@version ").strip() | |||
validate_version_pragma(compiler_version, start) | |||
validate_version_pragma(compiler_version, line, start) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think this works if the version pragma is not on the first line?
tests/unit/ast/test_pre_parser.py
Outdated
|
||
def test_version_conflict_with_imports(make_input_bundle, mock_version): | ||
lib_version = "~=0.3.10" | ||
contract_version = "0.4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure this is necessary (it's also brittle, the test will start failing for the wrong reason after 0.4.0 release)
Co-authored-by: Charles Cooper <cooper.charles.m@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. thanks!
failing fuzz is unrelated (see #3918) |
VersionException
with source infoVersionException
with source info
this commit adds source code information to the exception thrown in `validate_version_pragma()` to improve user experience when dealing with imports with invalid (or incompatible) version pragmas.
What I did
Fix #3910.
How I did it
How to verify it
See test
Commit message
Description for the changelog
Cute Animal Picture