dao
dao copied to clipboard
Type definition using "type" is not properly resolved when used
0$ dao -e '{(tuple<int, int>)(0, 1), (3, 2)}.iterate{io.writeln(X)}'
( 0, 1 )
( 3, 2 )
= none
0$ dao -e 'type T = tuple<int, int>; {(T)(0, 1), (3, 2)}.iterate{io.writeln(X)}'
[[ERROR]] in file "command line codes":
At line 1 : Invalid expression --- " .iterate{io. writeln(X)} ";
1$
I'd also expect casting working over newlines:
0$ cat ~/del/a.dao
{
(tuple<string, string>) ('a', 'b'),
}.iterate { io.writeln(X) }
0$ dao ~/del/a.dao
( "a", "b" )
0$ cat ~/del/b.dao
{
(tuple<string, string>)
('a', 'b'),
}.iterate { io.writeln(X) }
0$ dao ~/del/a.dao
[[ERROR]] in file "/home/test/del/b.dao":
At line 2 : Invalid expression --- " (tuple<string, string>) ";
At line 2 : Invalid expression --- " tuple<string, string>) ";
At line 2 : Symbol not defined --- " tuple ";
1$
And there is mismatch in reporting an issue in code sections:
0$ cat syntax_err.dao
{
(a="sth0", b=7),
(a="sth1", b=8),
}.iterate {
# ... whatever code here
io.writeln(
'abc' + X.a @[]def@[]
)
}
0$ dao syntax_err.dao
[[ERROR]] in file "/home/test/syntax_err.dao":
At line 2 : Invalid expression --- " }.iterate { ";
The first issue type T = tuple<int, int>; {(T)(0, 1), (3, 2)}.iterate{io.writeln(X)} is already solved and seems to work. The other two issues persist :wink:.