Skip to content

Source position and type cast and brackets #2055

Closed
@pvojtechovsky

Description

@pvojtechovsky

This problem was found by #1927

In the code like

someFnc(((File) (null)));

The source position of null literal contains only sources "null", but may be there should be type case (File) and may be also brackets. So source position would contain this: ((File) (null)).

But then I would prefer to have more details in source position. So may be we should introduce ExpressionSourcePosition, which would be similar to DeclarationSourcePosition. It means it would have these parts

  • start/end -> "((File) (null))"
  • typeCastStart/End -> "(File)"
  • expressionStart/End -> "(null)"

@tdurieux Do you think it would make sense to introduce new ExpressionSourcePosition or we can use DeclarationSourcePosition instead here too? Or may be we do not need that at all and source position of expressions is just simple SourcePosition for some reason?

And what about brackets? Are they part of expression or not?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions