-
Notifications
You must be signed in to change notification settings - Fork 6k
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
ICE in StructType::isDynamicallyEncoded() when a function has a calldata struct argument with an internal type inside :: Issue 11610 #12266
Conversation
…06. Test file added in test/libsolidity/syntaxTests/calldata_struct_argument_with_internal_type_inside.sol
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.
Congrats on the first PR!
I added some remarks for specific places in code in the comments below. Here are some general ones:
- I'd avoid making PRs from
develop
branch in your fork. It just makes it harder to update it or make multiple PRs. Please use named branches instead. - Please use some sensible title for the PR (and a similar name for the branch). We generally don't know all issue numbers by heart so it's hard to say what it's about without looking it up :P In branch names the issue number also would make it annoying to type on the CLI because you have to type the number before you get autocompletion. Also no need to say "Draft" in the title.
@@ -29,6 +29,7 @@ Bugfixes: | |||
* TypeChecker: Improved error message for constant variables with (nested) mapping types. | |||
* Yul Assembler: Fix internal error when function names are not unique. | |||
* Yul IR Generator: Do not output empty switches/if-bodies for empty contracts. | |||
* ICE in StructType::isDynamicallyEncoded() when a function has a calldata struct argument with an internal type inside |
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.
Please rebase on latest develop
. We have just relased 0.8.10 yesterday so this should be in the 0.8.11 section :)
contract C { | ||
struct S { | ||
function() a; | ||
} | ||
function f(S[2] calldata) {} | ||
} |
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.
contract C { | |
struct S { | |
function() a; | |
} | |
function f(S[2] calldata) {} | |
} | |
contract C { | |
struct S { | |
function() a; | |
} | |
function f(S[2] calldata) {} | |
} |
@@ -0,0 +1,9 @@ | |||
contract C { |
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.
Unless the test is really unique in some way, I think it would be better to find a subdirectory where it fits best instead of dropping it directly into syntaxTests/
.
I'd place it next to the test from #10516.
@@ -29,6 +29,7 @@ Bugfixes: | |||
* TypeChecker: Improved error message for constant variables with (nested) mapping types. | |||
* Yul Assembler: Fix internal error when function names are not unique. | |||
* Yul IR Generator: Do not output empty switches/if-bodies for empty contracts. | |||
* ICE in StructType::isDynamicallyEncoded() when a function has a calldata struct argument with an internal type inside |
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.
Does it happen for calldata
structs or only for arrays of structs? Can you add a test case covering single structs (unless there's one already, please check)?
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.
@@ -387,7 +387,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function) | |||
_var.referenceLocation() == VariableDeclaration::Location::Storage && | |||
!m_currentContract->abstract() | |||
) | |||
m_errorReporter.typeError( | |||
m_errorReporter.fatalTypeError( |
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.
This generally seems fine to me but please check if it shouldn't rather be fixed in the same place as #11000 instead.
About your question from the call: you need to update test expectations ( |
function f(S[2] calldata) {} | ||
} | ||
// ---- | ||
// SyntaxError 4937: (50-78): No visibility specified. Did you intend to add "public"? |
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.
Please make the function public (function <functionName>() public ...
) so that this error goes away - it is not relevant for the test.
TypeChecker.cpp :: Replced typeError with fataTypeError in lines 390 and 406.
Test file added in test/libsolidity/syntaxTests/calldata_struct_argument_with_internal_type_inside.sol
Relevant line added to Changelog.md
Closes #11610