Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
039f7041
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
039f7041
编写于
7月 05, 2016
作者:
E
Evan Hauck
提交者:
Jared Parsons
4月 26, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Go through all prototype comments and clean resolved ones.
上级
07ae3f88
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
34 addition
and
148 deletion
+34
-148
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
+1
-6
src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs
src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs
+2
-7
src/Compilers/CSharp/Portable/Binder/Binder_Lookup.cs
src/Compilers/CSharp/Portable/Binder/Binder_Lookup.cs
+0
-21
src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolution.cs
...Binder/Semantics/OverloadResolution/OverloadResolution.cs
+0
-4
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs
...arp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs
+1
-1
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PropertyAccess.cs
...le/Lowering/LocalRewriter/LocalRewriter_PropertyAccess.cs
+1
-2
src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.Members.cs
...rp/Portable/SymbolDisplay/SymbolDisplayVisitor.Members.cs
+1
-0
src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEMethodSymbol.cs
...ers/CSharp/Portable/Symbols/Metadata/PE/PEMethodSymbol.cs
+0
-2
src/Compilers/CSharp/Portable/Symbols/NamedTypeSymbol.cs
src/Compilers/CSharp/Portable/Symbols/NamedTypeSymbol.cs
+0
-1
src/Compilers/CSharp/Portable/Symbols/PropertySymbol.cs
src/Compilers/CSharp/Portable/Symbols/PropertySymbol.cs
+1
-1
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
...rp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
+0
-5
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs
...Sharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs
+0
-2
src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbol.cs
...lers/CSharp/Portable/Symbols/Source/SourceMethodSymbol.cs
+0
-1
src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs
...s/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs
+2
-3
src/Compilers/CSharp/Portable/Symbols/SubstitutedMethodSymbol.cs
...pilers/CSharp/Portable/Symbols/SubstitutedMethodSymbol.cs
+1
-15
src/Compilers/CSharp/Portable/Symbols/Symbol.cs
src/Compilers/CSharp/Portable/Symbols/Symbol.cs
+4
-3
src/Compilers/CSharp/Portable/Symbols/SymbolExtensions.cs
src/Compilers/CSharp/Portable/Symbols/SymbolExtensions.cs
+0
-1
src/Compilers/CSharp/Portable/Symbols/UnreducedExtensionMethodSymbol.cs
...CSharp/Portable/Symbols/UnreducedExtensionMethodSymbol.cs
+4
-67
src/Compilers/CSharp/Portable/Symbols/UnreducedExtensionPropertySymbol.cs
...harp/Portable/Symbols/UnreducedExtensionPropertySymbol.cs
+3
-3
src/Compilers/CSharp/Test/Semantic/Semantics/ExtensionEverythingTests.cs
...Sharp/Test/Semantic/Semantics/ExtensionEverythingTests.cs
+13
-3
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
浏览文件 @
039f7041
...
...
@@ -5427,11 +5427,6 @@ private static void CopyExtensionMethodArguments(AnalyzedArguments originalArgum
Debug
.
Assert
(
lookupResult
.
IsMultiViable
);
Debug
.
Assert
(
lookupResult
.
Symbols
.
Any
());
// PROTOTYPE: Include the below code?
//HashSet<DiagnosticInfo> useSiteDiagnostics = null;
//OverloadResolution.BestExtensionOverloadResolution(lookupResult.Symbols, ref useSiteDiagnostics);
//diagnostics.Add(node, useSiteDiagnostics);
var
members
=
ArrayBuilder
<
Symbol
>.
GetInstance
();
BoundExpression
result
;
bool
wasError
;
...
...
@@ -5559,7 +5554,7 @@ private static void CopyExtensionMethodArguments(AnalyzedArguments originalArgum
{
for
(
int
i
=
methodGroup
.
Methods
.
Count
-
1
;
i
>=
0
;
i
--)
{
// PROTOTYPE:
I think this (the extension class) is wrong. For example, type constraints might not match on the receiver.
// PROTOTYPE:
This (the extension class) is wrong. Need to check type compatibility, constraints, etc. (which is what Reduce() == null does)
if
(
methodGroup
.
Methods
[
i
].
IsInExtensionClass
)
continue
;
if
((
object
)
methodGroup
.
Methods
[
i
].
ReduceExtensionMethod
(
left
.
Type
)
==
null
)
methodGroup
.
Methods
.
RemoveAt
(
i
);
}
...
...
src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs
浏览文件 @
039f7041
...
...
@@ -888,13 +888,8 @@ private static void CheckRestrictedTypeReceiver(BoundExpression expression, Comp
// Method resolution should never return method kind of UnreducedExtension
Debug
.
Assert
(
method
.
MethodKind
!=
MethodKind
.
UnreducedExtension
);
// Skip building up a new array if the first argument doesn't have to be modified.
// PROTOTYPE: Deal with the comment and commented-out code.
// Because the receiver didn't pass through CoerceArguments, we need to apply an appropriate
// conversion here.
//Debug.Assert(method.ParameterCount > 0);
//Debug.Assert(argsToParams.IsDefault || argsToParams[0] == 0);
//BoundExpression convertedReceiver = CreateConversion(receiver, methodResult.Result.ConversionForArg(0), method.Parameters[0].Type, diagnostics);
// PROTOTYPE: Ensure that the receiver is converted appropriately to the method's receiver type, especially for extension methods.
// Might need to call CreateConversion(receiver, conversionForReceiver, targetType, diagnostics).
var
args
=
analyzedArguments
.
Arguments
.
ToImmutable
();
// This will be the receiver of the BoundCall node that we create.
...
...
src/Compilers/CSharp/Portable/Binder/Binder_Lookup.cs
浏览文件 @
039f7041
...
...
@@ -737,27 +737,6 @@ internal virtual bool SupportsExtensionMembers
if
(!
result
.
IsMultiViable
&&
(
options
&
LookupOptions
.
IncludeExtensionMethods
)
!=
0
)
{
originalBinder
.
LookupExtensionMembers
(
result
,
name
,
arity
,
options
,
ref
useSiteDiagnostics
);
// PROTOTYPE: Deal with commented out code here
/*
var tempResult = LookupResult.GetInstance();
originalBinder.LookupExtensionMembers(tempResult, name, arity, options, ref useSiteDiagnostics);
// PROTOTYPE: Provide better errors on lookup failure?
// PROTOTYPE: Extension methods found through member lookup go through this trimming twice (one here, one in overload resolution). Fix?
if (tempResult.IsMultiViable)
{
foreach (var extension in tempResult.Symbols)
{
var method = extension as MethodSymbol;
var receiverType = ((object)method != null && method.MethodKind == MethodKind.ReducedExtension) ? method.ReceiverType : extension.ContainingType.ExtensionClassType;
var conversion = Conversions.ClassifyImplicitConversion(type, receiverType, ref useSiteDiagnostics);
if (ConversionsBase.IsValidExtensionMethodThisArgConversion(conversion))
{
result.MergeEqual(new SingleLookupResult(LookupResultKind.Viable, extension, null));
}
}
}
tempResult.Free();
*/
}
visited
?.
Free
();
...
...
src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolution.cs
浏览文件 @
039f7041
...
...
@@ -275,10 +275,6 @@ private static bool OverloadResolutionResultIsValid<TMember>(ArrayBuilder<Member
return
;
}
// Not spec'ed yet: Extension Everything overload resolution based on receiver type
// PROTOTYPE: We might remove the only applicable member, only to be left with no applicable methods left.
//BestExtensionReceiverResolution(results, ref useSiteDiagnostics);
// SPEC: The best method of the set of candidate methods is identified. If a single best method cannot be identified,
// SPEC: the method invocation is ambiguous, and a binding-time error occurs.
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs
浏览文件 @
039f7041
...
...
@@ -169,7 +169,7 @@ public override BoundNode VisitCall(BoundCall node)
if
(
invokedAsExtensionMethod
)
{
Debug
.
Assert
(
method
.
IsInExtensionClass
||
method
.
MethodKind
==
MethodKind
.
ReducedExtension
);
method
=
method
.
UnreduceExtensionMethod
();
// PROTOTYPE: Will be renamed eventually, but this method also handles reduced ext methods
method
=
method
.
UnreduceExtensionMethod
();
}
// We have already lowered each argument, but we may need some additional rewriting for the arguments,
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PropertyAccess.cs
浏览文件 @
039f7041
...
...
@@ -52,7 +52,6 @@ private BoundExpression VisitPropertyAccess(BoundPropertyAccess node, bool isLef
// This is a property set access. We return a BoundPropertyAccess node here.
// This node will be rewritten with MakePropertyAssignment when rewriting the enclosing BoundAssignmentOperator.
// PROTOTYPE: Handle extension properties
return
oldNodeOpt
!=
null
?
oldNodeOpt
.
Update
(
rewrittenReceiverOpt
,
propertySymbol
,
resultKind
,
type
)
:
new
BoundPropertyAccess
(
syntax
,
rewrittenReceiverOpt
,
propertySymbol
,
resultKind
,
type
);
...
...
@@ -68,7 +67,7 @@ private BoundExpression MakePropertyGetAccess(CSharpSyntaxNode syntax, BoundExpr
{
var
rewrittenArguments
=
ImmutableArray
<
BoundExpression
>.
Empty
;
Debug
.
Assert
(!
(
property
is
UnreducedExtensionPropertySymbol
)
);
Debug
.
Assert
(!
property
.
IsUnreducedExtensionMember
);
property
=
property
.
UnreduceExtensionProperty
()
??
property
;
var
getMethod
=
property
.
GetOwnOrInheritedGetMethod
();
...
...
src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.Members.cs
浏览文件 @
039f7041
...
...
@@ -11,6 +11,7 @@ namespace Microsoft.CodeAnalysis.CSharp
{
internal
partial
class
SymbolDisplayVisitor
{
// PROTOTYPE: Handle extension class members nicely
private
const
string
IL_KEYWORD_MODOPT
=
"modopt"
;
private
const
string
IL_KEYWORD_MODREQ
=
"modreq"
;
...
...
src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEMethodSymbol.cs
浏览文件 @
039f7041
...
...
@@ -670,7 +670,6 @@ public override bool IsExtensionMethod
{
get
{
// PROTOTYPE: Extension class members?
// This is also populated by loading attributes, but
// loading attributes is more expensive, so we should only do it if
// attributes are requested.
...
...
@@ -701,7 +700,6 @@ public override ImmutableArray<CSharpAttributeData> GetAttributes()
var
attributeData
=
default
(
ImmutableArray
<
CSharpAttributeData
>);
var
containingPEModuleSymbol
=
_containingType
.
ContainingPEModule
;
// PROTOTYPE: Extension class members
// Could this possibly be an extension method?
bool
alreadySet
=
_packedFlags
.
IsExtensionMethodIsPopulated
;
bool
checkForExtension
=
alreadySet
...
...
src/Compilers/CSharp/Portable/Symbols/NamedTypeSymbol.cs
浏览文件 @
039f7041
...
...
@@ -421,7 +421,6 @@ public ImmutableArray<Symbol> GetUnderlyingMembers()
internal
void
GetExtensionMembers
(
ArrayBuilder
<
Symbol
>
members
,
string
nameOpt
,
int
arity
,
LookupOptions
options
)
{
// PROTOTYPE: Find refs of these two props and make sure both are considered.
if
(
this
.
MightContainExtensionMembers
)
{
DoGetExtensionMembers
(
members
,
nameOpt
,
arity
,
options
);
...
...
src/Compilers/CSharp/Portable/Symbols/PropertySymbol.cs
浏览文件 @
039f7041
...
...
@@ -306,7 +306,7 @@ public PropertySymbol ReduceExtensionProperty()
/// </summary>
public
PropertySymbol
UnreduceExtensionProperty
()
{
Debug
.
Assert
(!
(
this
is
UnreducedExtensionPropertySymbol
)
);
Debug
.
Assert
(!
this
.
IsUnreducedExtensionMember
);
if
(!
this
.
IsInExtensionClass
)
return
null
;
...
...
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
浏览文件 @
039f7041
...
...
@@ -1308,11 +1308,6 @@ private MembersAndInitializers GetMembersAndInitializers()
var
memberNames
=
ArrayBuilder
<
string
>.
GetInstance
(
membersDictionary
.
Count
);
memberNames
.
AddRange
(
membersDictionary
.
Keys
);
MergePartialMembers
(
memberNames
,
membersDictionary
,
diagnostics
);
if
(
this
.
IsExtensionClass
)
{
// PROTOTYPE: Is this needed?
//ReplaceExtensionClassMembers(memberNames, membersDictionary, diagnostics);
}
memberNames
.
Free
();
AddDeclarationDiagnostics
(
diagnostics
);
state
.
NotePartComplete
(
CompletionPart
.
Members
);
...
...
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs
浏览文件 @
039f7041
...
...
@@ -179,8 +179,6 @@ private void MethodChecks(MethodDeclarationSyntax syntax, Binder withTypeParamsB
var
parameter0Type
=
this
.
Parameters
[
0
].
Type
;
if
(
this
.
IsInExtensionClass
)
{
// PROTOTYPE: figure out what the priority of this error is relative to the others in this if-else chain
// (only one diagnostic is reported, so figure out what's most important - or maybe report multiple)
diagnostics
.
Add
(
ErrorCode
.
ERR_ExtensionMethodInExtensionClass
,
location
);
}
else
if
(!
parameter0Type
.
IsValidExtensionParameterType
())
...
...
src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbol.cs
浏览文件 @
039f7041
...
...
@@ -382,7 +382,6 @@ public override bool IsExtensionMethod
{
get
{
// PROTOTYPE: Should this include IsInExtensionClass?
return
this
.
flags
.
IsExtensionMethod
;
}
}
...
...
src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs
浏览文件 @
039f7041
...
...
@@ -1130,8 +1130,6 @@ public override Symbol GetUnderlyingMember(Symbol symbol)
switch
(
symbol
.
Kind
)
{
case
SymbolKind
.
Property
:
// PROTOTYPE: this is weird.
result
=
symbol
;
{
var
property
=
(
PropertySymbol
)
symbol
;
if
(
property
.
IsStatic
)
...
...
@@ -1158,7 +1156,8 @@ public override Symbol GetUnderlyingMember(Symbol symbol)
}
else
{
result
=
UnreducedExtensionMethodSymbol
.
Create
(
method
);
var
constructedFrom
=
method
.
ConstructedFrom
;
result
=
new
UnreducedExtensionMethodSymbol
(
constructedFrom
);
}
// PROTOTYPE: Generics/construction of result? (probably put in Create method)
break
;
...
...
src/Compilers/CSharp/Portable/Symbols/SubstitutedMethodSymbol.cs
浏览文件 @
039f7041
...
...
@@ -146,6 +146,7 @@ public sealed override MethodSymbol OriginalDefinition
}
}
// PROTOTYPE: The only usage of this property is in tests. Is it needed?
internal
sealed
override
MethodSymbol
CallsiteReducedFromMethod
{
get
...
...
@@ -155,21 +156,6 @@ internal sealed override MethodSymbol CallsiteReducedFromMethod
}
}
public
override
TypeSymbol
ReceiverType
{
get
{
// PROTOTYPE: Figure this out? What is CallsiteReducedFromMethod (this is only non-test usage)
var
reduced
=
this
.
CallsiteReducedFromMethod
;
if
((
object
)
reduced
==
null
)
{
return
this
.
ContainingType
;
}
return
reduced
.
Parameters
[
0
].
Type
;
}
}
public
override
TypeSymbol
GetTypeInferredDuringReduction
(
TypeParameterSymbol
reducedFromTypeParameter
)
{
// This will throw if API shouldn't be supported or there is a problem with the argument.
...
...
src/Compilers/CSharp/Portable/Symbols/Symbol.cs
浏览文件 @
039f7041
...
...
@@ -414,13 +414,14 @@ public bool IsUnreducedExtensionMember
switch
(
this
.
Kind
)
{
case
SymbolKind
.
Method
:
switch
(((
MethodSymbol
)
this
).
MethodKind
)
var
method
=
(
MethodSymbol
)
this
;
switch
(
method
.
MethodKind
)
{
case
MethodKind
.
UnreducedExtension
:
return
true
;
default
:
// PROTOTYPE:
Do methods with `this` parameter count? (the unreduced form)
return
false
;
// PROTOTYPE:
PE extension class symbols are unreduced, once those are implemented.
return
method
.
IsStatic
&&
method
.
IsExtensionMethod
;
}
case
SymbolKind
.
Property
:
return
this
is
UnreducedExtensionPropertySymbol
;
...
...
src/Compilers/CSharp/Portable/Symbols/SymbolExtensions.cs
浏览文件 @
039f7041
...
...
@@ -338,7 +338,6 @@ internal static ImmutableArray<TypeSymbol> ToTypes(this ImmutableArray<TypeWithM
/// </summary>
public
static
MethodSymbol
GetConstructedUnreducedFrom
(
this
MethodSymbol
method
)
{
// PROTOTYPE: Finish this method?
if
(
method
.
MethodKind
!=
MethodKind
.
UnreducedExtension
)
{
// not a unreduced extension method
...
...
src/Compilers/CSharp/Portable/Symbols/UnreducedExtensionMethodSymbol.cs
浏览文件 @
039f7041
...
...
@@ -25,71 +25,15 @@ internal sealed class UnreducedExtensionMethodSymbol : MethodSymbol
private
readonly
ImmutableArray
<
TypeSymbol
>
_typeArguments
;
private
ImmutableArray
<
ParameterSymbol
>
_lazyParameters
;
/// <summary>
/// Return the extension method in unreduced form if the extension method
/// is applicable, and satisfies type parameter constraints, based on the
/// "this" argument type. Otherwise, returns null.
/// </summary>
public
static
MethodSymbol
Create
(
MethodSymbol
method
,
TypeSymbol
receiverType
,
Compilation
compilation
)
{
Debug
.
Assert
(
method
.
IsInExtensionClass
&&
method
.
MethodKind
!=
MethodKind
.
UnreducedExtension
);
Debug
.
Assert
((
object
)
receiverType
!=
null
);
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
=
null
;
// PROTOTYPE: fix this, left over from ReducedExtensionMethodSymbol
method
=
method
.
InferExtensionMethodTypeArguments
(
receiverType
,
compilation
,
ref
useSiteDiagnostics
);
if
((
object
)
method
==
null
)
{
return
null
;
}
var
conversions
=
new
TypeConversions
(
method
.
ContainingAssembly
.
CorLibrary
);
var
conversion
=
conversions
.
ConvertExtensionMethodThisArg
(
method
.
Parameters
[
0
].
Type
,
receiverType
,
ref
useSiteDiagnostics
);
if
(!
conversion
.
Exists
)
{
return
null
;
}
if
(
useSiteDiagnostics
!=
null
)
{
foreach
(
var
diag
in
useSiteDiagnostics
)
{
if
(
diag
.
Severity
==
DiagnosticSeverity
.
Error
)
{
return
null
;
}
}
}
return
Create
(
method
);
}
public
static
MethodSymbol
Create
(
MethodSymbol
method
)
{
Debug
.
Assert
(
method
.
IsInExtensionClass
&&
method
.
MethodKind
!=
MethodKind
.
UnreducedExtension
);
// The unreduced form is always created from the unconstructed method symbol.
var
constructedFrom
=
method
.
ConstructedFrom
;
var
unreducedMethod
=
new
UnreducedExtensionMethodSymbol
(
constructedFrom
);
if
(
constructedFrom
==
method
)
{
return
unreducedMethod
;
}
// If the given method is a constructed method, the same type arguments
// are applied to construct the result from the unreduced form.
Debug
.
Assert
(!
method
.
TypeArguments
.
IsEmpty
);
return
unreducedMethod
.
Construct
(
method
.
TypeArguments
);
}
private
UnreducedExtensionMethodSymbol
(
MethodSymbol
unreducedFrom
)
public
UnreducedExtensionMethodSymbol
(
MethodSymbol
unreducedFrom
)
{
Debug
.
Assert
((
object
)
unreducedFrom
!=
null
);
Debug
.
Assert
(
unreducedFrom
.
IsInExtensionClass
);
// Should never try to unreduce a reduced symbol - callers of this should have short-circuited.
Debug
.
Assert
((
object
)
unreducedFrom
.
ReducedFrom
==
null
);
Debug
.
Assert
((
object
)
unreducedFrom
.
UnreducedFrom
==
null
);
Debug
.
Assert
(
unreducedFrom
.
ConstructedFrom
==
unreducedFrom
);
Debug
.
Assert
(
unreducedFrom
.
MethodKind
!=
MethodKind
.
UnreducedExtension
);
_unreducedFrom
=
unreducedFrom
;
_typeMap
=
TypeMap
.
Empty
.
WithAlphaRename
(
unreducedFrom
,
this
,
out
_typeParameters
);
...
...
@@ -103,9 +47,6 @@ internal override bool TryGetThisParameter(out ParameterSymbol thisParameter)
return
true
;
}
// PROTOTYPE: Do we need to return something from here? (return null is same as base virtual property)
internal
override
MethodSymbol
CallsiteReducedFromMethod
=>
null
;
public
override
TypeSymbol
ReceiverType
=>
null
;
internal
override
TypeSymbol
GetTypeInferredDuringUnreduction
(
TypeParameterSymbol
unreducedFromTypeParameter
)
...
...
@@ -123,9 +64,6 @@ internal override TypeSymbol GetTypeInferredDuringUnreduction(TypeParameterSymbo
return
null
;
}
// PROTOTYPE: Same comment as CallsiteReducedFromMethod
public
override
MethodSymbol
ReducedFrom
=>
null
;
public
override
MethodSymbol
UnreducedFrom
=>
_unreducedFrom
;
public
override
MethodSymbol
ConstructedFrom
...
...
@@ -247,7 +185,6 @@ public override ImmutableArray<ParameterSymbol> Parameters
}
}
// PROTOTYPE: Not here, but need to test explicit interface impls in extension class (should produce error)
internal
override
bool
IsExplicitInterfaceImplementation
=>
false
;
public
override
ImmutableArray
<
MethodSymbol
>
ExplicitInterfaceImplementations
=>
ImmutableArray
<
MethodSymbol
>.
Empty
;
...
...
src/Compilers/CSharp/Portable/Symbols/UnreducedExtensionPropertySymbol.cs
浏览文件 @
039f7041
...
...
@@ -27,12 +27,13 @@ public UnreducedExtensionPropertySymbol(PropertySymbol unreducedFrom)
{
Debug
.
Assert
((
object
)
unreducedFrom
!=
null
);
Debug
.
Assert
(
unreducedFrom
.
IsInExtensionClass
);
Debug
.
Assert
(!
(
unreducedFrom
is
UnreducedExtensionPropertySymbol
)
);
Debug
.
Assert
(!
unreducedFrom
.
IsUnreducedExtensionMember
);
_unreducedFrom
=
unreducedFrom
;
}
// PROTOTYPE: Make virtual?
// Only use of this is when we know we have an unreduced property and want to "reduce" it
// - no need for it to be on PropertySymbol and be virtual
public
PropertySymbol
UnreducedFrom
=>
_unreducedFrom
;
public
override
Symbol
ContainingSymbol
=>
_unreducedFrom
.
ContainingSymbol
;
...
...
@@ -47,7 +48,6 @@ public UnreducedExtensionPropertySymbol(PropertySymbol unreducedFrom)
public
override
MethodSymbol
SetMethod
=>
_unreducedFrom
.
SetMethod
?.
UnreduceExtensionMethod
();
// PROTOTYPE: extra parameters causing problems? (find references of IsIndexer)
public
override
bool
IsIndexer
=>
_unreducedFrom
.
IsIndexer
;
public
override
bool
IsAbstract
=>
_unreducedFrom
.
IsAbstract
;
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/ExtensionEverythingTests.cs
浏览文件 @
039f7041
...
...
@@ -875,8 +875,17 @@ class BaseClass
extension class ExtClass : BaseClass
{
public int this[int a, int b = 4, params int[] c] =>
Log(a + b + c.Sum(), ""["" + a + b + string.Join("""", c) + ""]"");
public int this[int a, int b = 4, params int[] c]
{
get
{
return Log(a + b + c.Sum(), ""["" + a + b + string.Join("""", c) + ""]"");
}
set
{
Console.Write(""["" + a + b + string.Join("""", c) + ""]="" + value);
}
}
public int Func(int a, int b = 4, params int[] c) =>
Log(a + b + c.Sum(), ""("" + a + b + string.Join("","", c) + "")"");
public static int StaticFunc(int a, int b = 4, params int[] c) =>
...
...
@@ -890,6 +899,7 @@ static void Main()
Console.Write(Log(new BaseClass(), ""1"")[c: new[] { Log(1, ""2""), Log(2, ""3"") }, a: Log(3, ""4"")]);
Console.Write(Log(new BaseClass(), ""1"").Func(c: new[] { Log(1, ""2""), Log(2, ""3"") }, a: Log(3, ""4"")));
Console.Write(BaseClass.StaticFunc(c: new[] { Log(1, ""1""), Log(2, ""2"") }, a: Log(3, ""3"")));
Log(new BaseClass(), ""1"")[c: new[] { Log(1, ""2""), Log(2, ""3"") }, a: Log(3, ""4"")] = 5;
}
}
"
;
...
...
@@ -897,7 +907,7 @@ static void Main()
CompileAndVerify
(
source
:
text
,
additionalRefs
:
additionalRefs
,
expectedOutput
:
"1234[3412]1234(3412)1234{3412}"
,
expectedOutput
:
"1234[3412]1234(3412)1234{3412}
1234[3412]=5
"
,
parseOptions
:
parseOptions
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录