@@ -9250,7 +9250,7 @@
Map_index_expression::do_determine_type(const Type_context*)
{
this->map_->determine_type_no_context();
- Type_context subcontext(this->get_map_type()->key_type(), true);
+ Type_context subcontext(this->get_map_type()->key_type(), false);
this->index_->determine_type(&subcontext);
}
@@ -9320,6 +9320,10 @@
tree map_tree = this->map_->get_tree(context);
tree index_tree = this->index_->get_tree(context);
+ index_tree = Expression::convert_for_assignment(context, type->key_type(),
+ this->index_->type(),
+ index_tree,
+ this->location());
if (map_tree == error_mark_node || index_tree == error_mark_node)
return error_mark_node;
@@ -2435,6 +2435,7 @@
case Type::TYPE_COMPLEX:
case Type::TYPE_POINTER:
case Type::TYPE_FUNCTION:
+ case Type::TYPE_MAP:
case Type::TYPE_CHANNEL:
hash_fn_name = "__go_type_hash_identity";
equal_fn_name = "__go_type_equal_identity";
@@ -2447,7 +2448,6 @@
case Type::TYPE_STRUCT:
case Type::TYPE_ARRAY:
- case Type::TYPE_MAP:
// These types can not be hashed or compared.
hash_fn_name = "__go_type_hash_error";
equal_fn_name = "__go_type_equal_error";
@@ -3057,7 +3057,7 @@
{
if (this->cases_ != NULL)
{
- Type_context case_context(type, true);
+ Type_context case_context(type, false);
for (Expression_list::iterator p = this->cases_->begin();
p != this->cases_->end();
++p)
@@ -4061,8 +4061,7 @@
Map_type::do_verify()
{
if (this->key_type_->struct_type() != NULL
- || this->key_type_->array_type() != NULL
- || this->key_type_->map_type() != NULL)
+ || this->key_type_->array_type() != NULL)
{
error_at(this->location_, "invalid map key type");
return false;