Merge pull request #11079 from ethereum/fix-visibility-warning

AST import: constructors have default visibility
This commit is contained in:
Harikrishnan Mulackal 2021-03-11 12:23:46 +01:00 committed by GitHub
commit 0e22d0bd40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -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.

View File

@ -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,