You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Odin: dev-2025-02:22ab8935c
OS: Manjaro Linux, Linux 6.1.126-1-MANJARO
CPU: 12th Gen Intel(R) Core(TM) i7-1260P
RAM: 31806 MiB
Backend: LLVM 14.0.6
Current Behavior
This should work, but does not compile:
a: typeid
a = int // ok
b: Maybe(typeid)
b = int // compile error: `Cannot assign 'int', a type, to assignment`
b = Maybe(typeid)(int) // compile error: `Cannot assign 'int', a type, to assignment`
Steps to Reproduce
main :: proc() {
// for `string` type all is good
{
a: string
a = "Hello" // ok
b: Maybe(string)
b = "Hello" // ok
b = Maybe(string)("Hello") // ok
}
// for `typeid` type it does not compile:
{
a: typeid
a = int // ok
b: Maybe(typeid)
b = int // compile error: `Cannot assign 'int', a type, to assignment`
b = Maybe(typeid)(int) // compile error: `Cannot assign 'int', a type, to assignment`
}
}
The text was updated successfully, but these errors were encountered:
With that said, you probably don't need Maybe(typeid).
a: typeid
fmt.println(a == nil) // true
If you don't assign anything to the typeid, it has the value nil, but nil itself isn't a type. Maybe is useful to determine whether something was assigned to it, but for a typeid nil already serves that same function.
Context
Current Behavior
This should work, but does not compile:
Steps to Reproduce
The text was updated successfully, but these errors were encountered: