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-11130] Type sugar supports nested types inconsistently #53526

Open
beccadax opened this issue Jul 14, 2019 · 2 comments
Open

[SR-11130] Type sugar supports nested types inconsistently #53526

beccadax opened this issue Jul 14, 2019 · 2 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

@beccadax
Copy link
Contributor

Previous ID SR-11130
Radar None
Original Reporter @beccadax
Type Bug
Environment

True in at least Swift 5.0 and 5.1.

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

md5: 2ff725049d085d988e443dcc166c5a65

duplicates:

  • SR-5108 Collection Type Shorthand Syntax Issues

is duplicated by:

  • SR-11196 Cannot Reference 'Dictionary.Index' with Dictionary Shorthand Syntax

Issue Description:

This is allowed:

[String: Int].Keys.self

This fails to parse:

let keys: [String: Int].Keys

Array behaves analogously.

This presumably happens because types in expressions are resolved by special typechecker preprocessing, but these should probably be treated consistently. However, removing the expression form would be source-breaking, and adding the declaration form might be considered a language change requiring Evolution (if it's not an outright bug), so neither solution is completely trivial. Core team members have said that the lack of support in declarations is a bug that can be fixed without an Evolution proposal, but please note the change in the CHANGELOG file.

@belkadan
Copy link
Contributor

I'd probably consider it a bug that the type syntax doesn't work, but @DougGregor or @jckarter would have to confirm as Core Team members.

@jckarter
Copy link
Member

I agree that's a bug.

@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

3 participants