Skip to content

Allow parens within implicit member chains #83203

@hamishknight

Description

@hamishknight

We don't currently allow parens in the middle of an unresolved member chain:

struct S {
  static var foo: S { S() }
  var bar: S { S() }
}

let _: S = (.foo)     // works
let _: S = .foo.bar   // works
let _: S = (.foo).bar // error: cannot infer contextual base in reference to member 'foo'

However it's not clear this was an intentional design choice, as written there would be no other way to infer the base of .foo. We ought to consider lifting this restriction.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfimplicit member expressionsFeature → expressions: Implicit member expressionstype checkerArea → compiler: Semantic analysis

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions