Commit 0f2be732 by Ian Lance Taylor

compiler: Make empty interface types for vars during parse time.

    
    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.
    
    Reviewed-on: https://go-review.googlesource.com/12049

From-SVN: r226123
parent 20886e71
b4a932b4a51b612cadcec93a83f94d6ee7d7d190 cbb27e8089e11094a20502e53ef69c9c36955f85
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -1225,7 +1225,11 @@ Parse::interface_type(bool record) ...@@ -1225,7 +1225,11 @@ Parse::interface_type(bool record)
methods = NULL; 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) if (record)
this->gogo_->record_interface_type(ret); this->gogo_->record_interface_type(ret);
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment