Skip to content

Parser is not parsimonious when calling ResolveTypeBySimpleName #949

@glopesdev

Description

@glopesdev

Type resolution using ResolveTypeBySimpleName sometimes fails to determine correctly the simple type name against which to resolve an expression. For example, the following lower-case expressions:

datetime.minvalue
datetime.minvalue.second

In the first expression, the simpleTypeName is correctly assigned the value datetime. In the second expression, the simpleTypeName becomes datetime.minvalue, and the more parsimonious type name datetime is not even attempted.

Surprisingly, constructor calls also fail to resolve against simple type names. For example, consider the following expression:

single(it)

In this case, there is no call at all to resolve the type, which is surprising.

Even stranger, partial expressions may attempt invalid resolutions. For example:

single(it).

In this case, the simpleTypeName passed to ResolveTypeBySimpleName becomes single(it), which is not a valid C# type name, rather than the primitive token identifier single.

There may be multiple independent parsing failures at work here, involving different syntactic elements, but they are all currently making it very hard to support custom type resolution correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions