Skip to content

Update indexers based on analyzer receiver#34134

Merged
jcouv merged 3 commits intodotnet:masterfrom
jcouv:update-indexer
Mar 17, 2019
Merged

Update indexers based on analyzer receiver#34134
jcouv merged 3 commits intodotnet:masterfrom
jcouv:update-indexer

Conversation

@jcouv
Copy link
Copy Markdown
Member

@jcouv jcouv commented Mar 14, 2019

In receiver[index] we need to update the symbol for the indexer property once we have the flow-analyzed type for the receiver.

Fixes #29964

@jcouv jcouv added this to the 16.1.P1 milestone Mar 14, 2019
@jcouv jcouv self-assigned this Mar 14, 2019
@jcouv jcouv requested a review from a team as a code owner March 14, 2019 23:39
@333fred
Copy link
Copy Markdown
Member

333fred commented Mar 15, 2019

Done review pass (commit 1) #Resolved

C<T> this[T index] { get => throw null!; set => throw null!; }

C<U> L<U>(U u) => null!;
}", options: WithNonNullTypesTrue());
Copy link
Copy Markdown
Contributor

@cston cston Mar 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor point: It's a little confusing reading these tests when there are a number of instance methods where the receiver is unused and generic methods where the type parameters are unused. For instance, I believe this could be written as:

class C<T>
{
    public T Field = default!;
    public C<T> this[T index] { get => throw null!; set => throw null!; }
}
class Program
{
    static void M(object? o, object o2)
    {
        //...
    }
    static C<U> L<U>(U u) => null!;
}
``` #Resolved

@jcouv
Copy link
Copy Markdown
Member Author

jcouv commented Mar 15, 2019

@333fred Did you mean to approve, or did you have some feedback? Thanks

Copy link
Copy Markdown
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (commit 3)

Copy link
Copy Markdown
Member

@jaredpar jaredpar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@jcouv
Copy link
Copy Markdown
Member Author

jcouv commented Mar 16, 2019

Hum, I getting an error on Linux branch with DecimalBinaryOp_03...

We expect 0.000000000983 but got 0.0000000009832122 for fifth number from the end.

Roslyn.Test.Utilities.ExecutionException : \nExecution failed for assembly '/opt/code/artifacts/tmp/Debug/RoslynTests'.\n
Expected: \n1007\n993\n7000\n142.85714285714285714285714286\n6\n-993\n-1007\n-7000\n-142.85714285714285714285714286\n-6\n123.0012300\n122.9987700\n0.15129000000000\n100000\n0.0000000\n12345678900000000.000000001235\n12345678899999999.999999998765\n15241577.6390794200000000\n10000000729000059778004901.796\n0.000000000983\n246913578.1246913578\n-0.1000000000\n15241578765584515.651425087878\n0.9999999991899999933660999449\n123456789.0123456789\n\n
Actual: 1007\n993\n7000\n142.85714285714285714285714286\n6\n-993\n-1007\n-7000\n-142.85714285714285714285714286\n-6\n123.0012300\n122.9987700\n0.15129000000000\n100000\n0.0000000\n12345678900000000.000000001235\n12345678899999999.999999998765\n15241577.6390794200000000\n10000000729000059778004901.796\n0.0000000009832122\n246913578.1246913578\n-0.1000000000\n15241578765584515.651425087878\n0.9999999991899999933660999449\n123456789.0123456789\n\n

Stack trace
  at Roslyn.Test.Utilities.Desktop.DesktopRuntimeEnvironment.Execute (System.String moduleName, System.String[] args, System.String expectedOutput) [0x00079] in <82d3df1bc9244dfab11b08c80afc1923>:0 
  at Microsoft.CodeAnalysis.Test.Utilities.CompilationVerifier.Emit (System.String expectedOutput, System.Nullable`1[T] expectedReturnCode, System.String[] args, System.Collections.Generic.IEnumerable`1[T] manifestResources, Microsoft.CodeAnalysis.Emit.EmitOptions emitOptions, Microsoft.CodeAnalysis.Test.Utilities.Verification peVerify, Microsoft.CodeAnalysis.Test.Utilities.SignatureDescription[] expectedSignatures) [0x00055] in <82d3df1bc9244dfab11b08c80afc1923>:0 
  at Microsoft.CodeAnalysis.Test.Utilities.CommonTestBase.Emit (Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Generic.IEnumerable`1[T] dependencies, System.Collections.Generic.IEnumerable`1[T] manifestResources, Microsoft.CodeAnalysis.Test.Utilities.SignatureDescription[] expectedSignatures, System.String expectedOutput, System.Nullable`1[T] expectedReturnCode, System.String[] args, System.Action`1[T] assemblyValidator, System.Action`1[T] symbolValidator, Microsoft.CodeAnalysis.Emit.EmitOptions emitOptions, Microsoft.CodeAnalysis.Test.Utilities.Verification verify) [0x00016] in <82d3df1bc9244dfab11b08c80afc1923>:0 
  at Microsoft.CodeAnalysis.Test.Utilities.CommonTestBase.CompileAndVerifyCommon (Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Generic.IEnumerable`1[T] manifestResources, System.Collections.Generic.IEnumerable`1[T] dependencies, System.Action`1[T] sourceSymbolValidator, System.Action`1[T] assemblyValidator, System.Action`1[T] symbolValidator, Microsoft.CodeAnalysis.Test.Utilities.SignatureDescription[] expectedSignatures, System.String expectedOutput, System.Nullable`1[T] expectedReturnCode, System.String[] args, Microsoft.CodeAnalysis.Emit.EmitOptions emitOptions, Microsoft.CodeAnalysis.Test.Utilities.Verification verify) [0x00074] in <82d3df1bc9244dfab11b08c80afc1923>:0 
  at Microsoft.CodeAnalysis.CSharp.Test.Utilities.CSharpTestBase.CompileAndVerify (Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Generic.IEnumerable`1[T] manifestResources, System.Collections.Generic.IEnumerable`1[T] dependencies, System.Action`1[T] sourceSymbolValidator, System.Action`1[T] validator, System.Action`1[T] symbolValidator, Microsoft.CodeAnalysis.Test.Utilities.SignatureDescription[] expectedSignatures, System.String expectedOutput, System.Nullable`1[T] expectedReturnCode, System.String[] args, Microsoft.CodeAnalysis.Emit.EmitOptions emitOptions, Microsoft.CodeAnalysis.Test.Utilities.Verification verify) [0x00016] in <410994acfd424b9db2d2c066e1ae29e9>:0 
  at Microsoft.CodeAnalysis.CSharp.Test.Utilities.CSharpTestBase.CompileAndVerify (Microsoft.CodeAnalysis.CSharp.Test.Utilities.CSharpTestSource source, System.Collections.Generic.IEnumerable`1[T] references, System.Collections.Generic.IEnumerable`1[T] manifestResources, System.Collections.Generic.IEnumerable`1[T] dependencies, System.Action`1[T] sourceSymbolValidator, System.Action`1[T] assemblyValidator, System.Action`1[T] symbolValidator, Microsoft.CodeAnalysis.Test.Utilities.SignatureDescription[] expectedSignatures, System.String expectedOutput, System.Nullable`1[T] expectedReturnCode, System.String[] args, Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions options, Microsoft.CodeAnalysis.CSharp.CSharpParseOptions parseOptions, Microsoft.CodeAnalysis.Emit.EmitOptions emitOptions, Roslyn.Test.Utilities.TargetFramework targetFramework, Microsoft.CodeAnalysis.Test.Utilities.Verification verify) [0x00034] in <410994acfd424b9db2d2c066e1ae29e9>:0 
  at Microsoft.CodeAnalysis.CSharp.UnitTests.CodeGen.CodeGenTests.DecimalBinaryOp_03 () [0x0000e] in <713891092dbf4c60917eca0a107b2bf5>:0 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.Run

@jcouv jcouv merged commit 4caebd1 into dotnet:master Mar 17, 2019
@jcouv jcouv deleted the update-indexer branch March 17, 2019 04:11
333fred added a commit to 333fred/roslyn that referenced this pull request Mar 19, 2019
* dotnet/master: (345 commits)
  Update indexers based on analyzer receiver (dotnet#34134)
  Skip test DecimalBinaryOp_03 (dotnet#34199)
  Remove earlier nullable documentation (dotnet#34153)
  Rewrite FindReferencesTests as theories
  Apply a hang mitigating timeout to ExecuteCommand
  Warn on __refvalue null dereference: (dotnet#34135)
  Update dependencies from https://github.com/dotnet/arcade build 20190312.7 (dotnet#34112)
  Update vs branch for 16.1
  Fix struct layout error when nullable enabled: (dotnet#34128)
  Remove IgnoreInsignificantNullableModifiersDifference (dotnet#34096)
  Add the correct nullable annotations to generated iterator code (dotnet#33986)
  Move Rename implementation to new fully loaded document API.
  handle encapsulate field command
  change the way extract method handle partial load
  handle orangize document
  Add back Go to definition method.
  Revert "Move Go to definition to new fully loaded document API."
  Revert "Move Find references implementation to new fully loaded document API."
  Move Find references implementation to new fully loaded document API.
  Track nullable state across boxing conversions (dotnet#34087)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants