dao icon indicating copy to clipboard operation
dao copied to clipboard

Type definition using "type" is not properly resolved when used

Open dumblob opened this issue 10 years ago • 3 comments

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$ 

dumblob avatar Jan 28 '15 21:01 dumblob

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$ 

dumblob avatar Jan 29 '15 07:01 dumblob

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 { ";

dumblob avatar Jan 29 '15 08:01 dumblob

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:.

dumblob avatar Apr 13 '19 11:04 dumblob