ponyc
ponyc copied to clipboard
Misleading error message related to viewpoint adaptation
use "collections"
actor Main
new create(env: Env) =>
let a: Array[String ref] val = recover val
let x: Array[String ref] = Array[String ref]
x.push(String)
x
end
try
let string_from_array: String ref = a(0)
string_from_array.append("hello")
end
The error message is:
Error:
main.pony:12:41: right side must be a subtype of left side
let string_from_array: String ref = a(0)
^
Info:
main.pony:5:18: String val is not a subtype of String ref^: val is not a subcap of ref^
let a: Array[String ref] val = recover val
^
With the error pointing at String ref and saying that String val isnt a subtype. The viewpoint adaptation that is happening isn't seen in the error message.