Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8a790e4e
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,发现更多精彩内容 >>
提交
8a790e4e
编写于
9月 25, 2018
作者:
C
Charles Stoner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Misc.
上级
a004c2c5
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
44 addition
and
33 deletion
+44
-33
src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
+8
-0
src/Compilers/CSharp/Portable/LanguageVersion.cs
src/Compilers/CSharp/Portable/LanguageVersion.cs
+2
-2
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
...lers/CSharp/Portable/Operations/CSharpOperationFactory.cs
+1
-0
src/Compilers/CSharp/Portable/Symbols/Synthesized/InjectedNonNullTypesAttributeSymbol.cs
...ymbols/Synthesized/InjectedNonNullTypesAttributeSymbol.cs
+1
-1
src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
...rp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
+6
-6
src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs
src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs
+1
-1
src/Compilers/Core/Portable/Operations/OperationKind.cs
src/Compilers/Core/Portable/Operations/OperationKind.cs
+2
-4
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
+1
-1
src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs
.../CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs
+2
-2
src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs
...arpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs
+9
-5
src/EditorFeatures/CSharpTest/GenerateFromMembers/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersTests.cs
...rsFromMembers/AddConstructorParametersFromMembersTests.cs
+2
-2
src/EditorFeatures/CSharpTest/GenerateVariable/GenerateVariableTests.cs
...ures/CSharpTest/GenerateVariable/GenerateVariableTests.cs
+1
-1
src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests.cs
...est/ImplementAbstractClass/ImplementAbstractClassTests.cs
+2
-2
src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests.vb
...Test2/IntelliSense/CSharpCompletionCommandHandlerTests.vb
+1
-1
src/VisualStudio/Core/Test/CodeModel/CSharp/CodeClassTests.vb
...VisualStudio/Core/Test/CodeModel/CSharp/CodeClassTests.vb
+4
-4
src/Workspaces/MSBuildTest/MSBuildWorkspaceTests.cs
src/Workspaces/MSBuildTest/MSBuildWorkspaceTests.cs
+1
-1
未找到文件。
src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
浏览文件 @
8a790e4e
...
...
@@ -1596,6 +1596,14 @@ private static BoundExpression SkipReferenceConversions(BoundExpression possibly
return
possiblyConversion
;
}
// https://github.com/dotnet/roslyn/issues/30140: Track nullable state from ??=.
public
override
BoundNode
VisitNullCoalescingAssignmentOperator
(
BoundNullCoalescingAssignmentOperator
node
)
{
var
result
=
base
.
VisitNullCoalescingAssignmentOperator
(
node
);
SetResult
(
node
);
return
result
;
}
public
override
BoundNode
VisitNullCoalescingOperator
(
BoundNullCoalescingOperator
node
)
{
Debug
.
Assert
(!
IsConditionalState
);
...
...
src/Compilers/CSharp/Portable/LanguageVersion.cs
浏览文件 @
8a790e4e
...
...
@@ -332,9 +332,9 @@ public static LanguageVersion MapSpecifiedToEffectiveVersion(this LanguageVersio
switch
(
version
)
{
case
LanguageVersion
.
Latest
:
return
LanguageVersion
.
CSharp
8
;
return
LanguageVersion
.
CSharp
7_3
;
case
LanguageVersion
.
Default
:
return
LanguageVersion
.
CSharp
8
;
return
LanguageVersion
.
CSharp
7
;
default
:
return
version
;
}
...
...
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
浏览文件 @
8a790e4e
...
...
@@ -273,6 +273,7 @@ private IOperation CreateInternal(BoundNode boundNode)
case
BoundKind
.
RefValueOperator
:
case
BoundKind
.
Sequence
:
case
BoundKind
.
StackAllocArrayCreation
:
case
BoundKind
.
SuppressNullableWarningExpression
:
case
BoundKind
.
TypeExpression
:
case
BoundKind
.
TypeOrValueExpression
:
...
...
src/Compilers/CSharp/Portable/Symbols/Synthesized/InjectedNonNullTypesAttributeSymbol.cs
浏览文件 @
8a790e4e
...
...
@@ -36,7 +36,7 @@ ImmutableArray<MethodSymbol> makeConstructor(CSharpCompilation compilation, Name
Binder
.
ReportUseSiteDiagnostics
(
boolType
,
diagnostics
,
Location
.
None
);
var
boolWithAnnotations
=
TypeSymbolWithAnnotations
.
Create
(
boolType
);
// PROTOTYPE
c
onstructor should save the parameter into a field (for users of reflection)
// PROTOTYPE
(NullableReferenceTypes): C
onstructor should save the parameter into a field (for users of reflection)
return
ImmutableArray
.
Create
<
MethodSymbol
>(
new
NonNullTypesAttributeConstructorSymbol
(
containingType
,
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
浏览文件 @
8a790e4e
...
...
@@ -1000,8 +1000,8 @@ namespace NotMicrosoft.CodeAnalysis { }
((NamespaceSymbol)comp.SourceModule.GlobalNamespace.GetMember("Microsoft.CodeAnalysis")).GetMembers().Single().ToTestDisplayString());
}
// PROTOTYPE
Test emitting netmodule (we'll
won't inject NNT)
// PROTOTYPE
t
est script
// PROTOTYPE
(NullableReferenceTypes): Test emitting netmodule (we
won't inject NNT)
// PROTOTYPE
(NullableReferenceTypes): T
est script
[Theory]
[InlineData(NonNullTypesTrue)]
...
...
@@ -7359,7 +7359,7 @@ partial class C1
{ }
}";
var compilation = CreateCompilation(new[] { source, NonNullTypesTrue });
// PROTOTYPE(NullReferenceTypes): What nullability is getting emitted?
// PROTOTYPE(Null
able
ReferenceTypes): What nullability is getting emitted?
compilation.VerifyDiagnostics(
// (16,18): warning CS8611: Nullability of reference types in type of parameter 'x' doesn't match partial method declaration.
// partial void M1<T>(T? x, T[]? y, System.Action<T?> z, System.Action<T?[]?>?[]? u) where T : class
...
...
@@ -7492,7 +7492,7 @@ partial class C1
{ }
}";
var compilation = CreateCompilation(new[] { source });
// PROTOTYPE(NullReferenceTypes): Missing WRN_MissingNonNullTypesContextForAnnotation for '?' in
// PROTOTYPE(Null
able
ReferenceTypes): Missing WRN_MissingNonNullTypesContextForAnnotation for '?' in
// (17,18):
// partial void M1<T>(T? x, T[]? y, System.Action<T?> z, System.Action<T?[]?>?[]? u) where T : class
compilation.VerifyDiagnostics(
...
...
@@ -8187,7 +8187,7 @@ class CL1
{
}
", NonNullTypesTrue });
// PROTOTYPE(NullReferenceTypes): Should report WRN_NullReferenceAssignment for `ref x3`
// PROTOTYPE(Null
able
ReferenceTypes): Should report WRN_NullReferenceAssignment for `ref x3`
// even though the local is unassigned. (The local should be treated as an l-value for assignment.)
c.VerifyDiagnostics(
// (12,12): warning CS8604: Possible null reference argument for parameter 'p' in 'void C.M1(CL1 p)'.
...
...
@@ -25276,7 +25276,7 @@ class CL1
}
}
", NonNullTypesTrue });
// PROTOTYPE(NullReferenceTypes): Should report WRN_NullReferenceAssignment for `x7--`
// PROTOTYPE(Null
able
ReferenceTypes): Should report WRN_NullReferenceAssignment for `x7--`
// even though the local is unassigned. (The local should be treated as an l-value for assignment.)
c.VerifyDiagnostics(
// (10,21): warning CS8604: Possible null reference argument for parameter 'x' in 'CL0 CL0.operator ++(CL0 x)'.
src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs
浏览文件 @
8a790e4e
...
...
@@ -288,7 +288,7 @@ public class B
var
countedTree
=
new
CountedSyntaxTree
(
foreignType
);
var
compilation
=
CreateCompilation
(
new
SyntaxTree
[]
{
underlyingTree
,
countedTree
});
var
compilation
=
CreateCompilation
(
new
SyntaxTree
[]
{
underlyingTree
,
countedTree
}
,
skipUsesIsNullable
:
true
);
var
type
=
compilation
.
Assembly
.
GlobalNamespace
.
GetTypeMembers
().
First
();
Assert
.
Equal
(
1
,
countedTree
.
AccessCount
);
// parse once to build the decl table
...
...
src/Compilers/Core/Portable/Operations/OperationKind.cs
浏览文件 @
8a790e4e
...
...
@@ -192,7 +192,6 @@ public enum OperationKind
ConstructorBodyOperation
=
0x59
,
/// <summary>Indicates an <see cref="IDiscardOperation"/>.</summary>
Discard
=
0x5A
,
/// <summary>Indicates an <see cref="IFlowCaptureOperation"/>.</summary>
FlowCapture
=
0x5B
,
/// <summary>Indicates an <see cref="IFlowCaptureReferenceOperation"/>.</summary>
...
...
@@ -205,11 +204,10 @@ public enum OperationKind
StaticLocalInitializationSemaphore
=
0x5F
,
/// <summary>Indicates an <see cref="IFlowAnonymousFunctionOperation"/>.</summary>
FlowAnonymousFunction
=
0x60
,
/// <summary>Indicates an <see cref="ISuppressNullableWarningOperation"/>.</summary>
SuppressNullableWarning
=
0x61
,
/// <summary>Indicates an <see cref="ICoalesceAssignmentOperation"/>.</summary>
CoalesceAssignment
=
0x61
,
/// <summary>Indicates an <see cref="ISuppressNullableWarningOperation"/>.</summary>
SuppressNullableWarning
=
0x62
,
// /// <summary>Indicates an <see cref="IFixedOperation"/>.</summary>
// https://github.com/dotnet/roslyn/issues/21281
...
...
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
浏览文件 @
8a790e4e
...
...
@@ -29,7 +29,7 @@ Microsoft.CodeAnalysis.FlowAnalysis.IStaticLocalInitializationSemaphoreOperation
Microsoft.CodeAnalysis.FlowAnalysis.IStaticLocalInitializationSemaphoreOperation.Local.get -> Microsoft.CodeAnalysis.ILocalSymbol
Microsoft.CodeAnalysis.IOperation.SemanticModel.get -> Microsoft.CodeAnalysis.SemanticModel
Microsoft.CodeAnalysis.OperationKind.CoalesceAssignment = 97 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.SuppressNullableWarning = 9
7
-> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.SuppressNullableWarning = 9
8
-> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.Operations.CommonConversion.IsImplicit.get -> bool
Microsoft.CodeAnalysis.Operations.ICoalesceAssignmentOperation
Microsoft.CodeAnalysis.Operations.ISuppressNullableWarningOperation
...
...
src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs
浏览文件 @
8a790e4e
...
...
@@ -1536,7 +1536,7 @@ internal class T
{
public T(out DateTime d)
{
d = default;
d = default
(DateTime)
;
}
}"
,
index
:
1
);
...
...
@@ -1684,7 +1684,7 @@ private class T
{
public T(out X d)
{
d = default;
d = default
(X)
;
}
}
}"
,
...
...
src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs
浏览文件 @
8a790e4e
...
...
@@ -550,7 +550,8 @@ void A()
</Project>
</Workspace>"
,
new
[]
{
string
.
Format
(
CSharpFeaturesResources
.
Upgrade_this_project_to_csharp_language_version_0
,
"7.0"
)
string
.
Format
(
CSharpFeaturesResources
.
Upgrade_this_project_to_csharp_language_version_0
,
"7.0"
),
string
.
Format
(
CSharpFeaturesResources
.
Upgrade_all_csharp_projects_to_language_version_0
,
"7.0"
)
});
}
...
...
@@ -584,13 +585,16 @@ public async Task OnlyOfferFixAllProjectsToDefaultWhenApplicable()
string
defaultEffectiveVersion
=
LanguageVersion
.
Default
.
MapSpecifiedToEffectiveVersion
().
ToDisplayString
();
await
TestExactActionSetOfferedAsync
(
@"<Workspace>
$
@"<Workspace>
<Project Language=""C#"" LanguageVersion=""6"">
<Document>
class C
{
object F = [|null!|];
}
{{
void
A
()
{{
#error version:[|{defaultEffectiveVersion}|]
}}
}}
</Document>
</Project>
<Project Language=""C#"" LanguageVersion=""Default"">
...
...
src/EditorFeatures/CSharpTest/GenerateFromMembers/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersTests.cs
浏览文件 @
8a790e4e
...
...
@@ -326,7 +326,7 @@ public Program((int, string) i)
(int, string) i;
(string, int) s;
public Program((int, string) i, (string, int) s = default)
public Program((int, string) i, (string, int) s = default
((string, int))
)
{
this.i = i;
this.s = s;
...
...
@@ -382,7 +382,7 @@ public Program((int a, string b) i)
(int a, string b) i;
(string c, int d) s;
public Program((int a, string b) i, (string c, int d) s = default)
public Program((int a, string b) i, (string c, int d) s = default
((string c, int d))
)
{
this.i = i;
this.s = s;
...
...
src/EditorFeatures/CSharpTest/GenerateVariable/GenerateVariableTests.cs
浏览文件 @
8a790e4e
...
...
@@ -3991,7 +3991,7 @@ void bar(sfoo x)
{
void goo()
{
sfoo xyz = default;
sfoo xyz = default
(sfoo)
;
bar(xyz);
}
...
...
src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests.cs
浏览文件 @
8a790e4e
...
...
@@ -459,7 +459,7 @@ abstract class d
class c : d
{
public override void goo(b x = default)
public override void goo(b x = default
(b)
)
{
throw new System.NotImplementedException();
}
...
...
@@ -1564,7 +1564,7 @@ abstract class B
}
sealed class D : B
{
public override void M1(int i = 0, string s = null, int? j = null, V v = default)
public override void M1(int i = 0, string s = null, int? j = null, V v = default
(V)
)
{
throw new System.NotImplementedException();
}
...
...
src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests.vb
浏览文件 @
8a790e4e
...
...
@@ -1949,7 +1949,7 @@ class D : C
state
.
SendTypeChars
(
" Goo"
)
state
.
SendTab
()
Await
state
.
AssertNoCompletionSession
()
Assert
.
Contains
(
"public override void Goo<S>(S x = default)"
,
state
.
SubjectBuffer
.
CurrentSnapshot
.
GetText
(),
StringComparison
.
Ordinal
)
Assert
.
Contains
(
"public override void Goo<S>(S x = default
(S)
)"
,
state
.
SubjectBuffer
.
CurrentSnapshot
.
GetText
(),
StringComparison
.
Ordinal
)
End
Using
End
Function
...
...
src/VisualStudio/Core/Test/CodeModel/CSharp/CodeClassTests.vb
浏览文件 @
8a790e4e
...
...
@@ -2160,7 +2160,7 @@ class C
{
string
Name
{
get
=>
default
;
get
=>
default
(
string
)
;
set
{
}
...
...
@@ -2188,7 +2188,7 @@ class C
{
get
{
return
default
;
return
default
(
string
)
;
}
set
...
...
@@ -2220,7 +2220,7 @@ class C$$
<
Code
>
class
C
{
string
Name
=>
default
;
string
Name
=>
default
(
string
)
;
}
</
Code
>
...
...
@@ -2244,7 +2244,7 @@ class C
{
get
{
return
default
;
return
default
(
string
)
;
}
}
}
...
...
src/Workspaces/MSBuildTest/MSBuildWorkspaceTests.cs
浏览文件 @
8a790e4e
...
...
@@ -1765,7 +1765,7 @@ public async Task TestParseOptions_CSharp_Compatibility_None()
public
async
Task
TestParseOptions_CSharp_LanguageVersion_Default
()
{
CreateCSharpFiles
();
await
AssertCSParseOptionsAsync
(
CS
.
LanguageVersion
.
CSharp
8
,
options
=>
options
.
LanguageVersion
);
await
AssertCSParseOptionsAsync
(
CS
.
LanguageVersion
.
CSharp
7
,
options
=>
options
.
LanguageVersion
);
}
[
ConditionalFact
(
typeof
(
VisualStudioMSBuildInstalled
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
MSBuildWorkspace
)]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录