From 787aa4f8fd9946730bf52a5bbbd5a80d96d118a0 Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Wed, 12 Jun 2024 13:39:20 +1000 Subject: [PATCH] fix: allow non-FTL enums to exists in a module (#1748) fixes https://github.com/TBD54566975/ftl/issues/1747 --- go-runtime/compile/schema.go | 3 +-- go-runtime/compile/testdata/one/one.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/go-runtime/compile/schema.go b/go-runtime/compile/schema.go index 163865f5e9..3d73f895ea 100644 --- a/go-runtime/compile/schema.go +++ b/go-runtime/compile/schema.go @@ -949,9 +949,8 @@ func maybeVisitTypeEnumVariant(pctx *parseContext, node *ast.GenDecl, directives return } typ := pctx.pkg.TypesInfo.TypeOf(t.Type) - if typeInterface, ok := typ.Underlying().(*types.Interface); ok { + if _, ok := typ.Underlying().(*types.Interface); ok { // Type enums should not count as variants of themselves - pctx.enumInterfaces[t.Name.Name] = typeInterface return } diff --git a/go-runtime/compile/testdata/one/one.go b/go-runtime/compile/testdata/one/one.go index 48dca4ac9b..651bb25c7e 100644 --- a/go-runtime/compile/testdata/one/one.go +++ b/go-runtime/compile/testdata/one/one.go @@ -173,3 +173,13 @@ func Http(ctx context.Context, req builtin.HttpRequest[Req]) (builtin.HttpRespon type DataWithType[T any] struct { Value T } + +type NonFTLInterface interface { + NonFTLInterface() +} + +type NonFTLStruct struct { + Name string +} + +func (NonFTLStruct) NonFTLInterface() {}