提交 0def9d3a 编写于 作者: C CyrusNajmabadi

Add semantic model test.

上级 a4e25b16
......@@ -15178,5 +15178,39 @@ where true
var infoSymbol2 = semanticModel.GetSymbolInfo(qe.Body.SelectOrGroup).Symbol;
Assert.Equal(expectedNames[i++], infoSymbol2.Name);
}
[Fact]
public void TestIncompleteMember()
{
// Note: binding information in an incomplete member is not available.
// When https://github.com/dotnet/roslyn/issues/7536 is fixed this test
// will have to be updated.
string sourceCode = @"
using System;
class Program
{
public /*<bind>*/K/*</bind>*/
}
class K
{ }
";
var semanticInfo = GetSemanticInfoForTest(sourceCode);
Assert.Equal("K", semanticInfo.Type.ToTestDisplayString());
Assert.Equal(TypeKind.Class, semanticInfo.Type.TypeKind);
Assert.Equal("K", semanticInfo.ConvertedType.ToTestDisplayString());
Assert.Equal(TypeKind.Class, semanticInfo.ConvertedType.TypeKind);
Assert.Equal(ConversionKind.Identity, semanticInfo.ImplicitConversion.Kind);
Assert.Equal("K", semanticInfo.Symbol.ToTestDisplayString());
Assert.Equal(SymbolKind.NamedType, semanticInfo.Symbol.Kind);
Assert.Equal(0, semanticInfo.CandidateSymbols.Length);
Assert.Equal(0, semanticInfo.MethodGroup.Length);
Assert.False(semanticInfo.IsCompileTimeConstant);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册