Skip to content

Commit

Permalink
wit/bindgen: predeclare MarshalText and UnmarshalText methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ydnar committed Jan 19, 2025
1 parent f42f71a commit ca608fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion wit/bindgen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,9 @@ func (g *generator) declareTypeDef(file *gen.File, dir wit.Direction, t *wit.Typ
// Predeclare reserved methods.
switch t.Kind.(type) {
case *wit.Enum:
decl.scope.DeclareName("String") // For fmt.Stringer
decl.scope.DeclareName("String") // For fmt.Stringer
decl.scope.DeclareName("MarshalText") // For encoding.TextMarshaler
decl.scope.DeclareName("UnmarshalText") // For encoding.TextUnmarshaler
case *wit.Variant:
decl.scope.DeclareName("Tag") // Method on cm.Variant
decl.scope.DeclareName("String") // For fmt.Stringer
Expand Down

0 comments on commit ca608fc

Please sign in to comment.