Skip to content

Parse failure with < after a cast destination type. #60146

Closed as not planned
Closed as not planned
@simanerush

Description

@simanerush

Description
When dealing with cast destination type and a < operator after it, the compiler assumes that the generic arguments list is going to follow the < and produces an expected type error.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Launch Swift.
  2. Run let _ = 1 as Int16 < 7.
  3. Observe the expected type error.

Expected behavior
There should be no expected type error, since < in this context is not supposed to be followed by a generic arguments list.

Environment

  • OS: macOS 12.4
  • Xcode Version: 13.4

Additional context
I fixed issue #43053 which addresses similar problem, but with the<< operator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.parserArea → compiler: The legacy C++ parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions