提交 47bddafa 编写于 作者: V VSadov

More CR feedback

上级 7b85acae
......@@ -421,7 +421,7 @@ public virtual FieldSymbol TupleUnderlyingField
/// <summary>
/// If this field represents a tuple element, returns a corresponding default element field.
/// Otherwise returns null
/// Otherwise returns null.
/// </summary>
public virtual FieldSymbol CorrespondingTupleField
{
......
......@@ -4828,7 +4828,7 @@ public void CreateTupleTypeSymbol_WithValueTuple()
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.TupleUnderlyingType.Kind);
Assert.Equal("(System.Int32, System.String)", tupleWithoutNames.ToTestDisplayString());
Assert.True(GetTupleElementNames(tupleWithoutNames).IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithoutNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.String" }, ElementTypeNames(tupleWithoutNames));
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind);
Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
......@@ -4865,7 +4865,7 @@ public void CreateTupleTypeSymbol_Locations()
Assert.True(tuple.IsTupleType);
Assert.Equal(SymbolKind.NamedType, tuple.TupleUnderlyingType.Kind);
Assert.Equal("(System.Int32 i1, System.String i2)", tuple.ToTestDisplayString());
Assert.Equal(new[] { "System.Int32", "System.String" }, tuple.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.String" }, ElementTypeNames(tuple));
Assert.Equal(SymbolKind.NamedType, tuple.Kind);
Assert.Equal(loc1, tuple.GetMembers("i1").Single().Locations.Single());
Assert.Equal(loc2, tuple.GetMembers("i2").Single().Locations.Single());
......@@ -4885,7 +4885,7 @@ public void CreateTupleTypeSymbol_NoNames()
Assert.Equal(SymbolKind.ErrorType, tupleWithoutNames.TupleUnderlyingType.Kind);
Assert.Equal("(System.Int32, System.String)", tupleWithoutNames.ToTestDisplayString());
Assert.True(GetTupleElementNames(tupleWithoutNames).IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithoutNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.String" }, ElementTypeNames(tupleWithoutNames));
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind);
Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
......@@ -4904,7 +4904,7 @@ public void CreateTupleTypeSymbol_WithNames()
Assert.True(tupleWithNames.IsTupleType);
Assert.Equal("(System.Int32 Alice, System.String Bob)", tupleWithNames.ToTestDisplayString());
Assert.Equal(new[] { "Alice", "Bob" }, GetTupleElementNames(tupleWithNames));
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.String" }, ElementTypeNames(tupleWithNames));
Assert.Equal(SymbolKind.NamedType, tupleWithNames.Kind);
Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
......@@ -4923,7 +4923,7 @@ public void CreateTupleTypeSymbol_WithSomeNames()
Assert.True(tupleWithSomeNames.IsTupleType);
Assert.Equal("(System.Int32, System.String Item2, System.Int32 Charlie)", tupleWithSomeNames.ToTestDisplayString());
Assert.Equal(new[] { null, "Item2", "Charlie" }, GetTupleElementNames(tupleWithSomeNames));
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32" }, tupleWithSomeNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32" }, ElementTypeNames(tupleWithSomeNames));
Assert.Equal(SymbolKind.NamedType, tupleWithSomeNames.Kind);
Assert.All(tupleWithSomeNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
......@@ -4941,7 +4941,7 @@ public void CreateTupleTypeSymbol_WithBadNames()
Assert.True(tupleWithNames.IsTupleType);
Assert.Equal("(System.Int32 Item2, System.Int32 Item1)", tupleWithNames.ToTestDisplayString());
Assert.Equal(new[] { "Item2", "Item1" }, GetTupleElementNames(tupleWithNames));
Assert.Equal(new[] { "System.Int32", "System.Int32" }, tupleWithNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.Int32" }, ElementTypeNames(tupleWithNames));
Assert.Equal(SymbolKind.NamedType, tupleWithNames.Kind);
Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
......@@ -4966,7 +4966,7 @@ public void CreateTupleTypeSymbol_Tuple8NoNames()
Assert.True(GetTupleElementNames(tuple8WithoutNames).IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String" },
tuple8WithoutNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
ElementTypeNames(tuple8WithoutNames));
Assert.All(tuple8WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
......@@ -4991,7 +4991,7 @@ public void CreateTupleTypeSymbol_Tuple8WithNames()
Assert.Equal(new[] { "Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8" }, GetTupleElementNames(tuple8WithNames));
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String" },
tuple8WithNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
ElementTypeNames(tuple8WithNames));
Assert.All(tuple8WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
......@@ -5016,7 +5016,7 @@ public void CreateTupleTypeSymbol_Tuple9NoNames()
Assert.True(GetTupleElementNames(tuple9WithoutNames).IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32" },
tuple9WithoutNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
ElementTypeNames(tuple9WithoutNames));
Assert.All(tuple9WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
......@@ -5041,7 +5041,7 @@ public void CreateTupleTypeSymbol_Tuple9WithNames()
Assert.Equal(new[] { "Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8", "Alice9" }, GetTupleElementNames(tuple9WithNames));
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32" },
tuple9WithNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
ElementTypeNames(tuple9WithNames));
Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
......@@ -5070,7 +5070,7 @@ public void CreateTupleTypeSymbol_Tuple9WithDefaultNames()
Assert.Equal(new[] { "Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9" }, GetTupleElementNames(tuple9WithNames));
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.Int32", "System.Int32" },
tuple9WithNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
ElementTypeNames(tuple9WithNames));
Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
......@@ -5146,7 +5146,6 @@ public void CreateTupleTypeSymbol_EmptyNames()
NamedTypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32);
var vt2 = comp.GetWellKnownType(WellKnownType.System_ValueTuple_T2).Construct(intType, intType);
// not tuple-compatible underlying type
try
{
// illegal C# identifiers and blank
......@@ -5156,7 +5155,7 @@ public void CreateTupleTypeSymbol_EmptyNames()
catch (ArgumentException e)
{
Assert.Contains(CodeAnalysisResources.TupleElementNameEmpty, e.Message);
Assert.Contains("1", e.Message);
Assert.Contains("elementNames[1]", e.Message);
}
}
......@@ -5245,7 +5244,7 @@ public void CreateTupleTypeSymbol2_WithValueTuple()
Assert.True(tupleWithoutNames.IsTupleType);
Assert.Equal("(System.Int32, System.String)", tupleWithoutNames.ToTestDisplayString());
Assert.True(GetTupleElementNames(tupleWithoutNames).IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithoutNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.String" }, ElementTypeNames(tupleWithoutNames));
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind);
}
......@@ -5262,19 +5261,24 @@ public void CreateTupleTypeSymbol_WithLocations()
var loc1 = Location.Create(syntaxTree, new TextSpan(0, 1));
var loc2 = Location.Create(syntaxTree, new TextSpan(1, 1));
var tuple = comp.CreateTupleTypeSymbol(
ImmutableArray.Create<ITypeSymbol>(intType, stringType),
ImmutableArray.Create<ITypeSymbol>(intType, stringType),
ImmutableArray.Create<string>(null, null),
ImmutableArray.Create(loc1, loc2));
Assert.True(tuple.IsTupleType);
Assert.Equal("(System.Int32, System.String)", tuple.ToTestDisplayString());
Assert.True(GetTupleElementNames(tuple).IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String" }, tuple.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.String" }, ElementTypeNames(tuple));
Assert.Equal(SymbolKind.NamedType, tuple.Kind);
Assert.Equal(loc1, tuple.GetMembers("Item1").Single().Locations.Single());
Assert.Equal(loc2, tuple.GetMembers("Item2").Single().Locations.Single());
}
private static IEnumerable<string> ElementTypeNames(INamedTypeSymbol tuple)
{
return tuple.TupleElements.Select(t => t.Type.ToTestDisplayString());
}
[Fact]
public void CreateTupleTypeSymbol2_NoNames()
{
......@@ -5287,7 +5291,7 @@ public void CreateTupleTypeSymbol2_NoNames()
Assert.True(tupleWithoutNames.IsTupleType);
Assert.Equal("(System.Int32, System.String)", tupleWithoutNames.ToTestDisplayString());
Assert.True(GetTupleElementNames(tupleWithoutNames).IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithoutNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.String" }, ElementTypeNames(tupleWithoutNames));
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind);
}
......@@ -5303,7 +5307,7 @@ public void CreateTupleTypeSymbol2_WithNames()
Assert.True(tupleWithNames.IsTupleType);
Assert.Equal("(System.Int32 Alice, System.String Bob)", tupleWithNames.ToTestDisplayString());
Assert.Equal(new[] { "Alice", "Bob" }, GetTupleElementNames(tupleWithNames));
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.String" }, ElementTypeNames(tupleWithNames));
Assert.Equal(SymbolKind.NamedType, tupleWithNames.Kind);
}
......@@ -5318,7 +5322,7 @@ public void CreateTupleTypeSymbol2_WithBadNames()
Assert.True(tupleWithNames.IsTupleType);
Assert.Equal("(System.Int32 Item2, System.Int32 Item1)", tupleWithNames.ToTestDisplayString());
Assert.Equal(new[] { "Item2", "Item1" }, GetTupleElementNames(tupleWithNames));
Assert.Equal(new[] { "System.Int32", "System.Int32" }, tupleWithNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
Assert.Equal(new[] { "System.Int32", "System.Int32" }, ElementTypeNames(tupleWithNames));
Assert.Equal(SymbolKind.NamedType, tupleWithNames.Kind);
}
......@@ -5339,7 +5343,7 @@ public void CreateTupleTypeSymbol2_Tuple8NoNames()
Assert.True(GetTupleElementNames(tuple8WithoutNames).IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String" },
tuple8WithoutNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
ElementTypeNames(tuple8WithoutNames));
}
[Fact]
......@@ -5359,7 +5363,7 @@ public void CreateTupleTypeSymbol2_Tuple8WithNames()
Assert.Equal(new[] { "Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8" }, GetTupleElementNames(tuple8WithNames));
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String" },
tuple8WithNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
ElementTypeNames(tuple8WithNames));
}
[Fact]
......@@ -5379,7 +5383,7 @@ public void CreateTupleTypeSymbol2_Tuple9NoNames()
Assert.True(GetTupleElementNames(tuple9WithoutNames).IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32" },
tuple9WithoutNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
ElementTypeNames(tuple9WithoutNames));
}
[Fact]
......@@ -5399,7 +5403,7 @@ public void CreateTupleTypeSymbol2_Tuple9WithNames()
Assert.Equal(new[] { "Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8", "Alice9" }, GetTupleElementNames(tuple9WithNames));
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32" },
tuple9WithNames.TupleElements.Select(t => t.Type.ToTestDisplayString()));
ElementTypeNames(tuple9WithNames));
}
[Fact]
......
......@@ -69,12 +69,12 @@ public interface IFieldSymbol : ISymbol
/// <summary>
/// If this field represents a tuple element, returns a corresponding default element field.
/// Otherwise returns null
/// Otherwise returns null.
/// </summary>
/// <remarks>
/// A tuple type will always have default elements such as Item1, Item2, Item3...
/// This API allowes to match a field that represents a named element, such as "Alice"
/// to the corrsponding default element field such as "Item1"
/// This API allows matching a field that represents a named element, such as "Alice"
/// to the corresponding default element field such as "Item1"
/// </remarks>
IFieldSymbol CorrespondingTupleField { get; }
}
......
......@@ -22,7 +22,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Actual element names.
''' Could be different from _providedElementNames becasue of case insensitivity.
''' Could be different from _providedElementNames because of case insensitivity.
''' I.E. - it is not an error to provide "item1" name to the first element
''' however its name must be "Item1", since it already has the name "Item1"
''' and having both "item1" and "Item1" names would be ambiguous
......@@ -635,7 +635,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
builder(index) = candidate
Else
' there is a better field in the slot
' that can only happen if the candidate Is default.
' that can only happen if the candidate is default.
Debug.Assert(candidate.IsDefaultTupleElement)
End If
End If
......
......@@ -6224,12 +6224,16 @@ End Class
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.TupleUnderlyingType.Kind)
Assert.Equal("(System.Int32, System.String)", tupleWithoutNames.ToTestDisplayString())
Assert.True(GetTupleElementNames(tupleWithoutNames).IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String"}, tupleWithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal((New String() {"System.Int32", "System.String"}), ElementTypeNames(tupleWithoutNames))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
Private Shared Function ElementTypeNames(tuple As INamedTypeSymbol) As IEnumerable(Of String)
Return tuple.TupleElements.Select(Function(t) t.Type.ToTestDisplayString())
End Function
<Fact>
Public Sub CreateTupleTypeSymbol_Locations()
......@@ -6253,7 +6257,7 @@ End Class
Assert.True(tuple.IsTupleType)
Assert.Equal(SymbolKind.NamedType, tuple.TupleUnderlyingType.Kind)
Assert.Equal("(i1 As System.Int32, i2 As System.String)", tuple.ToTestDisplayString())
Assert.Equal(New String() {"System.Int32", "System.String"}, tuple.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.String"}, ElementTypeNames(tuple))
Assert.Equal(SymbolKind.NamedType, tuple.Kind)
Assert.Equal(loc1, tuple.GetMembers("i1").Single.Locations.Single())
Assert.Equal(loc2, tuple.GetMembers("i2").Single.Locations.Single())
......@@ -6273,7 +6277,7 @@ End Class
Assert.Equal(SymbolKind.ErrorType, tupleWithoutNames.TupleUnderlyingType.Kind)
Assert.Equal("(System.Int32, System.String)", tupleWithoutNames.ToTestDisplayString())
Assert.True(GetTupleElementNames(tupleWithoutNames).IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String"}, tupleWithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.String"}, ElementTypeNames(tupleWithoutNames))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
......@@ -6293,7 +6297,7 @@ End Class
Assert.Equal(SymbolKind.ErrorType, tupleWithoutNames.TupleUnderlyingType.Kind)
Assert.Equal("(Alice As System.Int32, Bob As System.String)", tupleWithoutNames.ToTestDisplayString())
Assert.Equal(New String() {"Alice", "Bob"}, GetTupleElementNames(tupleWithoutNames))
Assert.Equal(New String() {"System.Int32", "System.String"}, tupleWithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.String"}, ElementTypeNames(tupleWithoutNames))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
......@@ -6314,9 +6318,7 @@ End Class
Assert.Equal(SymbolKind.ErrorType, tupleWithSomeNames.TupleUnderlyingType.Kind)
Assert.Equal("(System.Int32, Item2 As System.String, Charlie As System.Int32)", tupleWithSomeNames.ToTestDisplayString())
Assert.Equal(New String() {Nothing, "Item2", "Charlie"}, GetTupleElementNames(tupleWithSomeNames))
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32"},
tupleWithSomeNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32"}, ElementTypeNames(tupleWithSomeNames))
Assert.Equal(SymbolKind.NamedType, tupleWithSomeNames.Kind)
Assert.All(tupleWithSomeNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
......@@ -6334,7 +6336,7 @@ End Class
Assert.True(tupleWithoutNames.IsTupleType)
Assert.Equal("(Item2 As System.Int32, Item1 As System.Int32)", tupleWithoutNames.ToTestDisplayString())
Assert.Equal(New String() {"Item2", "Item1"}, GetTupleElementNames(tupleWithoutNames))
Assert.Equal(New String() {"System.Int32", "System.Int32"}, tupleWithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.Int32"}, ElementTypeNames(tupleWithoutNames))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
......@@ -6360,7 +6362,7 @@ End Class
Assert.True(GetTupleElementNames(tuple8WithoutNames).IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String"},
tuple8WithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
ElementTypeNames(tuple8WithoutNames))
Assert.All(tuple8WithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
......@@ -6385,7 +6387,7 @@ End Class
Assert.Equal(New String() {"Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8"}, GetTupleElementNames(tuple8WithNames))
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String"},
tuple8WithNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
ElementTypeNames(tuple8WithNames))
Assert.All(tuple8WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
......@@ -6410,7 +6412,7 @@ End Class
Assert.True(GetTupleElementNames(tuple9WithoutNames).IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32"},
tuple9WithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
ElementTypeNames(tuple9WithoutNames))
Assert.All(tuple9WithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
......@@ -6435,7 +6437,7 @@ End Class
Assert.Equal(New String() {"Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8", "Alice9"}, GetTupleElementNames(tuple9WithNames))
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32"},
tuple9WithNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
ElementTypeNames(tuple9WithNames))
Assert.All(tuple9WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
......@@ -6460,7 +6462,7 @@ End Class
Assert.Equal(New String() {"Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9"}, GetTupleElementNames(tuple9WithNames))
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32"},
tuple9WithNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
ElementTypeNames(tuple9WithNames))
Assert.All(tuple9WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
......@@ -6591,7 +6593,7 @@ End Class
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.TupleUnderlyingType.Kind)
Assert.Equal("(System.Int32, System.String)", tupleWithoutNames.ToTestDisplayString())
Assert.True(GetTupleElementNames(tupleWithoutNames).IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String"}, tupleWithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.String"}, ElementTypeNames(tupleWithoutNames))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
End Sub
......@@ -6619,7 +6621,7 @@ End Class
Assert.True(tuple.IsTupleType)
Assert.Equal(SymbolKind.NamedType, tuple.TupleUnderlyingType.Kind)
Assert.Equal("(i1 As System.Int32, i2 As System.String)", tuple.ToTestDisplayString())
Assert.Equal(New String() {"System.Int32", "System.String"}, tuple.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.String"}, ElementTypeNames(tuple))
Assert.Equal(SymbolKind.NamedType, tuple.Kind)
Assert.Equal(loc1, tuple.GetMembers("i1").Single().Locations.Single())
Assert.Equal(loc2, tuple.GetMembers("i2").Single().Locations.Single())
......@@ -6638,7 +6640,7 @@ End Class
Assert.Equal(SymbolKind.ErrorType, tupleWithoutNames.TupleUnderlyingType.Kind)
Assert.Equal("(System.Int32, System.String)", tupleWithoutNames.ToTestDisplayString())
Assert.True(GetTupleElementNames(tupleWithoutNames).IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String"}, tupleWithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.String"}, ElementTypeNames(tupleWithoutNames))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
End Sub
......@@ -6656,7 +6658,7 @@ End Class
Assert.Equal(SymbolKind.ErrorType, tupleWithoutNames.TupleUnderlyingType.Kind)
Assert.Equal("(Alice As System.Int32, Bob As System.String)", tupleWithoutNames.ToTestDisplayString())
Assert.Equal(New String() {"Alice", "Bob"}, GetTupleElementNames(tupleWithoutNames))
Assert.Equal(New String() {"System.Int32", "System.String"}, tupleWithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.String"}, ElementTypeNames(tupleWithoutNames))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
End Sub
......@@ -6672,7 +6674,7 @@ End Class
Assert.True(tupleWithoutNames.IsTupleType)
Assert.Equal("(Item2 As System.Int32, Item1 As System.Int32)", tupleWithoutNames.ToTestDisplayString())
Assert.Equal(New String() {"Item2", "Item1"}, GetTupleElementNames(tupleWithoutNames))
Assert.Equal(New String() {"System.Int32", "System.Int32"}, tupleWithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
Assert.Equal(New String() {"System.Int32", "System.Int32"}, ElementTypeNames(tupleWithoutNames))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
End Sub
......@@ -6694,7 +6696,7 @@ End Class
Assert.True(GetTupleElementNames(tuple8WithoutNames).IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String"},
tuple8WithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
ElementTypeNames(tuple8WithoutNames))
End Sub
......@@ -6715,7 +6717,7 @@ End Class
Assert.Equal(New String() {"Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8"}, GetTupleElementNames(tuple8WithNames))
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String"},
tuple8WithNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
ElementTypeNames(tuple8WithNames))
End Sub
......@@ -6736,7 +6738,7 @@ End Class
Assert.True(GetTupleElementNames(tuple9WithoutNames).IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32"},
tuple9WithoutNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
ElementTypeNames(tuple9WithoutNames))
End Sub
......@@ -6757,7 +6759,7 @@ End Class
Assert.Equal(New String() {"Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8", "Alice9"}, GetTupleElementNames(tuple9WithNames))
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32"},
tuple9WithNames.TupleElements.Select(Function(t) t.Type.ToTestDisplayString()))
ElementTypeNames(tuple9WithNames))
End Sub
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册