aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol3
-rw-r--r--test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol15
-rw-r--r--test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol1
3 files changed, 18 insertions, 1 deletions
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol
index 441cf81e..295cf4ea 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol
@@ -10,4 +10,5 @@ contract test {
}
}
// ----
-// Warning: (20-707): Function state mutability can be restricted to pure
+// TypeError: (153-250): Type rational_const 9208...(70 digits omitted)...7637 / 1000...(71 digits omitted)...0000 is not implicitly convertible to expected type ufixed256x77, but it can be explicitly converted.
+// TypeError: (470-566): Type rational_const -933...(70 digits omitted)...0123 / 1000...(70 digits omitted)...0000 is not implicitly convertible to expected type fixed256x76, but it can be explicitly converted.
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
new file mode 100644
index 00000000..ca50e03b
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol
@@ -0,0 +1,15 @@
+contract C {
+ function literalToUFixed() public pure {
+ ufixed8x2 a = 0.10;
+ ufixed8x2 b = 0.00;
+ ufixed8x2 c = 2.55;
+ a; b; c;
+ }
+ function literalToFixed() public pure {
+ fixed8x1 a = 0.1;
+ fixed8x1 b = 12.7;
+ fixed8x1 c = -12.8;
+ a; b; c;
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol b/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol
index 66bd9a8e..f86ffcdd 100644
--- a/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol
+++ b/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol
@@ -2,3 +2,4 @@ contract C {
fixed8x80 a = -1e-100;
}
// ----
+// TypeError: (29-36): Type rational_const -1 / 1000...(93 digits omitted)...0000 is not implicitly convertible to expected type fixed8x80, but it can be explicitly converted.