Skip to content

Commit

Permalink
compiler: Make empty interface types for vars during parse time.
Browse files Browse the repository at this point in the history
When making the type for a variable with an empty interface type,
the parser makes an interface type with a NULL method set and relies
on later passes to correct this.

For sink variables, which are ignored in later passes, the interface
method table is never finalized and a compile time assertion is issued.
Instead, the initial type generated by the parser should be the empty
interface type.

Fixes golang/go#11579.

Change-Id: I479559f270ddf88afc7a33103c0f56afda195d94
Reviewed-on: https://go-review.googlesource.com/12049
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
Chris Manghane authored and ianlancetaylor committed Jul 23, 2015
1 parent b4a932b commit cbb27e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,11 @@ Parse::interface_type(bool record)
methods = NULL;
}

Interface_type* ret = Type::make_interface_type(methods, location);
Interface_type* ret;
if (methods == NULL)
ret = Type::make_empty_interface_type(location);
else
ret = Type::make_interface_type(methods, location);
if (record)
this->gogo_->record_interface_type(ret);
return ret;
Expand Down

0 comments on commit cbb27e8

Please sign in to comment.