diff options
author | Marek Safar <marek.safar@gmail.com> | 2014-07-14 16:45:13 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2014-07-15 16:40:05 +0400 |
commit | f540f8ac339f7e833398c21516dd91dfc9b0dca5 (patch) | |
tree | 1af79262c453035d35f3c74d24863c9d884840e6 | |
parent | c46cf0e4595347a2ed62371b067fbc6c6f745b8b (diff) |
[mcs] Handling CreateStandardLiftedOperatorsTable for corlib without nullable typemono-3.6.0.39mono-3.6.0
-rw-r--r-- | mcs/mcs/expression.cs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/mcs/mcs/expression.cs b/mcs/mcs/expression.cs index c4c7168483b..6976b97c8b1 100644 --- a/mcs/mcs/expression.cs +++ b/mcs/mcs/expression.cs @@ -3159,11 +3159,21 @@ namespace Mono.CSharp } public static PredefinedOperator[] CreateStandardLiftedOperatorsTable (ModuleContainer module) { + var types = module.Compiler.BuiltinTypes; + + // + // Not strictly lifted but need to be in second group otherwise expressions like + // int + null would resolve to +(object, string) instead of +(int?, int?) + // + var string_operators = new [] { + new PredefinedStringOperator (types.String, types.Object, Operator.AdditionMask, types.String), + new PredefinedStringOperator (types.Object, types.String, Operator.AdditionMask, types.String), + }; + var nullable = module.PredefinedTypes.Nullable.TypeSpec; if (nullable == null) - return new PredefinedOperator [0]; + return string_operators; - var types = module.Compiler.BuiltinTypes; var bool_type = types.Bool; var nullable_bool = nullable.MakeGenericType (module, new[] { bool_type }); @@ -3198,13 +3208,8 @@ namespace Mono.CSharp new PredefinedOperator (nullable_long, nullable_int, Operator.NullableMask | Operator.ShiftMask), new PredefinedOperator (nullable_ulong, nullable_int, Operator.NullableMask | Operator.ShiftMask), - // - // Not strictly lifted but need to be in second group otherwise expressions like - // int + null would resolve to +(object, string) instead of +(int?, int?) - // - new PredefinedStringOperator (types.String, types.Object, Operator.AdditionMask, types.String), - new PredefinedStringOperator (types.Object, types.String, Operator.AdditionMask, types.String), - + string_operators [0], + string_operators [1] }; } |