-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(compiler): Add feature to insert map from a function result with correct type [LNG-367] #1159
Conversation
case ( | ||
CallModel.Export(n, StreamMapType(_)), | ||
(res @ VarModel(_, StreamMapType(_), _), resDesugar) | ||
) if !outsideStreamNames.contains(n) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This guard does not help, as it is after the main case above, it should be before.
This code produces incorrect AIR:
func foo() -> %string, u64:
map: %string
<- map, 42
func main() -> string:
m <- foo()
<- m.get("key")!
AIR: (ap (%map 42) %m)
@@ -398,6 +398,8 @@ case class StreamMapType(override val element: DataType) extends MutableStreamTy | |||
StructType(name, NonEmptyMap.of("key" -> ScalarType.string, "value" -> element)) | |||
|
|||
def toCanon: ImmutableCollectionType = CanonStreamMapType(element) | |||
|
|||
def toProduct: ProductType = ProductType(ScalarType.string :: element :: Nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would call it elementProduct
, bc it is unclear on the first glance how to transform map type to product
Description
Make it possible to push a key and a value into stream maps as it is in streams:
Checklist
Reviewer Checklist