Skip to content

Commit

Permalink
Merge pull request ethereum#11079 from ethereum/fix-visibility-warning
Browse files Browse the repository at this point in the history
AST import: constructors have default visibility
  • Loading branch information
hrkrshnn authored Mar 11, 2021
2 parents dd0f5be + ef0c4cc commit 0e22d0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Compiler Features:


Bugfixes:
* AST Import: For constructors, a public visibility is ignored during importing.
* Error Reporter: Fix handling of carriage return.
* SMTChecker: Fix internal error on ``array.pop`` nested inside 1-tuple.
* SMTChecker: Fix internal error on ``FixedBytes`` constant initialized with string literal.
Expand Down
5 changes: 4 additions & 1 deletion libsolidity/ast/ASTJsonImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,10 @@ ASTPointer<FunctionDefinition> ASTJsonImporter::createFunctionDefinition(Json::V
modifiers.push_back(createModifierInvocation(mod));

Visibility vis = Visibility::Default;
if (!freeFunction)
// Ignore public visibility for constructors
if (kind == Token::Constructor)
vis = (visibility(_node) == Visibility::Public) ? Visibility::Default : visibility(_node);
else if (!freeFunction)
vis = visibility(_node);
return createASTNode<FunctionDefinition>(
_node,
Expand Down

0 comments on commit 0e22d0b

Please sign in to comment.