Skip to content

Commit 5df9a9d

Browse files
committed
Cleaned up the test failures
1 parent 876a23a commit 5df9a9d

File tree

9 files changed

+29
-19
lines changed

9 files changed

+29
-19
lines changed

src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,13 @@ Public MustInherit Class BasicTestBase
799799

800800
Dim fileName = "a.vb"
801801
Dim syntaxTree = Parse(source, fileName, parseOptions)
802-
Dim defaultRefs = If(useLatestFrameworkReferences, LatestVbReferences, DefaultVbReferences)
803-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=defaultRefs.Append({ValueTupleRef, SystemRuntimeFacadeRef}), options:=If(compilationOptions, TestOptions.ReleaseDll))
802+
Dim allReferences As IEnumerable(Of MetadataReference)
803+
If useLatestFrameworkReferences Then
804+
allReferences = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add(TestBase.MsvbRef_v4_0_30319_17929)
805+
Else
806+
allReferences = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add(TestBase.MsvbRef)
807+
End If
808+
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=allReferences, options:=If(compilationOptions, TestOptions.ReleaseDll))
804809
Dim operationTree = GetOperationTreeForTest(Of TSyntaxNode)(compilation, fileName, which)
805810
Return (operationTree.tree, operationTree.syntax, operationTree.operation, compilation)
806811
End Function
@@ -858,10 +863,15 @@ Public MustInherit Class BasicTestBase
858863

859864
Dim fileName = "a.vb"
860865
Dim syntaxTree = Parse(source, fileName, parseOptions)
861-
Dim defaultRefs = If(useLatestFramework, LatestVbReferences, DefaultVbReferences)
862-
Dim allReferences = defaultRefs.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
866+
Dim allReferences As IEnumerable(Of MetadataReference) = Nothing
867+
If useLatestFramework Then
868+
allReferences = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add(TestBase.MsvbRef_v4_0_30319_17929)
869+
Else
870+
allReferences = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add(TestBase.MsvbRef)
871+
End If
872+
863873
allReferences = If(references IsNot Nothing, allReferences.Concat(references), allReferences)
864-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=allReferences, options:=If(compilationOptions, TestOptions.ReleaseDll))
874+
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=allReferences, options:=If(compilationOptions, TestOptions.ReleaseDll))
865875
VerifyOperationTreeAndDiagnosticsForTest(Of TSyntaxNode)(compilation, fileName, expectedOperationTree, expectedDiagnostics, which, additionalOperationTreeVerifier)
866876
End Sub
867877

src/Compilers/Test/Utilities/VisualBasic/BasicTestSource.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Public Structure BasicTestSource
3333

3434
Dim sources = TryCast(Value, String())
3535
If sources IsNot Nothing Then
36-
Return source.Select(Function(s) VisualBasicSyntaxTree.ParseText(s, parseOptions)).ToArray()
36+
Return sources.Select(Function(s) VisualBasicSyntaxTree.ParseText(s, parseOptions)).ToArray()
3737
End If
3838

3939
Dim tree = TryCast(Value, SyntaxTree)

src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ BC30518: Overload resolution failed because no accessible 'P1' can be called wit
522522
Dim fileName = "a.vb"
523523
Dim syntaxTree = Parse(sourceCode, fileName, options:=Nothing)
524524

