From 4a65c5ebaa2f0c40e3a86a4349067820312e92e7 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 16 Aug 2019 15:53:10 +0200 Subject: [PATCH] Compile succeeding syntax tests. --- test/libsolidity/SyntaxTest.cpp | 16 +++++++++++++++- .../syntaxTests/constants/mod_div_rational.sol | 2 ++ .../inline_arrays/inline_array_fixed_types.sol | 1 + .../inline_arrays/inline_array_rationals.sol | 1 + .../303_fixed_type_int_conversion.sol | 1 + .../304_fixed_type_rational_int_conversion.sol | 1 + ...5_fixed_type_rational_fraction_conversion.sol | 1 + .../307_rational_unary_minus_operation.sol | 2 ++ .../312_leading_zero_rationals_convert.sol | 2 ++ .../314_fixed_type_zero_handling.sol | 1 + ...317_fixed_type_valid_explicit_conversions.sol | 1 + .../323_mapping_with_fixed_literal.sol | 2 ++ .../324_fixed_points_inside_structs.sol | 2 ++ .../328_rational_to_fixed_literal_expression.sol | 1 + .../343_integer_and_fixed_interaction.sol | 1 + .../declaring_fixed_and_ufixed_variables.sol | 1 + .../lexer_numbers_with_underscores_fixed.sol | 1 + .../syntaxTests/signed_rational_modulus.sol | 2 ++ ...rational_number_literal_to_fixed_implicit.sol | 1 + 19 files changed, 39 insertions(+), 1 deletion(-) diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp index 45ca1e81d..d177d29e8 100644 --- a/test/libsolidity/SyntaxTest.cpp +++ b/test/libsolidity/SyntaxTest.cpp @@ -83,7 +83,21 @@ TestCase::TestResult SyntaxTest::run(ostream& _stream, string const& _linePrefix OptimiserSettings::minimal() ); if (compiler().parse()) - compiler().analyze(); + if (compiler().analyze()) + try + { + if (!compiler().compile()) + BOOST_THROW_EXCEPTION(runtime_error("Compilation failed even though analysis was successful.")); + } + catch (UnimplementedFeatureError const& _e) + { + m_errorList.emplace_back(SyntaxTestError{ + "UnimplementedFeatureError", + errorMessage(_e), + -1, + -1 + }); + } for (auto const& currentError: filterErrors(compiler().errors(), true)) { diff --git a/test/libsolidity/syntaxTests/constants/mod_div_rational.sol b/test/libsolidity/syntaxTests/constants/mod_div_rational.sol index f8b6ce313..d983fa1ee 100644 --- a/test/libsolidity/syntaxTests/constants/mod_div_rational.sol +++ b/test/libsolidity/syntaxTests/constants/mod_div_rational.sol @@ -4,3 +4,5 @@ contract C { fixed a3 = 0 / 0.123; fixed a4 = 0 / -0.123; } +// ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol index c46297c3f..7aef51a91 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol @@ -4,5 +4,6 @@ contract test { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (50-67): Unused local variable. // Warning: (20-119): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol index bdc3c2c14..a46db5a60 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol @@ -4,5 +4,6 @@ contract test { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (50-73): Unused local variable. // Warning: (20-118): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol index ddf1e5fb0..6ef5da3bb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol @@ -8,4 +8,5 @@ contract test { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (20-147): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol index 16d2cbad2..e046df6ba 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol @@ -6,4 +6,5 @@ contract test { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (20-104): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol index 270298601..f971dc299 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol @@ -6,4 +6,5 @@ contract test { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (20-108): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/307_rational_unary_minus_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/307_rational_unary_minus_operation.sol index 7827e57bf..b8b2f12b5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/307_rational_unary_minus_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/307_rational_unary_minus_operation.sol @@ -5,3 +5,5 @@ contract test { a; b; } } +// ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/312_leading_zero_rationals_convert.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/312_leading_zero_rationals_convert.sol index 9fe7c6f7e..082514ebc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/312_leading_zero_rationals_convert.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/312_leading_zero_rationals_convert.sol @@ -7,3 +7,5 @@ contract A { a; b; c; d; } } +// ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol index 5f0d2909f..be6395792 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol @@ -5,4 +5,5 @@ contract test { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (20-104): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol index 388014579..46750a533 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol @@ -6,4 +6,5 @@ contract test { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (20-182): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/323_mapping_with_fixed_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/323_mapping_with_fixed_literal.sol index 8e28d4e1f..20ebcb1fe 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/323_mapping_with_fixed_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/323_mapping_with_fixed_literal.sol @@ -4,3 +4,5 @@ contract test { fixedString[0.5] = "Half"; } } +// ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/324_fixed_points_inside_structs.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/324_fixed_points_inside_structs.sol index 8aa0abc2b..24a090127 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/324_fixed_points_inside_structs.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/324_fixed_points_inside_structs.sol @@ -5,3 +5,5 @@ contract test { } myStruct a = myStruct(3.125, 3); } +// ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol index 35456fa6f..8582cc089 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol @@ -11,5 +11,6 @@ contract test { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (238-252): This declaration shadows an existing declaration. // Warning: (20-339): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol index af4d048bb..3b7c273bd 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol @@ -4,5 +4,6 @@ contract test { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (50-58): Unused local variable. // Warning: (20-89): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol b/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol index 6d88669af..2cbf29e0d 100644 --- a/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol @@ -6,6 +6,7 @@ contract A { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. // Warning: (52-60): Unused function parameter. Remove or comment out the variable name to silence this warning. // Warning: (62-74): Unused function parameter. Remove or comment out the variable name to silence this warning. // Warning: (93-104): Unused local variable. diff --git a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed.sol b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed.sol index 4910ee829..00ed4f654 100644 --- a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed.sol +++ b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed.sol @@ -7,3 +7,4 @@ contract C { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. diff --git a/test/libsolidity/syntaxTests/signed_rational_modulus.sol b/test/libsolidity/syntaxTests/signed_rational_modulus.sol index b37d33d0c..d01d2fabf 100644 --- a/test/libsolidity/syntaxTests/signed_rational_modulus.sol +++ b/test/libsolidity/syntaxTests/signed_rational_modulus.sol @@ -6,3 +6,5 @@ contract test { a; b; c; } } +// ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType. diff --git a/test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol b/test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol index ca50e03be..5bceec609 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol @@ -13,3 +13,4 @@ contract C { } } // ---- +// UnimplementedFeatureError: Not yet implemented - FixedPointType.