Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
ce7faab
Add ViewMarginProvider and related code
Cosifne Aug 16, 2021
f849e91
Update VisualBasicInvertIfCodeRefactoringProvider.MultiLine.vb
AdamSpeight2008 Aug 17, 2021
530ab19
Add the required handlers
Cosifne Aug 16, 2021
3fc2934
Remove GlyphFactory
Cosifne Aug 17, 2021
109ebf9
Update src/Features/VisualBasic/Portable/InvertIf/VisualBasicInvertIf…
AdamSpeight2008 Aug 17, 2021
4fdd348
Auto collapse margin
Cosifne Aug 17, 2021
dee2aa6
Rename file
Cosifne Aug 17, 2021
28b17ba
Add an option to show Inheritance Margin in the indicator margin
sharwell Aug 18, 2021
248b8c1
Fix background color
Cosifne Aug 19, 2021
95e1c96
Warm up ImportCompletion cache when opening document
genlu Aug 19, 2021
e187128
Modify the code to use glyph manager
Cosifne Aug 19, 2021
6401c2a
Only pre-populate cache when ImportCompletion is enabled
genlu Aug 19, 2021
59c6272
Make margin non-user control
Cosifne Aug 19, 2021
f643b8c
Add ClipToBound
Cosifne Aug 19, 2021
9aafa0d
Use a differnt way to put margin to indicate margin because the ClipT…
Cosifne Aug 19, 2021
31e9b55
Polishing the main switching logic
Cosifne Aug 20, 2021
c97bb5a
Rename files
Cosifne Aug 20, 2021
f95b470
Change the content type to make sure the extra margin won't be shown …
Cosifne Aug 20, 2021
77ce8d7
Use a new implementation apporach
Cosifne Aug 20, 2021
09203c7
Remove the partial word
Cosifne Aug 20, 2021
03faadf
Use document with partial semantic for completion
genlu Aug 20, 2021
5e59a82
Address feedback and add comments
Cosifne Aug 23, 2021
cbf8da6
Add more comments
Cosifne Aug 23, 2021
26f70e0
Add one extra check
Cosifne Aug 23, 2021
cc7d82e
Merge branch 'main' into dev/shech/InheritanceMarginViewMargin
Cosifne Aug 23, 2021
00b8112
Fix a mistake in comments
Cosifne Aug 23, 2021
d545e06
Update the visibility of the canvas when it is created
Cosifne Aug 24, 2021
ce44014
Merge remote-tracking branch 'dotnet/main' into PartialSemanticComple…
genlu Aug 25, 2021
c311b18
Move the per-language option to a general option and change the default
Cosifne Aug 25, 2021
704d0a0
Merge remote-tracking branch 'dotnet/main' into CacheWarmUp
genlu Aug 25, 2021
3c1b63c
Address nits
Cosifne Aug 25, 2021
5e91484
Use interval tree instead of a dictionary to track all the glyphs
Cosifne Aug 25, 2021
8d66c23
Use the BinarySearchHelper of Roslyn instead
Cosifne Aug 26, 2021
2e58be6
Add a DebuggerDisplay for BranchId
jasonmalinowski Aug 26, 2021
ec33396
Remove unnecessary #nullable enable
jasonmalinowski Aug 26, 2021
df37efe
Freeze semantics for all branches when asked
jasonmalinowski Aug 26, 2021
ba47cdf
Check is empty instead of calling Any()
Cosifne Aug 26, 2021
3ca2421
Fix an indentation
Cosifne Aug 26, 2021
bb92dc9
Pass the newSpan
Cosifne Aug 26, 2021
2c40ba2
Merge branch 'main' into dev/shech/InheritanceMarginViewMargin
Cosifne Aug 26, 2021
0f0bb31
Move more code to async gotodef helpers
CyrusNajmabadi Aug 26, 2021
9490e07
Move additional feature over.
CyrusNajmabadi Aug 26, 2021
7382fdc
Update src/VisualStudio/Core/Def/Implementation/Library/AbstractObjec…
CyrusNajmabadi Aug 26, 2021
1844c94
Fixup tests
CyrusNajmabadi Aug 26, 2021
16efcc7
Merge branch 'asyncgotodef' of https://github.com/CyrusNajmabadi/rosl…
CyrusNajmabadi Aug 26, 2021
522e501
Move method back
CyrusNajmabadi Aug 26, 2021
7356892
inline method
CyrusNajmabadi Aug 26, 2021
1e308b8
Address feedbacks
Cosifne Aug 26, 2021
3cfcf67
Make sure smenatic model won't be GC'd
genlu Aug 26, 2021
4009349
Warm up cache on an per project basis
genlu Aug 26, 2021
e85a0ef
Use GC.KeepAlive
genlu Aug 27, 2021
0e21d20
Use project as parameter instead
genlu Aug 27, 2021
44fb5fa
First populate cache with partial semantic for faster result
genlu Aug 27, 2021
3abef03
Remove unnecessary #nullable disable
jasonmalinowski Aug 27, 2021
e8a7f03
Add Import Directives to the VS options search text
JoeRobich Aug 27, 2021
de7eab8
Fix navigation in findrefs
CyrusNajmabadi Aug 27, 2021
0e976b2
Handle XamlDefinition with line and column
LinglingTong Aug 27, 2021
e54926a
remove async/await
CyrusNajmabadi Aug 27, 2021
4a7d26b
Add unit test.
AdamSpeight2008 Aug 28, 2021
2c3e6bb
Add a test to confirm that frozen partial projects have different ver…
jasonmalinowski Aug 28, 2021
4b95718
Use lambda expression and method group signature in type inference (#…
cston Aug 28, 2021
53ba857
Merge pull request #55910 from jasonmalinowski/ensure-freezing-semant…
jasonmalinowski Aug 28, 2021
2ab5dcb
Merge pull request #55979 from CyrusNajmabadi/findRefsNavigation
CyrusNajmabadi Aug 28, 2021
a58a0a1
Remove redundant code.
AdamSpeight2008 Aug 28, 2021
d9a6dd5
Merge pull request #55995 from AdamSpeight2008/patch-17
CyrusNajmabadi Aug 28, 2021
c8f214a
[main] Update dependencies from dotnet/source-build (#55994)
dotnet-maestro[bot] Aug 29, 2021
94dfadf
Merge pull request #55656 from AdamSpeight2008/patch-15
Aug 30, 2021
59220cc
Merge pull request #55980 from LinglingTong/dev/ltong/line_col_defini…
LinglingTong Aug 30, 2021
ff6ef22
Specify forbidden zone for foreach deconstruction variables. (#55982)
AlekseyTs Aug 30, 2021
6221323
Merge pull request #55745 from genlu/PartialSemanticCompletion
genlu Aug 30, 2021
50833c9
Merge pull request #55929 from CyrusNajmabadi/asyncgotodef
CyrusNajmabadi Aug 30, 2021
8de6661
Merge pull request #55729 from genlu/CacheWarmUp
genlu Aug 30, 2021
3fdd28b
EnC - Tests for lambda improvements (#55224)
davidwengier Aug 30, 2021
4d99cda
React to string comparison changing on .NET Core (#56011)
jaredpar Aug 30, 2021
023d3ca
EnC - Report rude edit when a user adds an AsyncMethodBuild attribute…
davidwengier Aug 30, 2021
0cb871f
Switch option to new name to fix build break
dibarbet Aug 30, 2021
37272c0
Merge pull request #56020 from dibarbet/fix_main
JoeRobich Aug 30, 2021
bd5b482
Add more attribute tests for more things (#55881)
davidwengier Aug 30, 2021
ddd7482
Allow fully oblivious types to coexist with nullable-aware base types…
RikkiGibson Aug 31, 2021
d1d0dfd
Fix formatting
Cosifne Aug 31, 2021
5e3ecf0
Share 'when' expressions in DAGs when needed (#55981)
jcouv Aug 31, 2021
1aeee28
Implement metadata reference provider (#55052)
chsienki Aug 31, 2021
cdbd46d
Remove Remove Unused Reference command hotkey
JoeRobich Aug 31, 2021
94d1ae5
Merge pull request #55674 from Cosifne/dev/shech/InheritanceMarginVie…
Cosifne Aug 31, 2021
e01c311
Add generator driver cache to VBCSCompiler (#55023)
chsienki Aug 31, 2021
2be2c34
Merge pull request #56030 from JoeRobich/remove-hotkey
JoeRobich Aug 31, 2021
9ad67ca
NullableWalker.VisitSwitchStatementDispatch - visit local declaration…
AlekseyTs Aug 31, 2021
1f9bf9a
Merge pull request #55972 from JoeRobich/update-search-text
JoeRobich Aug 31, 2021
eec087b
Merge remote-tracking branch 'upstream/main' into merges/main-to-main…
Cosifne Aug 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ record Derived(int I) // The positional member 'Base.I' found corresponding to t
}
```

4. In C# 10, method groups are implicitly convertible to `System.Delegate`, and lambda expressions are implicitly convertible to `System.Delegate` and `System.Linq.Expressions.Expression`.
4. In C# 10, lambda expressions and method groups are implicitly convertible to `System.MulticastDelegate`, or any base classes or interfaces of `System.MulticastDelegate` including `object`, and lambda expressions are implicitly convertible to `System.Linq.Expressions.Expression`.

This is a breaking change to overload resolution if there exists an overload with a `System.Delegate` or `System.Linq.Expressions.Expression` parameter that is applicable and the closest applicable overload with a strongly-typed delegate parameter is in an enclosing namespace.
This is a breaking change to overload resolution if there exists an applicable overload with a parameter of type `System.MulticastDelegate`, or a parameter of a type in the base types or interfaces of `System.MulticastDelegate`, or a parameter of type `System.Linq.Expressions.Expression`, and the closest applicable extension method overload with a strongly-typed delegate parameter is in an enclosing namespace.

```C#
class C
Expand Down
1 change: 1 addition & 0 deletions docs/contributing/Compiler Test Plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ __makeref( x )
- Tuple
- Default literal
- Implicit object creation (target-typed new)
- Function type (in type inference comparing function types of lambdas or method groups)

## Types

Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<Sha>7e80445ee82adbf9a8e6ae601ac5e239d982afaa</Sha>
<SourceBuild RepoName="xliff-tasks" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build" Version="0.1.0-alpha.1.21426.1">
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build" Version="0.1.0-alpha.1.21428.1">
<Uri>https://github.com/dotnet/source-build</Uri>
<Sha>c96e044a8031b92e840142eab84b85a45fa9c4c0</Sha>
<Sha>32d7d9397b3dcf1d0633cbfae18f81812c90d562</Sha>
<SourceBuild RepoName="source-build" ManagedOnly="true" />
</Dependency>
</ProductDependencies>
Expand Down
139 changes: 61 additions & 78 deletions src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ protected BoundExpression CreateConversion(
return CreateAnonymousFunctionConversion(syntax, source, conversion, isCast: isCast, conversionGroupOpt, destination, diagnostics);
}

if (conversion.Kind == ConversionKind.FunctionType)
{
return CreateFunctionTypeConversion(syntax, source, conversion, isCast: isCast, conversionGroupOpt, destination, diagnostics);
}

if (conversion.IsStackAlloc)
{
return CreateStackAllocConversion(syntax, source, conversion, isCast, conversionGroupOpt, destination, diagnostics);
Expand Down Expand Up @@ -546,69 +551,68 @@ private BoundExpression CreateUserDefinedConversion(
return finalConversion;
}

private BoundExpression CreateAnonymousFunctionConversion(SyntaxNode syntax, BoundExpression source, Conversion conversion, bool isCast, ConversionGroup? conversionGroup, TypeSymbol destination, BindingDiagnosticBag diagnostics)
private BoundExpression CreateFunctionTypeConversion(SyntaxNode syntax, BoundExpression source, Conversion conversion, bool isCast, ConversionGroup? conversionGroup, TypeSymbol destination, BindingDiagnosticBag diagnostics)
{
// We have a successful anonymous function conversion; rather than producing a node
// which is a conversion on top of an unbound lambda, replace it with the bound
// lambda.
Debug.Assert(conversion.Kind == ConversionKind.FunctionType);
Debug.Assert(source.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda);
Debug.Assert(syntax.IsFeatureEnabled(MessageID.IDS_FeatureInferredDelegateType));

// UNDONE: Figure out what to do about the error case, where a lambda
// UNDONE: is converted to a delegate that does not match. What to surface then?
CompoundUseSiteInfo<AssemblySymbol> useSiteInfo = GetNewCompoundUseSiteInfo(diagnostics);
var delegateType = source.GetInferredDelegateType(ref useSiteInfo);
Debug.Assert(delegateType is { });

var unboundLambda = (UnboundLambda)source;
if ((destination.SpecialType == SpecialType.System_Delegate || destination.IsNonGenericExpressionType()) &&
syntax.IsFeatureEnabled(MessageID.IDS_FeatureInferredDelegateType))
if (source.Kind == BoundKind.UnboundLambda &&
destination.IsNonGenericExpressionType())
{
CompoundUseSiteInfo<AssemblySymbol> useSiteInfo = GetNewCompoundUseSiteInfo(diagnostics);
var delegateType = unboundLambda.InferDelegateType(ref useSiteInfo);
BoundLambda boundLambda;
if (delegateType is { })
{
bool isExpressionTree = destination.IsNonGenericExpressionType();
if (isExpressionTree)
{
delegateType = Compilation.GetWellKnownType(WellKnownType.System_Linq_Expressions_Expression_T).Construct(delegateType);
delegateType.AddUseSiteInfo(ref useSiteInfo);
}
boundLambda = unboundLambda.Bind(delegateType, isExpressionTree);
}
else
{
diagnostics.Add(ErrorCode.ERR_CannotInferDelegateType, syntax.GetLocation());
delegateType = CreateErrorType();
boundLambda = unboundLambda.BindForErrorRecovery();
}
diagnostics.AddRange(boundLambda.Diagnostics);
var expr = createAnonymousFunctionConversion(syntax, source, boundLambda, conversion, isCast, conversionGroup, delegateType);
conversion = Conversions.ClassifyConversionFromExpression(expr, destination, ref useSiteInfo);
diagnostics.Add(syntax, useSiteInfo);
return CreateConversion(syntax, expr, conversion, isCast, conversionGroup, destination, diagnostics);
delegateType = Compilation.GetWellKnownType(WellKnownType.System_Linq_Expressions_Expression_T).Construct(delegateType);
delegateType.AddUseSiteInfo(ref useSiteInfo);
}

conversion = Conversions.ClassifyConversionFromExpression(source, delegateType, ref useSiteInfo);
BoundExpression expr;
if (!conversion.Exists)
{
GenerateImplicitConversionError(diagnostics, syntax, conversion, source, delegateType);
expr = new BoundConversion(syntax, source, conversion, @checked: false, explicitCastInCode: isCast, conversionGroup, constantValueOpt: ConstantValue.NotAvailable, type: delegateType, hasErrors: true) { WasCompilerGenerated = source.WasCompilerGenerated };
}
else
{
#if DEBUG
// Test inferring a delegate type for all callers.
var discardedUseSiteInfo = CompoundUseSiteInfo<AssemblySymbol>.Discarded;
_ = unboundLambda.InferDelegateType(ref discardedUseSiteInfo);
#endif
var boundLambda = unboundLambda.Bind((NamedTypeSymbol)destination, isExpressionTree: destination.IsGenericOrNonGenericExpressionType(out _));
diagnostics.AddRange(boundLambda.Diagnostics);
return createAnonymousFunctionConversion(syntax, source, boundLambda, conversion, isCast, conversionGroup, destination);
expr = CreateConversion(syntax, source, conversion, isCast, conversionGroup, delegateType, diagnostics);
}

static BoundConversion createAnonymousFunctionConversion(SyntaxNode syntax, BoundExpression source, BoundLambda boundLambda, Conversion conversion, bool isCast, ConversionGroup? conversionGroup, TypeSymbol destination)
conversion = Conversions.ClassifyConversionFromExpression(expr, destination, ref useSiteInfo);
if (!conversion.Exists)
{
return new BoundConversion(
syntax,
boundLambda,
conversion,
@checked: false,
explicitCastInCode: isCast,
conversionGroup,
constantValueOpt: ConstantValue.NotAvailable,
type: destination)
{ WasCompilerGenerated = source.WasCompilerGenerated };
GenerateImplicitConversionError(diagnostics, syntax, conversion, source, destination);
}

diagnostics.Add(syntax, useSiteInfo);
return CreateConversion(syntax, expr, conversion, isCast, conversionGroup, destination, diagnostics);
}

private BoundExpression CreateAnonymousFunctionConversion(SyntaxNode syntax, BoundExpression source, Conversion conversion, bool isCast, ConversionGroup? conversionGroup, TypeSymbol destination, BindingDiagnosticBag diagnostics)
{
// We have a successful anonymous function conversion; rather than producing a node
// which is a conversion on top of an unbound lambda, replace it with the bound
// lambda.

// UNDONE: Figure out what to do about the error case, where a lambda
// UNDONE: is converted to a delegate that does not match. What to surface then?

var unboundLambda = (UnboundLambda)source;

var boundLambda = unboundLambda.Bind((NamedTypeSymbol)destination, isExpressionTree: destination.IsGenericOrNonGenericExpressionType(out _));
diagnostics.AddRange(boundLambda.Diagnostics);
return new BoundConversion(
syntax,
boundLambda,
conversion,
@checked: false,
explicitCastInCode: isCast,
conversionGroup,
constantValueOpt: ConstantValue.NotAvailable,
type: destination)
{ WasCompilerGenerated = source.WasCompilerGenerated };
}

private BoundExpression CreateMethodGroupConversion(SyntaxNode syntax, BoundExpression source, Conversion conversion, bool isCast, ConversionGroup? conversionGroup, TypeSymbol destination, BindingDiagnosticBag diagnostics)
Expand All @@ -627,29 +631,7 @@ private BoundExpression CreateMethodGroupConversion(SyntaxNode syntax, BoundExpr
hasErrors = true;
}

if (destination.SpecialType == SpecialType.System_Delegate &&
syntax.IsFeatureEnabled(MessageID.IDS_FeatureInferredDelegateType))
{
// https://github.com/dotnet/roslyn/issues/52869: Avoid calculating the delegate type multiple times during conversion.
CompoundUseSiteInfo<AssemblySymbol> useSiteInfo = GetNewCompoundUseSiteInfo(diagnostics);
var delegateType = GetMethodGroupDelegateType(group, ref useSiteInfo);
var expr = createMethodGroupConversion(syntax, group, conversion, isCast, conversionGroup, delegateType!, hasErrors);
conversion = Conversions.ClassifyConversionFromExpression(expr, destination, ref useSiteInfo);
diagnostics.Add(syntax, useSiteInfo);
return CreateConversion(syntax, expr, conversion, isCast, conversionGroup, destination, diagnostics);
}

#if DEBUG
// Test inferring a delegate type for all callers.
var discardedUseSiteInfo = CompoundUseSiteInfo<AssemblySymbol>.Discarded;
_ = GetMethodGroupDelegateType(group, ref discardedUseSiteInfo);
#endif
return createMethodGroupConversion(syntax, group, conversion, isCast, conversionGroup, destination, hasErrors);

static BoundConversion createMethodGroupConversion(SyntaxNode syntax, BoundMethodGroup group, Conversion conversion, bool isCast, ConversionGroup? conversionGroup, TypeSymbol destination, bool hasErrors)
{
return new BoundConversion(syntax, group, conversion, @checked: false, explicitCastInCode: isCast, conversionGroup, constantValueOpt: ConstantValue.NotAvailable, type: destination, hasErrors: hasErrors) { WasCompilerGenerated = group.WasCompilerGenerated };
}
return new BoundConversion(syntax, group, conversion, @checked: false, explicitCastInCode: isCast, conversionGroup, constantValueOpt: ConstantValue.NotAvailable, type: destination, hasErrors: hasErrors) { WasCompilerGenerated = group.WasCompilerGenerated };
}

private BoundExpression CreateStackAllocConversion(SyntaxNode syntax, BoundExpression source, Conversion conversion, bool isCast, ConversionGroup? conversionGroup, TypeSymbol destination, BindingDiagnosticBag diagnostics)
Expand Down Expand Up @@ -814,6 +796,7 @@ private BoundMethodGroup FixMethodGroupWithTypeOrValue(BoundMethodGroup group, C
group.LookupSymbolOpt,
group.LookupError,
group.Flags,
group.FunctionType,
receiverOpt, //only change
group.ResultKind);
}
Expand Down Expand Up @@ -1226,13 +1209,13 @@ private bool MethodGroupConversionHasErrors(
TypeSymbol delegateOrFuncPtrType,
BindingDiagnosticBag diagnostics)
{
Debug.Assert(delegateOrFuncPtrType.SpecialType == SpecialType.System_Delegate || delegateOrFuncPtrType.TypeKind == TypeKind.Delegate || delegateOrFuncPtrType.TypeKind == TypeKind.FunctionPointer);

var discardedUseSiteInfo = CompoundUseSiteInfo<AssemblySymbol>.Discarded;
Debug.Assert(Conversions.IsAssignableFromMulticastDelegate(delegateOrFuncPtrType, ref discardedUseSiteInfo) || delegateOrFuncPtrType.TypeKind == TypeKind.Delegate || delegateOrFuncPtrType.TypeKind == TypeKind.FunctionPointer);
Debug.Assert(conversion.Method is object);
MethodSymbol selectedMethod = conversion.Method;

var location = syntax.Location;
if (delegateOrFuncPtrType.SpecialType != SpecialType.System_Delegate)
if (!Conversions.IsAssignableFromMulticastDelegate(delegateOrFuncPtrType, ref discardedUseSiteInfo))
{
if (!MethodIsCompatibleWithDelegateOrFunctionPointer(receiverOpt, isExtensionMethod, selectedMethod, delegateOrFuncPtrType, location, diagnostics) ||
MemberGroupFinalValidation(receiverOpt, selectedMethod, syntax, diagnostics, isExtensionMethod))
Expand Down
Loading