Created
December 11, 2016 17:56
-
-
Save btab/1d814e886e9216c26cf0be485c1a0f5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use "collections" | |
actor Main | |
let m1: Map[String, String] = Map[String, String] | |
let m2: Map[String, Array[String]] = Map[String, Array[String]] | |
// works fine | |
fun getThingsStringLiteral(): String => | |
m1.get_or_else("foo", "") | |
// works fine | |
fun getThingsStringRefRecovered(): String => | |
m1.get_or_else("foo", recover val String end) | |
// Array[String val] ref is not a subtype of Array[String val] #read: ref is not a subtype of #read | |
fun getThingsStringArrayLiteral(): Array[String] => | |
m2.get_or_else("foo", [""]) | |
// Array[String val] val is not a subtype of Array[String val] #read: val is not a subtype of #read | |
fun getThingsStringArrayRefRecovered(): Array[String] => | |
m2.get_or_else("foo", recover val Array[String] end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's some problems lurking in here...
So m2 will return a
Array[String] ref
however your else isArray[String] val
.That would be a problem.
I think you wanted something more like...
fun getThingsStringArrayRefRecovered(): this->Array[String] =>
m2.get_or_else("1", recover Array[String] end)