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
Evaluating a function-type constructor keyword argument causes null-pointer exception.
To Reproduce
Steps to reproduce the behavior:
import IO;
int fallBackF(int i) {
return i;
}
data A
= a(int(int) f = fallBackF)
| b(int(int) f = int(int i) { return i * 2; })
;
// NPE
test bool kwDefault() {
A aa = a();
return aa.f(1) == 1;
}
// NPE
test bool inlineKwDefault() {
A bb = b();
return bb.f(1) == 2;
}
Workaround: using common keyword arguments (on the ADT instead of constructor) works:
data B(int(int) g = fallBackF, int(int) h = int(int i) { return i * 2; })
= c()
;
// Succeeds
test bool commonKwDefault() {
B aa = c();
return aa.g(1) == 1;
}
// Succeeds
test bool inlineCommonKwDefault() {
B aa = c();
return aa.h(1) == 2;
}
Expected behavior
Definitely no NPE. All tests should succeed.
The text was updated successfully, but these errors were encountered:
Describe the bug
Evaluating a function-type constructor keyword argument causes null-pointer exception.
To Reproduce
Steps to reproduce the behavior:
Workaround: using common keyword arguments (on the ADT instead of constructor) works:
Expected behavior
Definitely no NPE. All tests should succeed.
The text was updated successfully, but these errors were encountered: