Skip to content

Conversation

dotnet-maestro[bot]
Copy link
Contributor

@dotnet-maestro dotnet-maestro bot commented Mar 23, 2024

This pull request updates the following dependencies

From https://github.com/dotnet/roslyn

  • Subscription: 037eb78c-9902-4cb9-856d-08db8ed7cafd
  • Build:
  • Date Produced: March 25, 2024 11:41:10 AM UTC
  • Commit: 919d4dbfb0dffb35a702417e28ceea652d248bc6
  • Branch: refs/heads/main

Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.10.0-2.24114.13 -> To Version 4.10.0-3.24172.13
@ghost ghost added the area-codeflow for labeling automated codeflow label Mar 23, 2024
@jkotas
Copy link
Member

jkotas commented Mar 23, 2024

@jaredpar Roslyn update introduced a build break in a very old dynamic test:

src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs(4383,29): error CS0039: (NETCORE_ENGINEERING_TELEMETRY=Build) Cannot convert type 'void' to 'object' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion

@stephentoub
Copy link
Member

stephentoub commented Mar 23, 2024

I think @chsienki was looking into it in #98559

Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.10.0-2.24114.13 -> To Version 4.10.0-3.24174.2
@jjonescz
Copy link
Member

jjonescz commented Mar 25, 2024

Roslyn update introduced a build break in a very old dynamic test

class C
{
    static object M1()
    {
        var a = "";
        dynamic da = a;
        return M2(da) as object;
    }

    static void M2(string s) { }
}

This scenario behaves differently after Params Collections - Adjust binding in presence of dynamic arguments (71421). There's a new error:

// (7,16): error CS0039: Cannot convert type 'void' to 'object' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
//         return M2(da) as object;
Diagnostic(ErrorCode.ERR_NoExplicitBuiltinConv, "M2(da) as object").WithArguments("void", "object").WithLocation(7, 16)

@AlekseyTs is that expected?

Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.10.0-2.24114.13 -> To Version 4.10.0-3.24175.2
@AlekseyTs
Copy link
Contributor

is that expected?

I would say yes. There is only one applicable candidate. Therefore, compile time resolution is performed. Therefore, result type of the invocation is not dynamic.

@jaredpar
Copy link
Member

@AlekseyTs can the old behavior be achieved by adding a second overload here to force the more dynamic interpretation? Example:

static void M2(int i) { }

@AlekseyTs
Copy link
Contributor

@stephentoub
Copy link
Member

stephentoub commented Mar 25, 2024

I assume this no longer compiling is also considered a bug fix?
https://sharplab.io/#v2:EYLgtghglgdgPgAQMwAIECYUGEUG8CwAUCiWqggCwoCyAFNQJ5YA2EAzmygMYCUeRpQSgAmDGBDBQuIlAF4UFANwChJLgG0kAGhEBdOQvTLipAL5FzhIsjSZGLdmyIETJG6PGTpAFwAWUNnVYbxQADx0PCSk9OQA+EWNTIA=

public class C {
    public void M(MyClass c) {
        dynamic d = 4;
        c[3, d] = 42;
    }
}

public class MyClass
{
    public dynamic this[int x, dynamic d] => d;
}

It previously compiled, but now it fails to compile with:

Property or indexer 'MyClass.this[int, dynamic]' cannot be assigned to -- it is read only

@stephentoub
Copy link
Member

(I pushed a commit to workaround the dynamic changes to the other PR.)

@AlekseyTs
Copy link
Contributor

I assume this no longer compiling is also considered a bug fix?

A language design change.

@stephentoub
Copy link
Member

Closing in favor of #98559

@dotnet-maestro dotnet-maestro bot deleted the darc-main-68808585-5458-48cf-8a55-8ffb51303b54 branch March 25, 2024 22:18
@github-actions github-actions bot locked and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-codeflow for labeling automated codeflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants