-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P1A high priority bug; for example, a single project is unusable or has many test failuresA high priority bug; for example, a single project is unusable or has many test failuresarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dart2js
Description
This program crashes under all optimization levels, including -O0.
class ComponentFactory<T> {
@pragma('dart2js:noInline')
Type get componentType => T;
}
var mm = {'String': String, 'int': int};
var gf1 = ComponentFactory<int>();
var gf2 = ComponentFactory<dynamic>();
Map<String, ComponentFactory> mf = {'RegExp': ComponentFactory<RegExp>()};
ComponentFactory test(String s, [Map<String, ComponentFactory> mf2]) {
var f = mf[s];
if (f == null) {
var t = mm[s];
if (mf2 != null) f = mf2[s];
if (t != null && t != f?.componentType) {
print('not match $t');
f = gf2;
}
}
return f;
}
work() {
Map<String, ComponentFactory> mf2 = {'int': ComponentFactory<num>()};
test('String');
test('String', mf2);
test('int');
test('int', mf2);
test('RegExp');
test('RegExp', mf2);
}
main() {
try {
work();
} catch (e, st) {
print(e);
print(st);
}
}get$componentType is not in the output.
not match String
not match String
not match int
NoSuchMethodError: method not found: 'get$componentType' (f.get$componentType is not a function)
TypeError: f.get$componentType is not a function
at Object.test (o1.js:3199:15)
at Object.work (o1.js:3215:9)
at Object.main (o1.js:3222:11)
at o1.js:4049:9
at o1.js:4029:7
at dartProgram (o1.js:4044:5)
at o1.js:4051:3
Except for -O0, the inferred type of the call to get$componentType is 'empty'.
Program runs as expected on Dart VM.
Metadata
Metadata
Assignees
Labels
P1A high priority bug; for example, a single project is unusable or has many test failuresA high priority bug; for example, a single project is unusable or has many test failuresarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dart2js