提交 46434d9d 编写于 作者: N Neal Gafter 提交者: GitHub

Add missing box instruction in pattern match (#18922)

Fixes #18859
上级 d03d3594
......@@ -402,6 +402,7 @@ private void LowerConstantValueDecision(DecisionTree.ByValue byValue)
{
var loweredRight = kv.Key;
var loweredLeft = kv.Value;
loweredRight = _factory.Convert(loweredLeft.Type, loweredRight);
addBindings.Add(_factory.ExpressionStatement(
_localRewriter.MakeStaticAssignmentOperator(
_factory.Syntax, loweredLeft, loweredRight, RefKind.None, loweredLeft.Type, false)));
......
......@@ -1104,6 +1104,7 @@ public BoundExpression Convert(TypeSymbol type, BoundExpression arg)
{
HashSet<DiagnosticInfo> useSiteDiagnostics = null;
Conversion c = Compilation.Conversions.ClassifyConversionFromExpression(arg, type, ref useSiteDiagnostics);
Debug.Assert(c.Exists);
Debug.Assert(useSiteDiagnostics.IsNullOrEmpty());
// If this happens, we should probably check if the method has ObsoleteAttribute.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册