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-9784] Crash on accessing type alias through protocol-type instance #52210

Closed
AnthonyLatsis opened this issue Jan 28, 2019 · 5 comments
Closed

Comments

@AnthonyLatsis
Copy link
Collaborator

@AnthonyLatsis AnthonyLatsis commented Jan 28, 2019

Previous ID SR-9784
Radar None
Original Reporter @AnthonyLatsis
Type Bug
Status Resolved
Resolution Done
Environment

Silent on Version 10.1 (10B61), Crashes on master and 4.2

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, StarterBug, TypeChecker
Assignee rahulrrixe (JIRA)
Priority Medium

md5: feaf7ac67ad440729913b4a924419fb5

relates to:

  • SR-9781 Crash on concrete typealias access through existential metatype

Issue Description:

[Discussion | #21576 (comment)|#21576 (comment)]

protocol P { typealias E = Int }
func foo(arg: P) {
  print(arg.E.self) // Crash
}
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /Users/spestov/src/llvm/include/llvm/Support/Casting.h, line 255.
Stack dump:
0.  Program arguments: /Users/spestov/src/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift -frontend -c -primary-file a.swift -target x86_64-apple-darwin18.2.0 -enable-objc-interop -color-diagnostics -module-name a -o /var/folders/wg/nmvf884n4b14lt0yw4khjsv00000gn/T/a-a5c34f.o 
1.  While type-checking 'foo(arg:)' (at a.swift:2:1)
2.  While type-checking statement at [a.swift:2:18 - line:4:1] RangeText="{
  print(arg.E.self)
"
3.  While type-checking expression at [a.swift:3:3 - line:3:19] RangeText="print(arg.E.self"
0  swift                    0x00000001080d9a78 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x00000001080d8cf5 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x00000001080da082 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff5f09db3d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000003e88 _sigtramp + 2700501864
5  libsystem_c.dylib        0x00007fff5ef5b1c9 abort + 127
6  libsystem_c.dylib        0x00007fff5ef23868 basename_r + 0
7  swift                    0x00000001052ffb28 (anonymous namespace)::ExprRewriter::coerceObjectArgumentToType(swift::Expr*, swift::Type, swift::ValueDecl*, swift::AccessSemantics, swift::constraints::ConstraintLocatorBuilder) + 1080
8  swift                    0x00000001052eca8b (anonymous namespace)::ExprRewriter::buildMemberRef(swift::Expr*, swift::Type, swift::SourceLoc, swift::constraints::OverloadChoice, swift::DeclNameLoc, swift::Type, swift::constraints::ConstraintLocatorBuilder, swift::constraints::ConstraintLocatorBuilder, bool, swift::FunctionRefKind, swift::AccessSemantics, bool) + 2475
@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Mar 27, 2019

Comment by Rahul Ranjan (JIRA)

If provided, a little more context(Which file or method to look at); I will work on this bug.

@AnthonyLatsis
Copy link
Collaborator Author

@AnthonyLatsis AnthonyLatsis commented Apr 3, 2019

rahulrrixe (JIRA User) If you still want to work on this, have a look at performMemberLookup, around here.

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Apr 4, 2019

Comment by Rahul Ranjan (JIRA)

@AnthonyLatsis Thanks for the guidance. I have assigned the ticket to myself and started working on it.

@belkadan
Copy link
Contributor

@belkadan belkadan commented Jul 27, 2019

Still working on this, rahulrrixe (JIRA User)?

(I'm checking in on all the StarterBugs that haven't been touched in over a month; it's totally fine if you just haven't had time but still want to keep it.)

@AnthonyLatsis
Copy link
Collaborator Author

@AnthonyLatsis AnthonyLatsis commented Apr 9, 2020

Fixed alongside SR-9781

@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
Projects
None yet
Development

No branches or pull requests

3 participants