Fix handling of carriage return.

This commit is contained in:
chriseth 2021-03-09 11:34:01 +01:00
parent 1d95f95635
commit eb85a4414c
7 changed files with 16 additions and 3 deletions

View File

@ -7,6 +7,7 @@ Compiler Features:
Bugfixes:
* Error Reporter: Fix handling of carriage return.
* SMTChecker: Fix internal error on ``FixedBytes`` constant initialized with string literal.
* SMTChecker: Fix internal error on calling public getter on a state variable of type array (possibly nested) of structs.
* SMTChecker: Fix internal error on pushing to ``string`` casted to ``bytes``.

View File

@ -19,6 +19,7 @@
#include <liblangutil/CharStream.h>
#include <liblangutil/Exceptions.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
@ -87,7 +88,7 @@ SourceReference SourceReferenceExtractor::extract(SourceLocation const* _locatio
line = line.substr(
static_cast<size_t>(max(0, start.column - 35)),
static_cast<size_t>(min(start.column, 35)) + static_cast<size_t>(
min(locationLength + 35,len - start.column)
min(locationLength + 35, len - start.column)
)
);
if (start.column + locationLength + 35 < len)
@ -106,7 +107,7 @@ SourceReference SourceReferenceExtractor::extract(SourceLocation const* _locatio
interest,
isMultiline,
line,
start.column,
end.column,
min(start.column, static_cast<int>(line.length())),
min(end.column, static_cast<int>(line.length()))
};
}

View File

@ -6,6 +6,8 @@ ERROR_LOG="$(mktemp -t check_style_XXXXXX.log)"
EXCLUDE_FILES=(
"libsolutil/picosha2.h"
"test/cmdlineTests/strict_asm_only_cr/input.yul"
"test/cmdlineTests/strict_asm_only_cr/err"
"test/libsolutil/UTF8.cpp"
"test/libsolidity/syntaxTests/license/license_cr_endings.sol"
"test/libsolidity/syntaxTests/license/license_crlf_endings.sol"

View File

@ -0,0 +1 @@
--strict-assembly

View File

@ -0,0 +1,6 @@
Warning: Yul is still experimental. Please use the output with care.
Error: Expected keyword "object".
--> strict_asm_only_cr/input.yul:1:2:
|
1 |
| ^

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@