define type feature in type feature should raise an error?
I think this should not be allowed but currently does not raise an error?
ex is
type.one is
type.two is // should be an error
say "hello"
neither should this:
ex is
type.one is
b is
type.two is // should be an error
say "hello"
defining type feature in anonymous feature should probably also be an error:
ex is
ref : String
type.two is // should be an error
say "hello"
This raises an error but a very weird one:
ex is
[1].map i->
type.one => 1
unit
/home/sam/playground/test.fz:3:11: error 1: Incompatible type parameter
[1].map i->
----------^^^
type.one => 1
^^^^^^^^^^^^^^^^^
unit
^^^^^^^^
formal type parameter 'T' with constraint 'Any'
actual type parameter 'universe'
one error.
Yes, this still needs to be checked, and probably forbidden. Since the outer feature of a type feature o.f.type is the type feature of the outer feature o.type, and we do not want recursive type features, the outer feature must never be a type feature.
The type of a type is just Type:
> ./build/bin/fz -e "say (type_of 1)"
Type of 'i32'
> ./build/bin/fz -e "say (type_of (type_of 1))"
Type of 'Type'
> ./build/bin/fz -e "say (type_of (type_of (type_of 1)))"
Type of 'Type'
so we could also allow outer features to be type feature, but then the type-types are just Type.type... Need to check if this make sense in any context.