You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the expected output? What do you see instead?
Expected:
No errors
Got:
Uncaught type 'anonymous' is not a subtype of type 'String'
main.dart.js:300
$.stringTypeCheck main.dart.js:300
$.test main.dart.js:178
$.main main.dart.js:187
(anonymous function) main.dart.js:624
What version of the product are you using? On what operating system?
dartium-lucid64-full-trunk-22223.0
on Ubuntu 12.10 64bit
I have dart-sdk revision 22231 installed
Please provide any additional information below.
The program compiles to:
The unary ? operator is being removed from the language shortly, so if this is related only to "?", this will not be fixed.
Can you try this test with some sort of sentinel default value to see if that works (since that will be the recommended pattern for this sort of thing going forward)?
This issue was originally filed by @budde377
What steps will reproduce the problem?
1.
Compile
import "dart:math";
dynamic a;
Function f;
void test({String s1, String s2}) {
s1 = ?s1 ? s1 : "string1";
s1 = ?s2 ? s2 : "string2";
if(new Random().nextBool()){
f = (){
print("$s1 $s2");
};
}
}
main() {
test(s2:a);
}
with dart2js
2.
Run
What is the expected output? What do you see instead?
Expected:
No errors
Got:
Uncaught type 'anonymous' is not a subtype of type 'String'
main.dart.js:300
$.stringTypeCheck main.dart.js:300
$.test main.dart.js:178
$.main main.dart.js:187
(anonymous function) main.dart.js:624
What version of the product are you using? On what operating system?
dartium-lucid64-full-trunk-22223.0
on Ubuntu 12.10 64bit
I have dart-sdk revision 22231 installed
Please provide any additional information below.
The program compiles to:
...
$.test = function(s1, s2) {
var t1, t2, t3;
t1 = {};
t1.s1_0 = s1;
t2 = $ === s1;
if (t2)
t1.s1_0 = null;
t3 = $ === s2;
if (t3)
s2 = null;
$.stringTypeCheck(s1);
$.stringTypeCheck(s2);
t1.s1_0 = $.stringTypeCheck(!t2 ? t1.s1_0 : "string1");
t1.s1_0 = !t3 ? s2 : "string2";
if (Math.random() < 0.5)
$.f = new $.test_anon(t1, s2);
};
$.main = function() {$, $ .a);
$.test(
};
...
The checks
$.stringTypeCheck(s1);
$.stringTypeCheck(s2);
should be
$.stringTypeCheck(t1.s1_0);
$.stringTypeCheck(t1.s2_0);
The text was updated successfully, but these errors were encountered: