Cleaned up the test failures

上级 876a23af
......@@ -799,8 +799,13 @@ Public MustInherit Class BasicTestBase
Dim fileName = "a.vb"
Dim syntaxTree = Parse(source, fileName, parseOptions)
Dim defaultRefs = If(useLatestFrameworkReferences, LatestVbReferences, DefaultVbReferences)
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=defaultRefs.Append({ValueTupleRef, SystemRuntimeFacadeRef}), options:=If(compilationOptions, TestOptions.ReleaseDll))
Dim allReferences As IEnumerable(Of MetadataReference)
If useLatestFrameworkReferences Then
allReferences = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add(TestBase.MsvbRef_v4_0_30319_17929)
Else
allReferences = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add(TestBase.MsvbRef)
End If
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=allReferences, options:=If(compilationOptions, TestOptions.ReleaseDll))
Dim operationTree = GetOperationTreeForTest(Of TSyntaxNode)(compilation, fileName, which)
Return (operationTree.tree, operationTree.syntax, operationTree.operation, compilation)
End Function
......@@ -858,10 +863,15 @@ Public MustInherit Class BasicTestBase
Dim fileName = "a.vb"
Dim syntaxTree = Parse(source, fileName, parseOptions)
Dim defaultRefs = If(useLatestFramework, LatestVbReferences, DefaultVbReferences)
Dim allReferences = defaultRefs.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
Dim allReferences As IEnumerable(Of MetadataReference) = Nothing
If useLatestFramework Then
allReferences = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add(TestBase.MsvbRef_v4_0_30319_17929)
Else
allReferences = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add(TestBase.MsvbRef)
End If
allReferences = If(references IsNot Nothing, allReferences.Concat(references), allReferences)
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=allReferences, options:=If(compilationOptions, TestOptions.ReleaseDll))
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=allReferences, options:=If(compilationOptions, TestOptions.ReleaseDll))
VerifyOperationTreeAndDiagnosticsForTest(Of TSyntaxNode)(compilation, fileName, expectedOperationTree, expectedDiagnostics, which, additionalOperationTreeVerifier)
End Sub
......
......@@ -33,7 +33,7 @@ Public Structure BasicTestSource
Dim sources = TryCast(Value, String())
If sources IsNot Nothing Then
Return source.Select(Function(s) VisualBasicSyntaxTree.ParseText(s, parseOptions)).ToArray()
Return sources.Select(Function(s) VisualBasicSyntaxTree.ParseText(s, parseOptions)).ToArray()
End If
Dim tree = TryCast(Value, SyntaxTree)
......
......@@ -522,7 +522,7 @@ BC30518: Overload resolution failed because no accessible 'P1' can be called wit
Dim fileName = "a.vb"
Dim syntaxTree = Parse(sourceCode, fileName, options:=Nothing)
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
Dim compilation = CreateEmptyCompilation({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
Dim tree = (From t In compilation.SyntaxTrees Where t.FilePath = fileName).Single()
Dim model = compilation.GetSemanticModel(tree)
......@@ -537,7 +537,7 @@ BC30518: Overload resolution failed because no accessible 'P1' can be called wit
Dim fileName = "a.vb"
Dim syntaxTree = Parse(sourceCode, fileName, options:=Nothing)
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
Dim compilation = CreateEmptyCompilation({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
Dim tree = (From t In compilation.SyntaxTrees Where t.FilePath = fileName).Single()
Dim model = compilation.GetSemanticModel(tree)
......
......@@ -1077,7 +1077,7 @@ End Class]]>.Value
Dim fileName = "a.vb"
Dim syntaxTree = Parse(source, fileName, options:=Nothing)
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
Dim compilation = CreateEmptyCompilation({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
Dim result = GetOperationAndSyntaxForTest(Of InvocationExpressionSyntax)(compilation, fileName)
Dim expectedInKind = ConversionKind.Widening Or ConversionKind.UserDefined
......@@ -1131,7 +1131,7 @@ End Class]]>.Value
Dim fileName = "a.vb"
Dim syntaxTree = Parse(source, fileName, options:=Nothing)
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
Dim compilation = CreateEmptyCompilation({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
Dim tree = (From t In compilation.SyntaxTrees Where t.FilePath = fileName).Single()
Dim model = compilation.GetSemanticModel(tree)
......
......@@ -993,7 +993,7 @@ IBlockOperation (26 statements, 3 locals) (OperationKind.Block, Type: null) (Syn
Dim fileName = "a.vb"
Dim syntaxTree = Parse(source, fileName)
Dim references = DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
VerifyOperationTreeAndDiagnosticsForTest(Of MethodBlockSyntax)(compilation, fileName, expectedOperationTree, expectedDiagnostics)
End Sub
......@@ -1442,7 +1442,7 @@ IBlockOperation (12 statements, 2 locals) (OperationKind.Block, Type: null) (Syn
Dim fileName = "a.vb"
Dim syntaxTree = Parse(source, fileName)
Dim references = DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
VerifyOperationTreeAndDiagnosticsForTest(Of MethodBlockSyntax)(compilation, fileName, expectedOperationTree, expectedDiagnostics)
End Sub
......
......@@ -2131,7 +2131,7 @@ IUnaryOperation (UnaryOperatorKind.Minus, IsLifted) (OperationKind.UnaryOperator
Dim fileName = "a.vb"
Dim syntaxTree = Parse(source, fileName)
Dim references = DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
VerifyOperationTreeAndDiagnosticsForTest(Of UnaryExpressionSyntax)(compilation, fileName, expectedOperationTree, expectedDiagnostics)
End Sub
......@@ -2158,7 +2158,7 @@ IUnaryOperation (UnaryOperatorKind.Minus) (OperationKind.UnaryOperator, Type: Sy
Dim fileName = "a.vb"
Dim syntaxTree = Parse(source, fileName)
Dim references = DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
VerifyOperationTreeAndDiagnosticsForTest(Of UnaryExpressionSyntax)(compilation, fileName, expectedOperationTree, expectedDiagnostics)
End Sub
......
......@@ -38,7 +38,7 @@ F(Function()
Dim code = "System.Console.WriteLine(1)"
Dim compilationUnit = VisualBasic.SyntaxFactory.ParseCompilationUnit(code, options:=New VisualBasicParseOptions(kind:=SourceCodeKind.Script))
Dim syntaxTree = compilationUnit.SyntaxTree
Dim compilation = CreateCompilationWithMscorlib45({syntaxTree}, assemblyName:="Errors_01")
Dim compilation = CreateCompilationWithMscorlib45({syntaxTree}, assemblyName:="Errors_01", options:=TestOptions.ReleaseExe)
Dim semanticModel = compilation.GetSemanticModel(syntaxTree, True)
Dim node5 As MemberAccessExpressionSyntax = ErrorTestsGetNode(syntaxTree)
Assert.Equal("WriteLine", node5.Name.ToString())
......@@ -69,7 +69,7 @@ System.Console.WriteLine(1)
)
syntaxTree = SyntaxFactory.ParseSyntaxTree(code, options:=New VisualBasicParseOptions(kind:=SourceCodeKind.Script))
compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree})
compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, options:=TestOptions.ReleaseExe)
semanticModel = compilation.GetSemanticModel(syntaxTree, True)
node5 = ErrorTestsGetNode(syntaxTree)
Assert.Equal("WriteLine", node5.Name.ToString())
......
......@@ -116,7 +116,7 @@ End Class"
Shared Sub M(a As LibraryA.A, b As LibraryB.B, t As Windows.Data.Text.TextSegment, f As Windows.Storage.StorageFolder)
End Sub
End Class"
Dim c0 = CreateCompilationWithMscorlib40({source}, compileReferences, TestOptions.DebugDll)
Dim c0 = CreateEmptyCompilation({source}, compileReferences, TestOptions.DebugDll)
WithRuntimeInstance(c0, runtimeReferences,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
......
......@@ -67,8 +67,8 @@ public static class TargetFrameworkUtil
public static ImmutableArray<MetadataReference> Mscorlib40andSystemCoreReferences => ImmutableArray.Create(TestBase.MscorlibRef, TestBase.SystemCoreRef);
public static ImmutableArray<MetadataReference> Mscorlib40andVBRuntimeReferences => ImmutableArray.Create(TestBase.MscorlibRef, TestBase.SystemRef, TestBase.MsvbRef);
public static ImmutableArray<MetadataReference> Mscorlib45References => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626);
public static ImmutableArray<MetadataReference> Mscorlib45ExtendedReferences => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626, TestBase.SystemRef, TestBase.SystemCoreRef, TestBase.ValueTupleRef, TestBase.SystemRuntimeFacadeRef);
public static ImmutableArray<MetadataReference> Mscorlib45AndCSharpReferences => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626, TestBase.SystemCoreRef, TestBase.CSharpRef);
public static ImmutableArray<MetadataReference> Mscorlib45ExtendedReferences => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626, TestBase.SystemRef, TestBase.SystemCoreRef_v4_0_30319_17929, TestBase.ValueTupleRef, TestBase.SystemRuntimeFacadeRef);
public static ImmutableArray<MetadataReference> Mscorlib45AndCSharpReferences => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626, TestBase.SystemCoreRef_v4_0_30319_17929, TestBase.CSharpRef);
public static ImmutableArray<MetadataReference> Mscorlib45AndVBRuntimeReferences => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626, TestBase.SystemRef, TestBase.MsvbRef_v4_0_30319_17929);
public static ImmutableArray<MetadataReference> Mscorlib46References => ImmutableArray.Create(TestBase.MscorlibRef_v46);
public static ImmutableArray<MetadataReference> Mscorlib46ExtendedReferences => ImmutableArray.Create(TestBase.MscorlibRef_v46, TestBase.SystemRef_v46, TestBase.SystemCoreRef_v46, TestBase.ValueTupleRef, TestBase.SystemRuntimeFacadeRef);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册