Add test for the unused const warning
This commit is contained in:
parent
be7133dec7
commit
e756f935f2
@ -289,7 +289,9 @@ warnings() ->
|
||||
<<?PosW(60, 5)
|
||||
"The function `dec` is defined but never used.">>,
|
||||
<<?PosW(73, 9)
|
||||
"The definition of `const` shadows an older definition at line 70, column 3.">>
|
||||
"The definition of `const` shadows an older definition at line 70, column 3.">>,
|
||||
<<?PosW(84, 7)
|
||||
"The constant `c` is defined but never used.">>
|
||||
]).
|
||||
|
||||
failing_contracts() ->
|
||||
@ -860,7 +862,9 @@ failing_contracts() ->
|
||||
<<?Pos(60, 5)
|
||||
"The function `dec` is defined but never used.">>,
|
||||
<<?Pos(73, 9)
|
||||
"The definition of `const` shadows an older definition at line 70, column 3.">>
|
||||
"The definition of `const` shadows an older definition at line 70, column 3.">>,
|
||||
<<?Pos(84, 7)
|
||||
"The constant `c` is defined but never used.">>
|
||||
])
|
||||
, ?TYPE_ERROR(polymorphism_contract_interface_recursive,
|
||||
[<<?Pos(1,24)
|
||||
|
@ -72,3 +72,17 @@ namespace ShadowingConst =
|
||||
function f() =
|
||||
let const = 2
|
||||
const
|
||||
|
||||
namespace UnusedConstNamespace =
|
||||
// No warnings should be shown even though const is not used
|
||||
let const = 1
|
||||
|
||||
contract UnusedConstContract =
|
||||
// Only `c` should show a warning because it is never used in the contract
|
||||
let a = 1
|
||||
let b = 2
|
||||
let c = 3
|
||||
|
||||
entrypoint f() =
|
||||
// Both normal access and qualified access should prevent the unused const warning
|
||||
a + UnusedConstContract.b
|
||||
|
Loading…
x
Reference in New Issue
Block a user