• Robert Griesemer's avatar
    go/types: permit embedding of non-defined interfaces via alias type names · c730a93f
    Robert Griesemer authored
    Embedded interfaces in interfaces must take the form of a (possibly
    qualified) type name. Before alias types, a type name always denoted
    a defined (formerly "named") type. The introduction of alias types
    enabled embedding of non-defined types via alias type names, as in:
    
    type T interface { E }
    type E interface { m() }
    
    Both cmd/compile and gccgo accept this kind of code, and the spec does
    not prohibit it. There may be code in the wild that makes use of this.
    
    go/types was written under the assumption that embedded interfaces
    were always defined types; and that assumption was even reflected in
    the go/types API.
    
    This change removes this restriction in the implementation (which
    happens to make it simpler), and in the API (by adding additional
    functions and deprecating the corresponding older versions).
    
    It also replaces uses of NewInterface and Embedded (old API) by
    NewInterface2 and EmbeddedType (new API) in dependent packages
    (importers).
    
    The old API remains in place for backward compatibility and is marked
    as deprecated.
    
    Fixes #25301.
    
    Change-Id: I272acd498754179efaf0590ca49d3eb4eee4348e
    Reviewed-on: https://go-review.googlesource.com/114317Reviewed-by: 's avatarAlan Donovan <adonovan@google.com>
    c730a93f
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
logs.txt Loading commit data...
robots.txt Loading commit data...