Skip to content

Commit

Permalink
Revert explicit evm version error message for try-catch tests in evm <
Browse files Browse the repository at this point in the history
byzantium
  • Loading branch information
r0qs committed Jan 23, 2023
1 parent 70b88f6 commit fbc36da
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 6 deletions.
8 changes: 6 additions & 2 deletions libsolidity/analysis/TypeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,9 @@ void TypeChecker::endVisit(TryStatement const& _tryStatement)
m_errorReporter.typeError(
9908_error,
clause.location(),
"This catch clause type cannot be used on the selected EVM version. You need at least a Byzantium-compatible EVM or use `catch { ... }`."
"This catch clause type cannot be used on the selected EVM version (" +
m_evmVersion.name() +
"). You need at least a Byzantium-compatible EVM or use `catch { ... }`."
);
}
}
Expand All @@ -1169,7 +1171,9 @@ void TypeChecker::endVisit(TryStatement const& _tryStatement)
m_errorReporter.typeError(
1812_error,
clause.location(),
"This catch clause type cannot be used on the selected EVM version. You need at least a Byzantium-compatible EVM or use `catch { ... }`."
"This catch clause type cannot be used on the selected EVM version (" +
m_evmVersion.name() +
"). You need at least a Byzantium-compatible EVM or use `catch { ... }`."
);

if (clause.errorName() == "Error")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ contract C {
}
}
// ====
// EVMVersion: <byzantium
// EVMVersion: =homestead
// ----
// TypeError 9908: (73-106): This catch clause type cannot be used on the selected EVM version. You need at least a Byzantium-compatible EVM or use `catch { ... }`.
// TypeError 9908: (73-106): This catch clause type cannot be used on the selected EVM version (homestead). You need at least a Byzantium-compatible EVM or use `catch { ... }`.
13 changes: 13 additions & 0 deletions test/libsolidity/syntaxTests/tryCatch/low_level_spuriousDragon.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
contract C {
function f() public {
try this.f() {

} catch (bytes memory) {

}
}
}
// ====
// EVMVersion: =spuriousDragon
// ----
// TypeError 9908: (73-106): This catch clause type cannot be used on the selected EVM version (spuriousDragon). You need at least a Byzantium-compatible EVM or use `catch { ... }`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
contract C {
function f() public {
try this.f() {

} catch (bytes memory) {

}
}
}
// ====
// EVMVersion: =tangerineWhistle
// ----
// TypeError 9908: (73-106): This catch clause type cannot be used on the selected EVM version (tangerineWhistle). You need at least a Byzantium-compatible EVM or use `catch { ... }`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ contract C {
}
}
// ====
// EVMVersion: <byzantium
// EVMVersion: =homestead
// ----
// TypeError 1812: (73-112): This catch clause type cannot be used on the selected EVM version. You need at least a Byzantium-compatible EVM or use `catch { ... }`.
// TypeError 1812: (73-112): This catch clause type cannot be used on the selected EVM version (homestead). You need at least a Byzantium-compatible EVM or use `catch { ... }`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
contract C {
function f() public {
try this.f() {

} catch Error(string memory) {

}
}
}
// ====
// EVMVersion: =spuriousDragon
// ----
// TypeError 1812: (73-112): This catch clause type cannot be used on the selected EVM version (spuriousDragon). You need at least a Byzantium-compatible EVM or use `catch { ... }`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
contract C {
function f() public {
try this.f() {

} catch Error(string memory) {

}
}
}
// ====
// EVMVersion: =tangerineWhistle
// ----
// TypeError 1812: (73-112): This catch clause type cannot be used on the selected EVM version (tangerineWhistle). You need at least a Byzantium-compatible EVM or use `catch { ... }`.

0 comments on commit fbc36da

Please sign in to comment.