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-8335] Cannot type check MemoryLayout.offset(of:) without specifying base type in keypath #50863

Closed
hamishknight opened this issue Jul 20, 2018 · 7 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-8335
Radar rdar://problem/63778627
Original Reporter @hamishknight
Type Bug
Status Resolved
Resolution Duplicate
Environment

Swift version 4.2-dev (LLVM 748f9878c8, Clang 6c624d9bad, Swift b5eebe9e89)
Target: x86_64-apple-darwin17.6.0

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

md5: 3671c992406710f9f7f1ebb4aaa93511

duplicates:

  • SR-12390 Cannot use shorthand key path syntax on PartialKeyPath argument

Issue Description:

The following doesn't compile:

struct S {
  var foo: Int
}

// this works.
let m1 = MemoryLayout.offset(of: \S.foo)

// error: Expression type 'Int?' is ambiguous without more context
let m2 = MemoryLayout<S>.offset(of: \.foo)
@belkadan
Copy link
Contributor

@rudkx or @xedin, I thought you already fixed this?

@rudkx
Copy link
Member

rudkx commented Jul 23, 2018

@mdiep fixed this on master in #17094.

@belkadan
Copy link
Contributor

It doesn't seem to be fixed, though. Hamish is using a master build, and I tested it too.

@rudkx
Copy link
Member

rudkx commented Jul 23, 2018

Oh yes I just realized the fix that @mdiep did was specific to array subscripting.

@lorentey
Copy link
Member

@swift-cicreate

@LucianoPAlmeida
Copy link
Collaborator

@xedin @hamishknight I think this also relates to the same problem as SR-12390

@xedin
Copy link
Member

xedin commented May 31, 2020

Thanks, it indeed looks that way, let's duplicate.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

6 participants