I'm trying to do something that should be possible, but I'm getting a strange error. I have a nested type Gravl.Node
and am trying to instantiate an array of tuples like so:
var attributes = [(attribute: String?, value: Gravl.Node)]()
…but Swift is complaining:
Cannot call value of non-function type '[(attribute: String?.Type, value: Gravl.Node.Type)]'
Any idea what gives? If I replace the nested type with something else it works fine.
Is this a bug in the parser/compiler?
Yes, this is a bug as noted by this question.
Following the example of that Q & A, you can change the syntax of the way you create the array:
or
In this case, you can also work around the issue by creating a
typealias
:Example: