if (c != null)
return new EmptyConstantCast (c, type);
+ //
+ // No double conversion required when wrapping nullable types
+ //
+ if (TypeManager.IsNullableType (type)) {
+ EmptyCast empty_cast = child as EmptyCast;
+ if (empty_cast != null) {
+ if (TypeManager.IsNullableTypeOf (empty_cast.type, type))
+ throw new InternalErrorException ("Missing nullable underlying type conversion {0} != {1}",
+ TypeManager.CSharpName (empty_cast.type), TypeManager.CSharpName (type));
+
+ empty_cast.type = type;
+ return empty_cast;
+ }
+ }
+
return new EmptyCast (child, type);
}
//
// Fill not provided arguments required by params modifier
//
- if (params_initializers == null && pd.HasParams && arg_count < pd.Count) {
+ if (params_initializers == null && pd.HasParams && arg_count < pd.Count && a_idx + 1 == pd.Count) {
if (arguments == null)
arguments = new ArrayList (1);