525-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
525+
Dim compilation = CreateEmptyCompilation({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
526526
Dim tree = (From t In compilation.SyntaxTrees Where t.FilePath = fileName).Single()
527527
Dim model = compilation.GetSemanticModel(tree)
528528

@@ -537,7 +537,7 @@ BC30518: Overload resolution failed because no accessible 'P1' can be called wit
537537
Dim fileName = "a.vb"
538538
Dim syntaxTree = Parse(sourceCode, fileName, options:=Nothing)
539539

540-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
540+
Dim compilation = CreateEmptyCompilation({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
541541
Dim tree = (From t In compilation.SyntaxTrees Where t.FilePath = fileName).Single()
542542
Dim model = compilation.GetSemanticModel(tree)
543543

src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ End Class]]>.Value
10771077
Dim fileName = "a.vb"
10781078
Dim syntaxTree = Parse(source, fileName, options:=Nothing)
10791079

1080-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
1080+
Dim compilation = CreateEmptyCompilation({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
10811081
Dim result = GetOperationAndSyntaxForTest(Of InvocationExpressionSyntax)(compilation, fileName)
10821082

10831083
Dim expectedInKind = ConversionKind.Widening Or ConversionKind.UserDefined
@@ -1131,7 +1131,7 @@ End Class]]>.Value
11311131
Dim fileName = "a.vb"
11321132
Dim syntaxTree = Parse(source, fileName, options:=Nothing)
11331133

1134-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
1134+
Dim compilation = CreateEmptyCompilation({syntaxTree}, DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef}))
11351135
Dim tree = (From t In compilation.SyntaxTrees Where t.FilePath = fileName).Single()
11361136
Dim model = compilation.GetSemanticModel(tree)
11371137

