Skip to content

Commit

Permalink
Union Type Dataclass
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
  • Loading branch information
Future-Outlier committed Aug 2, 2024
1 parent 1124ea9 commit 6abef55
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions flytepropeller/pkg/compiler/validators/typing.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package validators

import (
"strings"

structpb "github.com/golang/protobuf/ptypes/struct"

flyte "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
structpb "github.com/golang/protobuf/ptypes/struct"
"strings"
)

type typeChecker interface {
Expand Down Expand Up @@ -38,13 +36,16 @@ func (t trivialChecker) CastsFrom(upstreamType *flyte.LiteralType) bool {
// Ignore metadata when comparing types.
upstreamTypeCopy := *upstreamType
downstreamTypeCopy := *t.literalType
upstreamTypeCopy.Structure = &flyte.TypeStructure{}
downstreamTypeCopy.Structure = &flyte.TypeStructure{}
if upstreamTypeCopy.GetUnionType() == nil && downstreamTypeCopy.GetUnionType() == nil {
upstreamTypeCopy.Structure = &flyte.TypeStructure{}
downstreamTypeCopy.Structure = &flyte.TypeStructure{}
}

upstreamTypeCopy.Metadata = &structpb.Struct{}
downstreamTypeCopy.Metadata = &structpb.Struct{}
upstreamTypeCopy.Annotation = &flyte.TypeAnnotation{}
downstreamTypeCopy.Annotation = &flyte.TypeAnnotation{}
return upstreamTypeCopy.String() == downstreamTypeCopy.String()
return upstreamTypeCopy.String() == downstreamTypeCopy.String() && upstreamTypeCopy.GetStructure() == downstreamTypeCopy.GetStructure()
}

type noneTypeChecker struct{}
Expand Down

0 comments on commit 6abef55

Please sign in to comment.