diff --git a/Changelog.md b/Changelog.md index 223c692dd..705c2d2ca 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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``. diff --git a/liblangutil/SourceReferenceExtractor.cpp b/liblangutil/SourceReferenceExtractor.cpp index 2faefc9b0..d362755ba 100644 --- a/liblangutil/SourceReferenceExtractor.cpp +++ b/liblangutil/SourceReferenceExtractor.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -87,7 +88,7 @@ SourceReference SourceReferenceExtractor::extract(SourceLocation const* _locatio line = line.substr( static_cast(max(0, start.column - 35)), static_cast(min(start.column, 35)) + static_cast( - 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(line.length())), + min(end.column, static_cast(line.length())) }; } diff --git a/scripts/check_style.sh b/scripts/check_style.sh index 5c423230c..f3e00d8ed 100755 --- a/scripts/check_style.sh +++ b/scripts/check_style.sh @@ -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" diff --git a/test/cmdlineTests/strict_asm_only_cr/args b/test/cmdlineTests/strict_asm_only_cr/args new file mode 100644 index 000000000..2c89c24e0 --- /dev/null +++ b/test/cmdlineTests/strict_asm_only_cr/args @@ -0,0 +1 @@ +--strict-assembly diff --git a/test/cmdlineTests/strict_asm_only_cr/err b/test/cmdlineTests/strict_asm_only_cr/err new file mode 100644 index 000000000..62ebc300d --- /dev/null +++ b/test/cmdlineTests/strict_asm_only_cr/err @@ -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 | + | ^ diff --git a/test/cmdlineTests/strict_asm_only_cr/exit b/test/cmdlineTests/strict_asm_only_cr/exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/test/cmdlineTests/strict_asm_only_cr/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/strict_asm_only_cr/input.yul b/test/cmdlineTests/strict_asm_only_cr/input.yul new file mode 100644 index 000000000..67c329761 --- /dev/null +++ b/test/cmdlineTests/strict_asm_only_cr/input.yul @@ -0,0 +1 @@ + \ No newline at end of file