Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-5108] Collection Type Shorthand Syntax Issues #47684

Open
an0 mannequin opened this issue Jun 6, 2017 · 3 comments
Open

[SR-5108] Collection Type Shorthand Syntax Issues #47684

an0 mannequin opened this issue Jun 6, 2017 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser

Comments

@an0
Copy link
Mannequin

an0 mannequin commented Jun 6, 2017

Previous ID SR-5108
Radar None
Original Reporter @an0
Type Bug
Environment

Xcode 9M136h

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, Parser
Assignee None
Priority Medium

md5: 1e8165b3e3374e192cd7fdf2f4dafd11

is duplicated by:

  • SR-11130 Type sugar supports nested types inconsistently

Issue Description:

struct Foo<T>: Sequence {
    
    var contents: [T]
    
    // [T].Iterator should be the same as Array<T>.Iterator but is not supported.
    func makeIterator() -> [T].Iterator {
        return contents.makeIterator()
    }
    
}
@theblixguy
Copy link
Collaborator

Does this need to go through evolution or is this a bug/improvement? @rintaro

@swift-ci
Copy link
Collaborator

swift-ci commented Oct 9, 2019

Comment by Owen Voorhees (JIRA)

The core team has previously indicated this would be a bug fix based on the dupe I just linked

@swift-ci
Copy link
Collaborator

Comment by Anass ALZurba (JIRA)

Any updates regarding this bug?
My understanding is that it's a limitation at the grammar level

We have the following rules:

type → dictionary-type

type → type-identifier

The second rule allows usage of nested types, while the first allows syntactic sugar for dictionaries

Would it be possible to add more rules to fix this bug?
I'm thinking something like

type → dictionary-type.type-identifier

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

2 participants