aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorErik Kundt <bitshift@posteo.org>2018-12-07 18:42:53 +0800
committerErik Kundt <bitshift@posteo.org>2018-12-07 19:35:35 +0800
commite2395a3dcf73b224a48e7b434b5526149d3b6254 (patch)
tree1ce16d5de82332694ab8b86839f7de9601ee0809 /test/libsolidity
parentb2afb8cdda84f7e98fbee652c130bff0d9d30023 (diff)
downloaddexon-solidity-e2395a3dcf73b224a48e7b434b5526149d3b6254.tar.gz
dexon-solidity-e2395a3dcf73b224a48e7b434b5526149d3b6254.tar.zst
dexon-solidity-e2395a3dcf73b224a48e7b434b5526149d3b6254.zip
Adds more detailed type errors and tests.
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol10
-rw-r--r--test/libsolidity/syntaxTests/types/address/address_binary_operators.sol8
-rw-r--r--test/libsolidity/syntaxTests/types/rational_number_div_limit.sol2
-rw-r--r--test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol14
-rw-r--r--test/libsolidity/syntaxTests/types/rational_number_mul_limit.sol2
5 files changed, 21 insertions, 15 deletions
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol
index c2f930b7..9d2951b8 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol
@@ -1,3 +1,9 @@
-contract test { function() external { int x = -3; int y = -4; x ** y; } }
+contract test {
+ function f() public { int x = 3; int y = 4; x ** y; }
+ function g() public { int16 x = 3; uint8 y = 4; x ** y; }
+ function h() public { uint8 x = 3; int16 y = 4; x ** y; }
+}
// ----
-// TypeError: (62-68): Operator ** not compatible with types int256 and int256. Signed exponentiation is not allowed
+// TypeError: (64-70): Operator ** not compatible with types int256 and int256. Exponentiation is not allowed for signed integer types.
+// TypeError: (126-132): Operator ** not compatible with types int16 and uint8. Exponentiation is not allowed for signed integer types.
+// TypeError: (188-194): Operator ** not compatible with types uint8 and int16. Exponentiation is not allowed for signed integer types.
diff --git a/test/libsolidity/syntaxTests/types/address/address_binary_operators.sol b/test/libsolidity/syntaxTests/types/address/address_binary_operators.sol
index ab92ab36..f721f4a9 100644
--- a/test/libsolidity/syntaxTests/types/address/address_binary_operators.sol
+++ b/test/libsolidity/syntaxTests/types/address/address_binary_operators.sol
@@ -9,7 +9,7 @@ contract C {
}
}
// ----
-// TypeError: (85-108): Operator + not compatible with types address payable and address payable. Addresses can only be compared
-// TypeError: (122-145): Operator - not compatible with types address payable and address payable. Addresses can only be compared
-// TypeError: (159-182): Operator * not compatible with types address payable and address payable. Addresses can only be compared
-// TypeError: (196-219): Operator / not compatible with types address payable and address payable. Addresses can only be compared
+// TypeError: (85-108): Operator + not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them.
+// TypeError: (122-145): Operator - not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them.
+// TypeError: (159-182): Operator * not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them.
+// TypeError: (196-219): Operator / not compatible with types address payable and address payable. Arithmetic operations on addresses are not supported. Convert to integer first before using them.
diff --git a/test/libsolidity/syntaxTests/types/rational_number_div_limit.sol b/test/libsolidity/syntaxTests/types/rational_number_div_limit.sol
index 71b736b8..31226781 100644
--- a/test/libsolidity/syntaxTests/types/rational_number_div_limit.sol
+++ b/test/libsolidity/syntaxTests/types/rational_number_div_limit.sol
@@ -5,5 +5,5 @@ contract c {
}
}
// ----
-// TypeError: (71-92): Operator / not compatible with types rational_const 1 / 5221...(1225 digits omitted)...5168 and int_const 5221...(1225 digits omitted)...5168. Precision is limited to 4096 bits
+// TypeError: (71-92): Operator / not compatible with types rational_const 1 / 5221...(1225 digits omitted)...5168 and int_const 5221...(1225 digits omitted)...5168. Precision of rational constants is limited to 4096 bits.
// TypeError: (71-92): Type rational_const 1 / 5221...(1225 digits omitted)...5168 is not implicitly convertible to expected type int256. Try converting to type ufixed8x80 or use an explicit conversion.
diff --git a/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol b/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol
index d9f89119..80b23eff 100644
--- a/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol
+++ b/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol
@@ -19,23 +19,23 @@ contract c {
}
}
// ----
-// TypeError: (71-102): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision is limited to 4096 bits
+// TypeError: (71-102): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision of rational constants is limited to 4096 bits.
// TypeError: (71-102): Type int_const 1797...(301 digits omitted)...7216 is not implicitly convertible to expected type int256.
-// TypeError: (116-148): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision is limited to 4096 bits
-// TypeError: (116-153): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision is limited to 4096 bits
+// TypeError: (116-148): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision of rational constants is limited to 4096 bits.
+// TypeError: (116-153): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4. Precision of rational constants is limited to 4096 bits.
// TypeError: (116-153): Type int_const 1797...(301 digits omitted)...7216 is not implicitly convertible to expected type int256.
// TypeError: (167-203): Operator ** not compatible with types int_const 4 and int_const -179...(302 digits omitted)...7216
// TypeError: (217-228): Operator ** not compatible with types int_const 2 and int_const 1000...(1226 digits omitted)...0000
// TypeError: (242-254): Operator ** not compatible with types int_const -2 and int_const 1000...(1226 digits omitted)...0000
// TypeError: (268-280): Operator ** not compatible with types int_const 2 and int_const -100...(1227 digits omitted)...0000
// TypeError: (294-307): Operator ** not compatible with types int_const -2 and int_const -100...(1227 digits omitted)...0000
-// TypeError: (321-332): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 2. Precision is limited to 4096 bits
+// TypeError: (321-332): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 2. Precision of rational constants is limited to 4096 bits.
// TypeError: (321-332): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256.
-// TypeError: (346-358): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 2. Precision is limited to 4096 bits
+// TypeError: (346-358): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 2. Precision of rational constants is limited to 4096 bits.
// TypeError: (346-358): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256.
-// TypeError: (372-384): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -2. Precision is limited to 4096 bits
+// TypeError: (372-384): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -2. Precision of rational constants is limited to 4096 bits.
// TypeError: (372-384): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256.
-// TypeError: (398-411): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -2. Precision is limited to 4096 bits
+// TypeError: (398-411): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -2. Precision of rational constants is limited to 4096 bits.
// TypeError: (398-411): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256.
// TypeError: (425-441): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 1000...(1226 digits omitted)...0000
// TypeError: (425-441): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256.
diff --git a/test/libsolidity/syntaxTests/types/rational_number_mul_limit.sol b/test/libsolidity/syntaxTests/types/rational_number_mul_limit.sol
index 487e7432..d725b43a 100644
--- a/test/libsolidity/syntaxTests/types/rational_number_mul_limit.sol
+++ b/test/libsolidity/syntaxTests/types/rational_number_mul_limit.sol
@@ -5,5 +5,5 @@ contract c {
}
}
// ----
-// TypeError: (71-90): Operator * not compatible with types int_const 5221...(1225 digits omitted)...5168 and int_const 5221...(1225 digits omitted)...5168. Precision is limited to 4096 bits
+// TypeError: (71-90): Operator * not compatible with types int_const 5221...(1225 digits omitted)...5168 and int_const 5221...(1225 digits omitted)...5168. Precision of rational constants is limited to 4096 bits.
// TypeError: (71-90): Type int_const 5221...(1225 digits omitted)...5168 is not implicitly convertible to expected type int256.