From 1ce9566e504f3ce14978a9df5e8b37b74e6f621e Mon Sep 17 00:00:00 2001 From: mestorlx Date: Thu, 11 Oct 2018 18:21:49 -0300 Subject: Updated MAXIMUM_STRING_DISTANCE to non static maximumStringDistance taking into account length of the identifier --- .../580_improve_name_suggestion_one_and_two_letters.sol | 14 ++++++++++++++ .../581_improve_name_suggestion_three_letters.sol | 12 ++++++++++++ .../582_improve_name_suggestion_four_letters.sol | 17 +++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/580_improve_name_suggestion_one_and_two_letters.sol create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/581_improve_name_suggestion_three_letters.sol create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/582_improve_name_suggestion_four_letters.sol (limited to 'test/libsolidity') diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/580_improve_name_suggestion_one_and_two_letters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/580_improve_name_suggestion_one_and_two_letters.sol new file mode 100644 index 00000000..8d2d071b --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/580_improve_name_suggestion_one_and_two_letters.sol @@ -0,0 +1,14 @@ +contract c { + function f () public + { + a = ac; + a = cd; + a = b; + } + uint256 a; + uint256 ab; +} +// ---- +// DeclarationError: (56-58): Undeclared identifier. Did you mean "ab"? +// DeclarationError: (72-74): Undeclared identifier. +// DeclarationError: (88-89): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/581_improve_name_suggestion_three_letters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/581_improve_name_suggestion_three_letters.sol new file mode 100644 index 00000000..69f5a7e2 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/581_improve_name_suggestion_three_letters.sol @@ -0,0 +1,12 @@ +contract c { + function f () public + { + a = abd; + a = ade; + } + uint256 a; + uint256 abc; +} +// ---- +// DeclarationError: (56-59): Undeclared identifier. Did you mean "abc" or "abi"? +// DeclarationError: (73-76): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/582_improve_name_suggestion_four_letters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/582_improve_name_suggestion_four_letters.sol new file mode 100644 index 00000000..547ea308 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/582_improve_name_suggestion_four_letters.sol @@ -0,0 +1,17 @@ +contract c { + function f () public + { + a = land; + a = lost; + a = lang; + } + uint256 long; + uint256 abc; +} +// ---- +// DeclarationError: (52-53): Undeclared identifier. +// DeclarationError: (56-60): Undeclared identifier. Did you mean "long"? +// DeclarationError: (70-71): Undeclared identifier. +// DeclarationError: (74-78): Undeclared identifier. Did you mean "long", "log0", "log1", "log2", "log3" or "log4"? +// DeclarationError: (88-89): Undeclared identifier. +// DeclarationError: (92-96): Undeclared identifier. Did you mean "long"? -- cgit