This project is read-only.
1

Resolved

Exception when declaration expression is used with an increment operator

description

Code:
public static class A {
    public static void M() {
        var x = ++(var y = 2);
    }
}
Result:
System.InvalidOperationException: Unexpected value 'DeclarationExpression' of type 'Microsoft.CodeAnalysis.CSharp.BoundKind'
   at Microsoft.CodeAnalysis.CSharp.LocalRewriter.TransformCompoundAssignmentLHS(BoundExpression originalLHS, ArrayBuilder`1 stores, ArrayBuilder`1 temps, Boolean isDynamicAssignment)
   at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitIncrementOperator(BoundIncrementOperator node)
   at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitExpressionImpl(BoundExpression node)
   at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitLocalDeclaration(BoundLocalDeclaration node)
   at Microsoft.CodeAnalysis.CSharp.BoundTreeRewriter.DoVisitList[T](ImmutableArray`1 list)
   at Microsoft.CodeAnalysis.CSharp.BoundTreeRewriter.VisitList[T](ImmutableArray`1 list)
   at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitBlock(BoundBlock node)
   at Microsoft.CodeAnalysis.CSharp.LocalRewriter.Rewrite(Boolean generateDebugInfo, MethodSymbol containingSymbol, NamedTypeSymbol containingType, BoundStatement statement, TypeCompilationState compilationState, DiagnosticBag diagnostics, SynthesizedSubmissionFields previousSubmissionFields, Boolean& sawLambdas, Boolean& sawDynamicOperations, Boolean& sawAwaitInExceptionHandler)
   at Microsoft.CodeAnalysis.CSharp.Compiler.LowerStatement(Boolean generateDebugInfo, NamedTypeSymbol thisType, ParameterSymbol thisParameter, MethodSymbol method, BoundStatement body, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState, DiagnosticBag diagnostics)
   at Microsoft.CodeAnalysis.CSharp.Compiler.LowerStatement(Boolean generateDebugInfo, MethodSymbol method, BoundStatement body, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState, DiagnosticBag diagnostics)
   at Microsoft.CodeAnalysis.CSharp.MethodBodyCompiler.CompileMethod(MethodSymbol methodSymbol, ProcessedFieldInitializers& processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState)
   at Microsoft.CodeAnalysis.CSharp.MethodBodyCompiler.CompileNamedType(NamedTypeSymbol symbol)
   at Microsoft.CodeAnalysis.CSharp.MethodBodyCompiler.<>c__DisplayClass6.<CompileNamedTypeAsTask>b__8()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

comments

angocke wrote May 14, 2014 at 12:29 AM

Fixed in changeset fd6c03124caa02459949d86dc1cf3e8131d126cf