mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #14087 from ethereum/better-error-for-invalid-call
Better error message when trying to call things that are not functions
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
enum E { A, B, C }
|
||||
|
||||
contract C {
|
||||
uint a = E.B(1000);
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (46-55): Enum is not callable.
|
||||
@@ -5,4 +5,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (53-60): Type is not callable
|
||||
// TypeError 5704: (53-60): Rational number literal is not callable.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
uint a = msg(1000);
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (26-35): Magic variable is not callable.
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
mapping (uint => uint) m;
|
||||
uint a = m(1000);
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (56-63): Mapping is not callable.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
uint a = m(1000);
|
||||
|
||||
modifier m(uint) { _; }
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (26-33): Modifier is not callable.
|
||||
@@ -0,0 +1,9 @@
|
||||
==== Source: A.sol ====
|
||||
==== Source: B.sol ====
|
||||
import "A.sol" as A;
|
||||
|
||||
contract C {
|
||||
uint a = A(1000);
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (B.sol:48-55): Module is not callable.
|
||||
@@ -6,4 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (72-78): Type is not callable
|
||||
// TypeError 5704: (72-78): Contract is not callable.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (90-108): Type is not callable
|
||||
// TypeError 5704: (90-108): Rational number literal is not callable.
|
||||
|
||||
+1
-1
@@ -6,4 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (153-157): Type is not callable
|
||||
// TypeError 5704: (153-157): Mapping is not callable.
|
||||
|
||||
+1
-1
@@ -11,4 +11,4 @@ contract SomeContract {
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 2333: (106-145): Identifier already declared.
|
||||
// TypeError 5704: (185-195): Type is not callable
|
||||
// TypeError 5704: (185-195): Integer is not callable.
|
||||
|
||||
@@ -7,4 +7,4 @@ contract CrashContract {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (170-177): Type is not callable
|
||||
// TypeError 5704: (170-177): Rational number literal is not callable.
|
||||
|
||||
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (59-63): Type is not callable
|
||||
// TypeError 5704: (59-63): Rational number literal is not callable.
|
||||
|
||||
Reference in New Issue
Block a user