Merge: New syntax for typed literal arrays
authorJean Privat <jean@pryen.org>
Thu, 25 Sep 2014 21:41:09 +0000 (17:41 -0400)
committerJean Privat <jean@pryen.org>
Thu, 25 Sep 2014 21:41:09 +0000 (17:41 -0400)
Currenlty there is only
~~~.nit
var a = [1, 2] # a isa Array[Int]
var b = [1, true] # Type Error: ambiguous array type Int Bool
var c = new Array[Object].with_items(1, true) # c isa Array[Object]
~~~

Now, there is also
~~~.nit
var d = [1, true: Object] # d isa Array[Object]
var e = [1, 2: Numeric] # e isa Array[Numeric]
var f = [1, 2: Int] # f isa Array[Int] but with a warning for the useless `:Int`
~~~

Pull-Request: #772
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

1  2 
src/semantize/typing.nit

Simple merge