I follow the mojo language basic to Overloaded functions section, and saw below code snippets
alias string: StringLiteral = "Hello"
but got below error
'StringLiteral' missing required parameter 'value'mojo
I follow the mojo language basic to Overloaded functions section, and saw below code snippets
alias string: StringLiteral = "Hello"
but got below error
'StringLiteral' missing required parameter 'value'mojo
Thanks for letting us know! Mind filing an issue at https://github.com/modular/modular/issues? Including your code and the exact command you used will help too.
Sure. I’d be happy to file an issue.
@billyzhu just fyi, it looks like not inferring the parameter correctly?
@Verdagon The reported issue refers to [BUG] Got 'StringLiteral' missing required parameter 'value' · Issue #5382 · modular/modular · GitHub
Thanks
Isn’t this just a side effect of StringLiteral being a dependent type?
All 3 of these are the same StringLiteral subtype
alias string: StringLiteral["Hello".value] = "Hello"
alias string2 = "Hello"
alias string3: __type_of("Hello") = "Hello"
same as IntLiteral
alias int_value: IntLiteral[(1).value] = 1
alias int_value2 = 1
alias int_value3: __type_of(1) = 1
Maybe we could provide a helper ?
alias StringLiteralSubType[subtype: StringLiteral[_]] = __type_of(subtype)
alias string = StringLiteralSubType["Hello"]()
Thanks for filing the ticket! I’ll follow up there so it gets tracked by the triaging process.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.