Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/src/super-sql/functions/types/upcast.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ values

# expected output
{x:1,y?:none::string}
{x:1,y?:none::(string|null|none)}
{x:1,y?:none::option(string|null)}
```

---
8 changes: 4 additions & 4 deletions book/src/super-sql/operators/fuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ fuse
{a:1}
{b:2}
# expected output
fusion({a:fusion(1::(int64|none),<int64>),b:fusion(none::(int64|none),<none>)},<{a:int64}>)
fusion({a:fusion(none::(int64|none),<none>),b:fusion(2::(int64|none),<int64>)},<{b:int64}>)
fusion({a:fusion(some(1),<int64>),b:fusion(none::int64,<none>)},<{a:int64}>)
fusion({a:fusion(none::int64,<none>),b:fusion(some(2),<int64>)},<{b:int64}>)
```

---
Expand All @@ -64,6 +64,6 @@ fuse
{a:[1,2]}
{a:["foo","bar"],b:10.0.0.1}
# expected output
fusion({a:fusion([fusion(1::(int64|string),<int64>),fusion(2::(int64|string),<int64>)],<[int64]>),b:fusion(none::(ip|none),<none>)},<{a:[int64]}>)
fusion({a:fusion([fusion("foo"::(int64|string),<string>),fusion("bar"::(int64|string),<string>)],<[string]>),b:fusion(10.0.0.1::(ip|none),<ip>)},<{a:[string],b:ip}>)
fusion({a:fusion([fusion(1::(int64|string),<int64>),fusion(2::(int64|string),<int64>)],<[int64]>),b:fusion(none::ip,<none>)},<{a:[int64]}>)
fusion({a:fusion([fusion("foo"::(int64|string),<string>),fusion("bar"::(int64|string),<string>)],<[string]>),b:fusion(some(10.0.0.1),<ip>)},<{a:[string],b:ip}>)
```
6 changes: 6 additions & 0 deletions compiler/ast/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ type (
Type Type `json:"type"`
Loc `json:"loc"`
}
TypeOption struct {
Kind string `json:"kind" unpack:""`
Type Type `json:"type"`
Loc `json:"loc"`
}
TypeRef struct {
Kind string `json:"kind" unpack:""`
Name string `json:"name"`
Expand All @@ -74,6 +79,7 @@ func (*TypeEnum) typeNode() {}
func (*TypeMap) typeNode() {}
func (*TypeError) typeNode() {}
func (*TypeFusion) typeNode() {}
func (*TypeOption) typeNode() {}
func (*TypeRef) typeNode() {}

// This is a hack that allows us to express a "date" type until we
Expand Down
5 changes: 5 additions & 0 deletions compiler/ast/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ type (
Value Value `json:"value"`
Type *TypeValue `json:"type"`
}
Some struct {
Kind string `json:"kind" unpack:""`
Value Value `json:"value"`
}
None struct {
Kind string `json:"kind" unpack:""`
Type Type `json:"type"`
Expand All @@ -83,6 +87,7 @@ func (*Map) valueNode() {}
func (*TypeValue) valueNode() {}
func (*Error) valueNode() {}
func (*Fusion) valueNode() {}
func (*Some) valueNode() {}
func (*None) valueNode() {}
func (*DoubleQuoteExpr) valueNode() {}

Expand Down
Loading
Loading