提交 96c26036 编写于 作者: A Andrew Casey

Fix broken VB EC tests.

上级 f1bb6ffc
......@@ -76,14 +76,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator
Dim typeChar As String = Nothing
Dim specialType = GetSpecialTypeForTypeCharacter(identifier.GetTypeCharacter(), typeChar)
Dim type = Compilation.GetSpecialType(If(specialType = SpecialType.None, SpecialType.System_Object, specialType))
' NOTE: Don't create the local with the canonical name since we want it to have the user's text in diagnostic messages.
' TODO (acasey): don't canonicalize name (GH #878)
Dim canonicalName = Canonicalize(identifier.GetIdentifierText())
Dim local = LocalSymbol.Create(
_containingMethod,
Me,
identifier,
LocalDeclarationKind.ImplicitVariable,
type)
_implicitDeclarations.Add(Canonicalize(local.Name), local)
type,
canonicalName)
_implicitDeclarations.Add(canonicalName, local)
If local.Name.StartsWith("$", StringComparison.Ordinal) Then
diagnostics.Add(ERRID.ERR_IllegalChar, identifier.GetLocation())
End If
......@@ -132,7 +134,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator
End Select
End Function
Friend Shared Function Canonicalize(name As String) As String
Private Shared Function Canonicalize(name As String) As String
Return CaseInsensitiveComparison.ToLower(name)
End Function
......
......@@ -60,7 +60,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator
' CreateVariable(type As Type, name As String)
Dim method = PlaceholderLocalSymbol.GetIntrinsicMethod(compilation, ExpressionCompilerConstants.CreateVariableMethodName)
Dim type = New BoundGetType(syntax, New BoundTypeExpression(syntax, local.Type), typeType)
Dim name = New BoundLiteral(syntax, ConstantValue.Create(PlaceholderLocalBinder.Canonicalize(local.Name)), stringType)
Dim name = New BoundLiteral(syntax, ConstantValue.Create(local.Name), stringType)
Dim expr = New BoundCall(
syntax,
method,
......
......@@ -819,7 +819,7 @@ End Class"
// Code size 16 (0x10)
.maxstack 1
IL_0000: ldstr ""x""
IL_0005: call ""Function <>x.<>GetObjectByAlias(String) As Object""
IL_0005: call ""Function Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.GetObjectByAlias(String) As Object""
IL_000a: castclass ""String""
IL_000f: ret
}
......@@ -861,11 +861,11 @@ End Class"
IL_0000: ldtoken ""Object""
IL_0005: call ""Function System.Type.GetTypeFromHandle(System.RuntimeTypeHandle) As System.Type""
IL_000a: ldstr ""x""
IL_000f: call ""Sub <>x.<>CreateVariable(System.Type, String)""
IL_000f: call ""Sub Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.CreateVariable(System.Type, String)""
IL_0014: ldstr ""x""
IL_0019: call ""Function <>x.<>GetVariableAddress(Of Object)(String) As Object""
IL_0019: call ""Function Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.GetVariableAddress(Of Object)(String) As Object""
IL_001e: ldstr ""x""
IL_0023: call ""Function <>x.<>GetObjectByAlias(String) As Object""
IL_0023: call ""Function Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.GetObjectByAlias(String) As Object""
IL_0028: call ""Function System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(Object) As Object""
IL_002d: stind.ref
IL_002e: ret
......
......@@ -462,7 +462,8 @@ End Class"
expr:="$ReturnValue(Of Object)",
resultProperties:=resultProperties,
errorMessage:=errorMessage)
Assert.Equal("(1) : error BC32045: '$ReturnValue' has no type parameters and so cannot have type arguments.", errorMessage)
' TODO (acasey): don't canonicalize name (GH #878)
Assert.Equal("(1) : error BC32045: '$returnvalue' has no type parameters and so cannot have type arguments.", errorMessage)
Const source = "
Class C
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册