Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
53971731
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,发现更多精彩内容 >>
未验证
提交
53971731
编写于
1月 29, 2019
作者:
J
Jared Parsons
提交者:
GitHub
1月 29, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #32913 from jaredpar/fix-test
Complete a number of nullable test issues
上级
b84562da
d9fe5db3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
21 deletion
+51
-21
src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
...rp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
+12
-12
src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs
src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs
+27
-0
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs
...CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs
+4
-3
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs
...onEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs
+4
-3
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ReferencedModulesTests.cs
.../CSharp/Test/ExpressionCompiler/ReferencedModulesTests.cs
+4
-3
未找到文件。
src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
浏览文件 @
53971731
...
...
@@ -59283,7 +59283,7 @@ static void Main()
});
}
[Fact
(Skip = "https://github.com/dotnet/roslyn/issues/30747 Type load failed.")
]
[Fact]
[WorkItem(30747, "https://github.com/dotnet/roslyn/issues/30747")]
public void MissingTypeKindBasisTypes()
{
...
...
@@ -59316,7 +59316,9 @@ interface I2
var compilation2 = CreateEmptyCompilation(source2, options: WithNonNullTypesTrue(TestOptions.ReleaseDll), references: new[] { compilation1.EmitToImageReference(), MinCorlibRef });
compilation2.VerifyEmitDiagnostics();
CompileAndVerify(compilation2);
// Verification against a corlib not named exactly mscorlib is expected to fail.
CompileAndVerify(compilation2, verify: Verification.Fails);
Assert.Equal(TypeKind.Struct, compilation2.GetTypeByMetadataName("A").TypeKind);
Assert.Equal(TypeKind.Enum, compilation2.GetTypeByMetadataName("B").TypeKind);
...
...
@@ -59327,7 +59329,7 @@ interface I2
var compilation3 = CreateEmptyCompilation(source2, options: WithNonNullTypesTrue(TestOptions.ReleaseDll), references: new[] { compilation1.ToMetadataReference(), MinCorlibRef });
compilation3.VerifyEmitDiagnostics();
CompileAndVerify(compilation3);
CompileAndVerify(compilation3
, verify: Verification.Fails
);
Assert.Equal(TypeKind.Struct, compilation3.GetTypeByMetadataName("A").TypeKind);
Assert.Equal(TypeKind.Enum, compilation3.GetTypeByMetadataName("B").TypeKind);
...
...
@@ -59369,15 +59371,13 @@ interface I2
compilation5.VerifyEmitDiagnostics(
// warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.
Diagnostic(ErrorCode.WRN_NoRuntimeMetadataVersion).WithLocation(1, 1)
);
CompileAndVerify(compilation5);
Assert.Equal(TypeKind.Struct, compilation5.GetTypeByMetadataName("A").TypeKind);
Assert.Equal(TypeKind.Enum, compilation5.GetTypeByMetadataName("B").TypeKind);
Assert.Equal(TypeKind.Class, compilation5.GetTypeByMetadataName("C").TypeKind);
Assert.Equal(TypeKind.Delegate, compilation5.GetTypeByMetadataName("D").TypeKind);
Assert.Equal(TypeKind.Interface, compilation5.GetTypeByMetadataName("I1").TypeKind);
Diagnostic(ErrorCode.WRN_NoRuntimeMetadataVersion).WithLocation(1, 1),
// error CS0518: Predefined type 'System.Attribute' is not defined or imported
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound).WithArguments("System.Attribute").WithLocation(1, 1),
// error CS0518: Predefined type 'System.Attribute' is not defined or imported
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound).WithArguments("System.Attribute").WithLocation(1, 1),
// error CS0518: Predefined type 'System.Byte' is not defined or imported
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound).WithArguments("System.Byte").WithLocation(1, 1));
var compilation6 = CreateEmptyCompilation(source2, options: WithNonNullTypesTrue(TestOptions.ReleaseDll), references: new[] { compilation1.EmitToImageReference(), MscorlibRef });
src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs
浏览文件 @
53971731
...
...
@@ -2032,6 +2032,33 @@ protected static CSharpCompilation CreateCompilationWithIndexAndRangeAndSpan(CSh
}
#
endregion
#
region
Theory
Helpers
public
static
IEnumerable
<
object
[
]>
NonNullTypesTrueAndFalseDebugDll
{
get
{
return
new
List
<
object
[
]>
()
{
new
object
[]
{
WithNonNullTypesTrue
(
TestOptions
.
DebugDll
)
},
new
object
[]
{
WithNonNullTypesFalse
(
TestOptions
.
DebugDll
)
}
};
}
}
public
static
IEnumerable
<
object
[
]>
NonNullTypesTrueAndFalseReleaseDll
{
get
{
return
new
List
<
object
[
]>
()
{
new
object
[]
{
WithNonNullTypesTrue
(
TestOptions
.
ReleaseDll
)
},
new
object
[]
{
WithNonNullTypesFalse
(
TestOptions
.
ReleaseDll
)
}
};
}
}
#
endregion
protected
static
readonly
string
s_IAsyncEnumerable
=
@"
namespace System.Collections.Generic
{
...
...
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs
浏览文件 @
53971731
...
...
@@ -3029,8 +3029,9 @@ .maxstack 1
});
}
[
Fact
]
public
void
EvaluateCapturedLocalsOutsideLambda
()
[
Theory
]
[
MemberData
(
nameof
(
NonNullTypesTrueAndFalseDebugDll
))]
public
void
EvaluateCapturedLocalsOutsideLambda
(
CSharpCompilationOptions
options
)
{
var
source
=
@"class A
...
...
@@ -3067,7 +3068,7 @@ void M<T>(object x) where T : A, new()
}
}
}"
;
var
compilation0
=
CreateCompilation
(
source
,
options
:
TestOptions
.
DebugDll
);
var
compilation0
=
CreateCompilation
(
source
,
options
:
options
);
WithRuntimeInstance
(
compilation0
,
runtime
=>
{
...
...
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs
浏览文件 @
53971731
...
...
@@ -1628,8 +1628,9 @@ .maxstack 1
/// Should not include "this" inside display class
/// instance method if "this" is not captured.
/// </summary>
[
Fact
]
public
void
NoThisInsideDisplayClassInstanceMethod
()
[
Theory
]
[
MemberData
(
nameof
(
NonNullTypesTrueAndFalseDebugDll
))]
public
void
NoThisInsideDisplayClassInstanceMethod
(
CSharpCompilationOptions
options
)
{
var
source
=
@"using System;
...
...
@@ -1647,7 +1648,7 @@ class C
f(2)(x);
}
}"
;
var
compilation0
=
CreateCompilation
(
source
,
options
:
TestOptions
.
DebugDll
);
var
compilation0
=
CreateCompilation
(
source
,
options
:
options
);
WithRuntimeInstance
(
compilation0
,
runtime
=>
{
var
context
=
CreateMethodContext
(
runtime
,
"C.<>c__DisplayClass0_0.<M>b__0"
);
...
...
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ReferencedModulesTests.cs
浏览文件 @
53971731
...
...
@@ -1367,8 +1367,9 @@ .maxstack 1
// References to missing assembly from PDB custom debug info.
[
WorkItem
(
13275
,
"https://github.com/dotnet/roslyn/issues/13275"
)]
[
Fact
]
public
void
CorLibWithAssemblyReferences_Pdb
()
[
Theory
]
[
MemberData
(
nameof
(
NonNullTypesTrueAndFalseReleaseDll
))]
public
void
CorLibWithAssemblyReferences_Pdb
(
CSharpCompilationOptions
options
)
{
string
sourceLib
=
@"namespace Namespace
...
...
@@ -1397,7 +1398,7 @@ public class Void : Object { }
}"
;
// Create a custom corlib with a reference to compilation
// above and a reference to the actual mscorlib.
var
compCorLib
=
CreateEmptyCompilation
(
sourceCorLib
,
assemblyName
:
CorLibAssemblyName
,
references
:
new
[]
{
MscorlibRef
,
refLib
});
var
compCorLib
=
CreateEmptyCompilation
(
sourceCorLib
,
assemblyName
:
CorLibAssemblyName
,
references
:
new
[]
{
MscorlibRef
,
refLib
}
,
options
:
options
);
compCorLib
.
VerifyDiagnostics
();
var
objectType
=
compCorLib
.
SourceAssembly
.
GlobalNamespace
.
GetMember
<
NamedTypeSymbol
>(
"System.Object"
);
Assert
.
NotNull
(
objectType
.
BaseType
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录