Closed EvanKirshenbaum closed 5 months ago
This issue was referenced by the following commit before migration:
Type.NONE
is now Type.NO_VALUE
, above Type.ANY
at the top of the hierarchy. There is also a Type.MISSING
underneath all MissingType
s, to handle "maybes" (#151).
Currently statements that don't return a value and parallel blocks return
None
and are typed to returnType.NONE
. This is also the value of the constantnone
and the value aMaybeType
has when there's no value (since the rep type is anOptional[T]
).Once we rework the way macros work to allow
return
statements and return type declarations (#140), it would be a good idea to add a new type,Type.NO_VALUE
to handle the first use. A value of that typeType.ANY
), but it cannot be converted to anything, includingType.ANY
.Splitting
Type.NO_VALUE
fromType.NONE
will make type conversions with macro types (#222) more straightforward. Currently, a macro declared to returnType.NONE
usually means one that doesn't return a meaningful value, and so is covariant to one that does, logically puttingType.NONE
at the top of the hierarchy. But it could also mean one that returnsnone
, which should be a normal type (though one below all "maybe" types). Since the former case is more common, I'm going to special case it inCallableType
's conversion logic, but it would be nice to revisit that. It would also be nice to not allow the creation of variables that can't hold meaningful values.Migrated from internal repository. Originally created by @EvanKirshenbaum on Jan 26, 2023 at 9:28 AM PST. Closed on Jan 28, 2023 at 4:33 PM PST.