}
FieldExpr field_exp = target as FieldExpr;
- if (field_exp != null && !ec.IsConstructor && !ec.IsFieldInitializer) {
+ if (field_exp != null && field_exp.DeclaringType.IsValueType && !ec.IsConstructor && !ec.IsFieldInitializer) {
field_exp = field_exp.InstanceExpression as FieldExpr;
if (field_exp != null && field_exp.FieldInfo.IsInitOnly) {
if (field_exp.IsStatic) {
// target_type
//
- source = Convert.ExplicitConversion (ec, source, target_type, loc);
+ source = Convert.WideningAndNarrowingConversion (ec, source, target_type, loc);
if (source == null){
- Convert.Error_CannotImplicitConversion (loc, source_type, target_type);
+ Convert.Error_CannotWideningConversion (loc, source_type, target_type);
return null;
}
// 2. and the original right side is implicitly convertible to
// the type of target
//
- if (Convert.ImplicitStandardConversionExists (ec, a.original_source, target_type))
+ if (Convert.WideningStandardConversionExists (ec, a.original_source, target_type))
return this;
//
(b.Oper == Binary.Operator.LeftShift || b.Oper == Binary.Operator.RightShift))
return this;
- Convert.Error_CannotImplicitConversion (loc, a.original_source.Type, target_type);
+ Convert.Error_CannotWideningConversion (loc, a.original_source.Type, target_type);
return null;
}
}
- source = Convert.ImplicitConversionRequired (ec, source, target_type, loc);
+ source = Convert.WideningConversionRequired (ec, source, target_type, loc);
if (source == null)
return null;