fieldValue static method
Whether type is written double or double? - a binding whose
values widen turns into doubles (ghissues32).
ghissues77: a field's initial value value for its declared type:
an int bound to a double widens (ghissues32), and an empty {}
bound to a Set is a set - bind's SCE103 rule for locals and
parameters, which fields did not get (Slang's
final Set<E> translationsLoading = {}; was a map).
Implementation
static Object? fieldValue(STypeAnnotation? type, Object? value) {
if (declaresDouble(type)) return widen('double', value);
if (type is SNamedType &&
type.name?.name == 'Set' &&
value is Map &&
value.isEmpty) {
return <Object?>{};
}
return value;
}