Standard library / go/types
go/types.Interface.MarkImplicit()
Marks a constructed interface as implicitly defined by a constraint literal. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (t *Interface) MarkImplicit()Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func union() *types.Union { return types.NewUnion([]*types.Term{term(), types.NewTerm(false, types.Typ[types.String])})}
func term() *types.Term { return types.NewTerm(true, types.Typ[types.Int]) }
func main() { v := types.NewInterfaceType(nil, []types.Type{union()}) v.MarkImplicit() fmt.Println(v.IsImplicit())}