#1033 Why is not avilable type "Obj[]?[]" ?

Akcelisto Mon 22 Mar 2010

class A{ }
class B{
  A[]?[] vgs := (0..10).map{A[,]}
} 

Compiler message:

Expected identifier, not '['

msl Mon 22 Mar 2010

Is the problem the type or your closure function? A[,] looks a little suspicious (but responding while waiting for a train so can't check).

Try just [,] as your closure return statement?

Akcelisto Mon 22 Mar 2010

Problem is the type.

msl Mon 22 Mar 2010

You're right, looks like a bug:

mbp:~ martin$ cat Blah.fan 
class Main {
  Void main() {
    a := [null, ["asd", "dsa"]]
    echo(Type.of(a))
  }
}

mbp:~ martin$ fan Blah.fan 
sys::Str[]?[]

mbp:~ martin$ cat Blah2.fan 
class Main {
  Void main() {
    Str[]?[] a := [null, ["asd", "dsa"]]
    echo(Type.of(a))
  }
}

mbp:~ martin$ fan Blah2.fan 
/Users/martin/Blah2.fan(3,5): Invalid list literal; use '[,]' for empty Obj[] list
/Users/martin/Blah2.fan(3,5): Unknown type 'Str' for local declaration
ERROR: cannot compile script

brian Mon 22 Mar 2010

Promoted to ticket #1033 and assigned to brian

Agreed - that looks like a parsing bug

brian Tue 23 Mar 2010

Ticket resolved in 1.0.52

Fixed parser to support lists of nullable lists

Login or Signup to reply.