src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ IBlockOperation (26 statements, 3 locals) (OperationKind.Block, Type: null) (Syn
993993
Dim fileName = "a.vb"
994994
Dim syntaxTree = Parse(source, fileName)
995995
Dim references = DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
996-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
996+
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
997997

998998
VerifyOperationTreeAndDiagnosticsForTest(Of MethodBlockSyntax)(compilation, fileName, expectedOperationTree, expectedDiagnostics)
999999
End Sub
@@ -1442,7 +1442,7 @@ IBlockOperation (12 statements, 2 locals) (OperationKind.Block, Type: null) (Syn
14421442
Dim fileName = "a.vb"
14431443
Dim syntaxTree = Parse(source, fileName)
14441444
Dim references = DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
1445-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
1445+
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
14461446

14471447
VerifyOperationTreeAndDiagnosticsForTest(Of MethodBlockSyntax)(compilation, fileName, expectedOperationTree, expectedDiagnostics)
14481448
End Sub

src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IUnaryOperatorExpression.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,7 @@ IUnaryOperation (UnaryOperatorKind.Minus, IsLifted) (OperationKind.UnaryOperator
21312131
Dim fileName = "a.vb"
21322132
Dim syntaxTree = Parse(source, fileName)
21332133
Dim references = DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
2134-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
2134+
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
21352135

21362136
VerifyOperationTreeAndDiagnosticsForTest(Of UnaryExpressionSyntax)(compilation, fileName, expectedOperationTree, expectedDiagnostics)
21372137
End Sub
@@ -2158,7 +2158,7 @@ IUnaryOperation (UnaryOperatorKind.Minus) (OperationKind.UnaryOperator, Type: Sy
21582158
Dim fileName = "a.vb"
21592159
Dim syntaxTree = Parse(source, fileName)
21602160
Dim references = DefaultVbReferences.Concat({ValueTupleRef, SystemRuntimeFacadeRef})
2161-
Dim compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
2161+
Dim compilation = CreateEmptyCompilation({syntaxTree}, references:=references, options:=TestOptions.ReleaseDll.WithOverflowChecks(False))
21622162

21632163
VerifyOperationTreeAndDiagnosticsForTest(Of UnaryExpressionSyntax)(compilation, fileName, expectedOperationTree, expectedDiagnostics)
21642164
End Sub

src/Compilers/VisualBasic/Test/Semantic/Semantics/ScriptSemanticsTests.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ F(Function()
3838
Dim code = "System.Console.WriteLine(1)"
3939
Dim compilationUnit = VisualBasic.SyntaxFactory.ParseCompilationUnit(code, options:=New VisualBasicParseOptions(kind:=SourceCodeKind.Script))
4040
Dim syntaxTree = compilationUnit.SyntaxTree
41-
Dim compilation = CreateCompilationWithMscorlib45({syntaxTree}, assemblyName:="Errors_01")
41+
Dim compilation = CreateCompilationWithMscorlib45({syntaxTree}, assemblyName:="Errors_01", options:=TestOptions.ReleaseExe)
4242
Dim semanticModel = compilation.GetSemanticModel(syntaxTree, True)
4343
Dim node5 As MemberAccessExpressionSyntax = ErrorTestsGetNode(syntaxTree)
4444
Assert.Equal("WriteLine", node5.Name.ToString())
@@ -69,7 +69,7 @@ System.Console.WriteLine(1)
6969
)
7070

7171
syntaxTree = SyntaxFactory.ParseSyntaxTree(code, options:=New VisualBasicParseOptions(kind:=SourceCodeKind.Script))
72-
compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree})
72+
compilation = CreateCompilationWithMscorlib45AndVBRuntime({syntaxTree}, options:=TestOptions.ReleaseExe)
7373
semanticModel = compilation.GetSemanticModel(syntaxTree, True)
7474
node5 = ErrorTestsGetNode(syntaxTree)
7575
Assert.Equal("WriteLine", node5.Name.ToString())

src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/WinMdTests.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ End Class"
116116
Shared Sub M(a As LibraryA.A, b As LibraryB.B, t As Windows.Data.Text.TextSegment, f As Windows.Storage.StorageFolder)
117117
End Sub
118118
End Class"
119-
Dim c0 = CreateCompilationWithMscorlib40({source}, compileReferences, TestOptions.DebugDll)
119+
Dim c0 = CreateEmptyCompilation({source}, compileReferences, TestOptions.DebugDll)
120120
WithRuntimeInstance(c0, runtimeReferences,
121121
Sub(runtime)
122122
Dim context = CreateMethodContext(runtime, "C.M")

src/Test/Utilities/Portable/TargetFrameworkUtil.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public static class TargetFrameworkUtil
6767
public static ImmutableArray<MetadataReference> Mscorlib40andSystemCoreReferences => ImmutableArray.Create(TestBase.MscorlibRef, TestBase.SystemCoreRef);
6868
public static ImmutableArray<MetadataReference> Mscorlib40andVBRuntimeReferences => ImmutableArray.Create(TestBase.MscorlibRef, TestBase.SystemRef, TestBase.MsvbRef);
6969
public static ImmutableArray<MetadataReference> Mscorlib45References => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626);
70-
public static ImmutableArray<MetadataReference> Mscorlib45ExtendedReferences => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626, TestBase.SystemRef, TestBase.SystemCoreRef, TestBase.ValueTupleRef, TestBase.SystemRuntimeFacadeRef);
71-
public static ImmutableArray<MetadataReference> Mscorlib45AndCSharpReferences => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626, TestBase.SystemCoreRef, TestBase.CSharpRef);
70+
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);
71+
public static ImmutableArray<MetadataReference> Mscorlib45AndCSharpReferences => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626, TestBase.SystemCoreRef_v4_0_30319_17929, TestBase.CSharpRef);
7272
public static ImmutableArray<MetadataReference> Mscorlib45AndVBRuntimeReferences => ImmutableArray.Create(TestBase.MscorlibRef_v4_0_30316_17626, TestBase.SystemRef, TestBase.MsvbRef_v4_0_30319_17929);
7373
public static ImmutableArray<MetadataReference> Mscorlib46References => ImmutableArray.Create(TestBase.MscorlibRef_v46);
7474
public static ImmutableArray<MetadataReference> Mscorlib46ExtendedReferences => ImmutableArray.Create(TestBase.MscorlibRef_v46, TestBase.SystemRef_v46, TestBase.SystemCoreRef_v46, TestBase.ValueTupleRef, TestBase.SystemRuntimeFacadeRef);

0 commit comments

Comments
 (0)