From 7f0cc433be5b53ba68a0f1f7750a69dcd628c227 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 18 Nov 2020 20:20:25 +0100 Subject: [PATCH] Fix mapping conversion. --- libsolidity/codegen/YulUtilFunctions.cpp | 6 ++++++ .../variables/mapping_local_tuple_assignment.sol | 2 ++ 2 files changed, 8 insertions(+) diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 8fe11757a..28c72ad05 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -3072,6 +3072,12 @@ string YulUtilFunctions::conversionFunction(Type const& _from, Type const& _to) solAssert(false, "Invalid conversion from " + _from.canonicalName() + " to " + _to.canonicalName()); break; } + case Type::Category::Mapping: + { + solAssert(_from == _to, ""); + body = "converted := value"; + break; + } default: solAssert(false, "Invalid conversion from " + _from.canonicalName() + " to " + _to.canonicalName()); } diff --git a/test/libsolidity/semanticTests/variables/mapping_local_tuple_assignment.sol b/test/libsolidity/semanticTests/variables/mapping_local_tuple_assignment.sol index 39dd04abb..eb5e6b854 100644 --- a/test/libsolidity/semanticTests/variables/mapping_local_tuple_assignment.sol +++ b/test/libsolidity/semanticTests/variables/mapping_local_tuple_assignment.sol @@ -12,5 +12,7 @@ contract test { return (m1[1], m1[2], m2[1], m2[2]); } } +// ==== +// compileViaYul: also // ---- // f() -> 42, 0, 0, 21