Closed TwitchBronBron closed 6 months ago
for version 1, I think we could fix this so that a function inside an AA literal will add an entry to the symbol table for m
to be a plain AA ... it's harder to do the prediction of "expected" type...
Although for v1.1, we could probably do "expected type" and support a few use cases:
AALiteral added to an array:
data = [] as SomeInterface[]
data.push({
func: function()
' `m` here is "SomeInterface"
end function
})
AA Literal returned from a function
function test() as SomeInterface
return {
func: function()
' `m` here is "SomeInterface"
end function
}
end function
AA Literal in a typed assignment --- To be fair, this is sort of a general case that we could provide validation for!
myData as SomeInterface = {
func: function()
' `m` here is "SomeInterface"
end function
}
Yeah I think those all make sense. I think what I care most about is that it's not wrong. So even if you just changed it to m as dynamic
or ifAssociativeArray
for now, that would be acceptable (but feel free to do the extra stuff you outlined)
The
m
for an AA method inside a class appears to be incorrect. In the example below, I would expectm
to be the type of whatever the AA type is, or in this caseIBenchmark
. But brighterscript thinks it'sSuite