aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SMTCheckerJSONTest.cpp87
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp20
-rw-r--r--test/libsolidity/syntaxTests/deprecated_functions.sol4
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/function_type_struct.sol8
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/function_type_struct_undefined_member.sol11
-rw-r--r--test/libsolidity/syntaxTests/getter/complex_struct.sol7
-rw-r--r--test/libsolidity/syntaxTests/getter/nested_structs.sol11
-rw-r--r--test/libsolidity/syntaxTests/getter/recursive_struct.sol8
-rw-r--r--test/libsolidity/syntaxTests/getter/simple_struct.sol6
-rw-r--r--test/libsolidity/syntaxTests/globalFunctions/sha3_no_call.sol8
-rw-r--r--test/libsolidity/syntaxTests/globalFunctions/sha3_override.sol11
-rw-r--r--test/libsolidity/syntaxTests/globalFunctions/sha3_var.sol9
-rw-r--r--test/libsolidity/syntaxTests/globalFunctions/suicide_no_call.sol8
-rw-r--r--test/libsolidity/syntaxTests/globalFunctions/suicide_override.sol11
-rw-r--r--test/libsolidity/syntaxTests/globalFunctions/suicide_var.sol9
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/dynamic_inline_array.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/277_dynamic_inline_array.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/269_inline_array_declaration_and_passing_implicit_conversion.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion_strings.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/270_inline_array_declaration_and_passing_implicit_conversion_strings.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_int_conversion.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/271_inline_array_declaration_const_int_conversion.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_string_conversion.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/272_inline_array_declaration_const_string_conversion.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/273_inline_array_declaration_no_type.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type_strings.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/274_inline_array_declaration_no_type_strings.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/325_inline_array_fixed_types.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/inline_array_of_mapping_type.sol8
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/326_inline_array_rationals.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/invalid_types_in_inline_array.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/276_invalid_types_in_inline_array.sol)0
-rw-r--r--test/libsolidity/syntaxTests/inline_arrays/lvalues_as_inline_array.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/278_lvalues_as_inline_array.sol)0
-rw-r--r--test/libsolidity/syntaxTests/memberLookup/internal_function_type.sol7
28 files changed, 200 insertions, 33 deletions
diff --git a/test/libsolidity/SMTCheckerJSONTest.cpp b/test/libsolidity/SMTCheckerJSONTest.cpp
index 6e1329a9..e9204cc4 100644
--- a/test/libsolidity/SMTCheckerJSONTest.cpp
+++ b/test/libsolidity/SMTCheckerJSONTest.cpp
@@ -38,11 +38,15 @@ using namespace boost::unit_test;
SMTCheckerTest::SMTCheckerTest(string const& _filename)
: SyntaxTest(_filename)
{
- BOOST_REQUIRE_MESSAGE(boost::algorithm::ends_with(_filename, ".sol"), "Invalid test contract file name: \"" + _filename + "\".");
+ if (!boost::algorithm::ends_with(_filename, ".sol"))
+ BOOST_THROW_EXCEPTION(runtime_error("Invalid test contract file name: \"" + _filename + "\"."));
string jsonFilename = _filename.substr(0, _filename.size() - 4) + ".json";
- BOOST_CHECK(jsonParseFile(jsonFilename, m_smtResponses));
- BOOST_CHECK(m_smtResponses.isObject());
+ if (
+ !jsonParseFile(jsonFilename, m_smtResponses) ||
+ !m_smtResponses.isObject()
+ )
+ BOOST_THROW_EXCEPTION(runtime_error("Invalid JSON file."));
}
bool SMTCheckerTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
@@ -59,42 +63,62 @@ bool SMTCheckerTest::run(ostream& _stream, string const& _linePrefix, bool const
// This is the list of responses provided in the test
string auxInput("auxiliaryInput");
- BOOST_CHECK(m_smtResponses.isMember(auxInput));
+ if (!m_smtResponses.isMember(auxInput))
+ BOOST_THROW_EXCEPTION(runtime_error("JSON file does not contain field \"auxiliaryInput\"."));
+
vector<string> inHashes = hashesFromJson(m_smtResponses, auxInput, "smtlib2responses");
// Ensure that the provided list matches the requested one
- BOOST_CHECK_MESSAGE(
- outHashes == inHashes,
- "SMT query hashes differ: " + boost::algorithm::join(outHashes, ", ") + " x " + boost::algorithm::join(inHashes, ", ")
- );
+ if (outHashes != inHashes)
+ BOOST_THROW_EXCEPTION(runtime_error(
+ "SMT query hashes differ: " +
+ boost::algorithm::join(outHashes, ", ") +
+ " x " +
+ boost::algorithm::join(inHashes, ", ")
+ ));
// Rerun the compiler with the provided hashed (2nd run)
input[auxInput] = m_smtResponses[auxInput];
Json::Value endResult = compiler.compile(input);
- BOOST_CHECK(endResult.isMember("errors"));
- Json::Value const& errors = endResult["errors"];
- for (auto const& error: errors)
+ if (endResult.isMember("errors") && endResult["errors"].isArray())
{
- BOOST_CHECK(error.isMember("type") && error["type"].isString());
- BOOST_CHECK(error.isMember("message") && error["message"].isString());
- if (!error.isMember("sourceLocation"))
- continue;
- Json::Value const& location = error["sourceLocation"];
- BOOST_CHECK(location.isMember("start") && location["start"].isInt());
- BOOST_CHECK(location.isMember("end") && location["end"].isInt());
- int start = location["start"].asInt();
- int end = location["end"].asInt();
- if (start >= static_cast<int>(versionPragma.size()))
- start -= versionPragma.size();
- if (end >= static_cast<int>(versionPragma.size()))
- end -= versionPragma.size();
- m_errorList.emplace_back(SyntaxTestError{
- error["type"].asString(),
- error["message"].asString(),
- start,
- end
- });
+ Json::Value const& errors = endResult["errors"];
+ for (auto const& error: errors)
+ {
+ if (
+ !error.isMember("type") ||
+ !error["type"].isString()
+ )
+ BOOST_THROW_EXCEPTION(runtime_error("Error must have a type."));
+ if (
+ !error.isMember("message") ||
+ !error["message"].isString()
+ )
+ BOOST_THROW_EXCEPTION(runtime_error("Error must have a message."));
+ if (!error.isMember("sourceLocation"))
+ continue;
+ Json::Value const& location = error["sourceLocation"];
+ if (
+ !location.isMember("start") ||
+ !location["start"].isInt() ||
+ !location.isMember("end") ||
+ !location["end"].isInt()
+ )
+ BOOST_THROW_EXCEPTION(runtime_error("Error must have a SourceLocation with start and end."));
+ int start = location["start"].asInt();
+ int end = location["end"].asInt();
+ if (start >= static_cast<int>(versionPragma.size()))
+ start -= versionPragma.size();
+ if (end >= static_cast<int>(versionPragma.size()))
+ end -= versionPragma.size();
+ m_errorList.emplace_back(SyntaxTestError{
+ error["type"].asString(),
+ error["message"].asString(),
+ start,
+ end
+ });
+ }
}
return printExpectationAndError(_stream, _linePrefix, _formatted);
@@ -123,6 +147,7 @@ Json::Value SMTCheckerTest::buildJson(string const& _extra)
string sources = " \"sources\": { " + sourceName + ": " + sourceObj + "}";
string input = "{" + language + ", " + sources + "}";
Json::Value source;
- BOOST_REQUIRE(jsonParse(input, source));
+ if (!jsonParse(input, source))
+ BOOST_THROW_EXCEPTION(runtime_error("Could not build JSON from string."));
return source;
}
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 05bb7446..c6135a72 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -14213,6 +14213,26 @@ BOOST_AUTO_TEST_CASE(external_public_override)
ABI_CHECK(callContractFunction("f()"), encodeArgs(2));
ABI_CHECK(callContractFunction("g()"), encodeArgs(2));
}
+
+BOOST_AUTO_TEST_CASE(base_access_to_function_type_variables)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function () internal returns (uint) x;
+ function set() public {
+ C.x = g;
+ }
+ function g() public pure returns (uint) { return 2; }
+ function h() public returns (uint) { return C.x(); }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("g()"), encodeArgs(2));
+ ABI_CHECK(callContractFunction("h()"), encodeArgs());
+ ABI_CHECK(callContractFunction("set()"), encodeArgs());
+ ABI_CHECK(callContractFunction("h()"), encodeArgs(2));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}
diff --git a/test/libsolidity/syntaxTests/deprecated_functions.sol b/test/libsolidity/syntaxTests/deprecated_functions.sol
index 62dfcff9..c5764e96 100644
--- a/test/libsolidity/syntaxTests/deprecated_functions.sol
+++ b/test/libsolidity/syntaxTests/deprecated_functions.sol
@@ -8,5 +8,5 @@ contract test {
}
}
// ----
-// TypeError: (58-66): "sha3" has been deprecated in favour of "keccak256"
-// TypeError: (101-152): "suicide" has been deprecated in favour of "selfdestruct"
+// TypeError: (58-62): "sha3" has been deprecated in favour of "keccak256"
+// TypeError: (101-108): "suicide" has been deprecated in favour of "selfdestruct"
diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_struct.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_struct.sol
new file mode 100644
index 00000000..a367996e
--- /dev/null
+++ b/test/libsolidity/syntaxTests/functionTypes/function_type_struct.sol
@@ -0,0 +1,8 @@
+library L
+{
+ struct Nested
+ {
+ uint y;
+ }
+ function f(function(Nested memory) external) external pure {}
+}
diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_struct_undefined_member.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_struct_undefined_member.sol
new file mode 100644
index 00000000..ca08afe5
--- /dev/null
+++ b/test/libsolidity/syntaxTests/functionTypes/function_type_struct_undefined_member.sol
@@ -0,0 +1,11 @@
+library L
+{
+ struct Nested
+ {
+ Non y;
+ }
+ function f(function(Nested memory) external) external pure {}
+}
+// ----
+// DeclarationError: (32-35): Identifier not found or not unique.
+// TypeError: (63-76): Internal type cannot be used for external function type.
diff --git a/test/libsolidity/syntaxTests/getter/complex_struct.sol b/test/libsolidity/syntaxTests/getter/complex_struct.sol
new file mode 100644
index 00000000..3fa8111c
--- /dev/null
+++ b/test/libsolidity/syntaxTests/getter/complex_struct.sol
@@ -0,0 +1,7 @@
+contract C {
+ struct Y {
+ uint a;
+ uint b;
+ }
+ mapping(uint256 => Y) public m;
+}
diff --git a/test/libsolidity/syntaxTests/getter/nested_structs.sol b/test/libsolidity/syntaxTests/getter/nested_structs.sol
new file mode 100644
index 00000000..1068f287
--- /dev/null
+++ b/test/libsolidity/syntaxTests/getter/nested_structs.sol
@@ -0,0 +1,11 @@
+contract C {
+ struct Y {
+ uint b;
+ }
+ struct X {
+ Y a;
+ }
+ mapping(uint256 => X) public m;
+}
+// ----
+// TypeError: (88-118): The following types are only supported for getters in the new experimental ABI encoder: struct C.Y memory. Either remove "public" or use "pragma experimental ABIEncoderV2;" to enable the feature.
diff --git a/test/libsolidity/syntaxTests/getter/recursive_struct.sol b/test/libsolidity/syntaxTests/getter/recursive_struct.sol
new file mode 100644
index 00000000..d81cac60
--- /dev/null
+++ b/test/libsolidity/syntaxTests/getter/recursive_struct.sol
@@ -0,0 +1,8 @@
+contract C {
+ struct Y {
+ Y[] x;
+ }
+ mapping(uint256 => Y) public m;
+}
+// ----
+// TypeError: (53-83): Internal or recursive type is not allowed for public state variables.
diff --git a/test/libsolidity/syntaxTests/getter/simple_struct.sol b/test/libsolidity/syntaxTests/getter/simple_struct.sol
new file mode 100644
index 00000000..c7a23ae9
--- /dev/null
+++ b/test/libsolidity/syntaxTests/getter/simple_struct.sol
@@ -0,0 +1,6 @@
+contract C {
+ struct Y {
+ uint b;
+ }
+ mapping(uint256 => Y) public m;
+}
diff --git a/test/libsolidity/syntaxTests/globalFunctions/sha3_no_call.sol b/test/libsolidity/syntaxTests/globalFunctions/sha3_no_call.sol
new file mode 100644
index 00000000..37b60e5e
--- /dev/null
+++ b/test/libsolidity/syntaxTests/globalFunctions/sha3_no_call.sol
@@ -0,0 +1,8 @@
+contract C
+{
+ function f(bytes memory data) public pure {
+ sha3;
+ }
+}
+// ----
+// TypeError: (60-64): "sha3" has been deprecated in favour of "keccak256"
diff --git a/test/libsolidity/syntaxTests/globalFunctions/sha3_override.sol b/test/libsolidity/syntaxTests/globalFunctions/sha3_override.sol
new file mode 100644
index 00000000..909c2dc3
--- /dev/null
+++ b/test/libsolidity/syntaxTests/globalFunctions/sha3_override.sol
@@ -0,0 +1,11 @@
+contract C
+{
+ function sha3() public pure returns (bool) {
+ return true;
+ }
+ function f() public pure returns (bool) {
+ return sha3();
+ }
+}
+// ----
+// Warning: (14-76): This declaration shadows a builtin symbol.
diff --git a/test/libsolidity/syntaxTests/globalFunctions/sha3_var.sol b/test/libsolidity/syntaxTests/globalFunctions/sha3_var.sol
new file mode 100644
index 00000000..19ee72d9
--- /dev/null
+++ b/test/libsolidity/syntaxTests/globalFunctions/sha3_var.sol
@@ -0,0 +1,9 @@
+contract C
+{
+ function f() public pure returns (bool) {
+ bool sha3 = true;
+ return sha3;
+ }
+}
+// ----
+// Warning: (58-67): This declaration shadows a builtin symbol.
diff --git a/test/libsolidity/syntaxTests/globalFunctions/suicide_no_call.sol b/test/libsolidity/syntaxTests/globalFunctions/suicide_no_call.sol
new file mode 100644
index 00000000..bf3f5ebc
--- /dev/null
+++ b/test/libsolidity/syntaxTests/globalFunctions/suicide_no_call.sol
@@ -0,0 +1,8 @@
+contract C
+{
+ function f(bytes memory data) public pure {
+ suicide;
+ }
+}
+// ----
+// TypeError: (60-67): "suicide" has been deprecated in favour of "selfdestruct"
diff --git a/test/libsolidity/syntaxTests/globalFunctions/suicide_override.sol b/test/libsolidity/syntaxTests/globalFunctions/suicide_override.sol
new file mode 100644
index 00000000..7350da39
--- /dev/null
+++ b/test/libsolidity/syntaxTests/globalFunctions/suicide_override.sol
@@ -0,0 +1,11 @@
+contract C
+{
+ function suicide() public pure returns (bool) {
+ return true;
+ }
+ function f() public pure returns (bool) {
+ return suicide();
+ }
+}
+// ----
+// Warning: (14-79): This declaration shadows a builtin symbol.
diff --git a/test/libsolidity/syntaxTests/globalFunctions/suicide_var.sol b/test/libsolidity/syntaxTests/globalFunctions/suicide_var.sol
new file mode 100644
index 00000000..3549a563
--- /dev/null
+++ b/test/libsolidity/syntaxTests/globalFunctions/suicide_var.sol
@@ -0,0 +1,9 @@
+contract C
+{
+ function f() public pure returns (bool) {
+ bool suicide = true;
+ return suicide;
+ }
+}
+// ----
+// Warning: (58-70): This declaration shadows a builtin symbol.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/277_dynamic_inline_array.sol b/test/libsolidity/syntaxTests/inline_arrays/dynamic_inline_array.sol
index e613758b..e613758b 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/277_dynamic_inline_array.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/dynamic_inline_array.sol
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/269_inline_array_declaration_and_passing_implicit_conversion.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion.sol
index 023404f7..023404f7 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/269_inline_array_declaration_and_passing_implicit_conversion.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion.sol
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/270_inline_array_declaration_and_passing_implicit_conversion_strings.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion_strings.sol
index 025244d3..025244d3 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/270_inline_array_declaration_and_passing_implicit_conversion_strings.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_and_passing_implicit_conversion_strings.sol
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/271_inline_array_declaration_const_int_conversion.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_int_conversion.sol
index e7036bdf..e7036bdf 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/271_inline_array_declaration_const_int_conversion.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_int_conversion.sol
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/272_inline_array_declaration_const_string_conversion.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_string_conversion.sol
index 4e92f6e1..4e92f6e1 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/272_inline_array_declaration_const_string_conversion.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_const_string_conversion.sol
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/273_inline_array_declaration_no_type.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type.sol
index 4d3e6aed..4d3e6aed 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/273_inline_array_declaration_no_type.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type.sol
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/274_inline_array_declaration_no_type_strings.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type_strings.sol
index 6d36942d..6d36942d 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/274_inline_array_declaration_no_type_strings.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_declaration_no_type_strings.sol
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/325_inline_array_fixed_types.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol
index c46297c3..c46297c3 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/325_inline_array_fixed_types.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol
diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_of_mapping_type.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_of_mapping_type.sol
new file mode 100644
index 00000000..59a88130
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_of_mapping_type.sol
@@ -0,0 +1,8 @@
+contract C {
+ mapping(int => int) a;
+ function f() public {
+ [a];
+ }
+}
+// ----
+// TypeError: (66-69): Type mapping(int256 => int256) is only valid in storage.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/326_inline_array_rationals.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol
index bdc3c2c1..bdc3c2c1 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/326_inline_array_rationals.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/276_invalid_types_in_inline_array.sol b/test/libsolidity/syntaxTests/inline_arrays/invalid_types_in_inline_array.sol
index 03d7266a..03d7266a 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/276_invalid_types_in_inline_array.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/invalid_types_in_inline_array.sol
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/278_lvalues_as_inline_array.sol b/test/libsolidity/syntaxTests/inline_arrays/lvalues_as_inline_array.sol
index 5a39f550..5a39f550 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/278_lvalues_as_inline_array.sol
+++ b/test/libsolidity/syntaxTests/inline_arrays/lvalues_as_inline_array.sol
diff --git a/test/libsolidity/syntaxTests/memberLookup/internal_function_type.sol b/test/libsolidity/syntaxTests/memberLookup/internal_function_type.sol
new file mode 100644
index 00000000..560a6c2a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/memberLookup/internal_function_type.sol
@@ -0,0 +1,7 @@
+contract C {
+ function () internal returns (uint) x;
+ constructor() public {
+ C.x = g;
+ }
+ function g() public pure returns (uint) {}
+}