Closed
Description
Consider the following program:
X? genericTopLevelFunction<X>() {
print('genericTopLevelFunction');
return null;
}
class A {
static X? genericStaticMethod<X>() {
print('genericStaticMethod');
return null;
}
}
const int? Function() cIntTopLevelFunction1 = genericTopLevelFunction;
const int? Function() cIntStaticMethod1 = A.genericStaticMethod;
void main() {
if (identical(cIntTopLevelFunction1, cIntStaticMethod1)) throw 0;
}
With the configuration architecture: x64, compiler: dartdevc, mode: release, runtime: chrome, system: linux, timeout: 960, host-checked
in commit ba5611a, this program throws, i.e., the invocation of identical
evaluates to true
.
Unless something very surprising is going on here (with identical
), this implies that the two tearoffs denote the same object at run time. Clearly, this should not be the case for two functions with different behavior.