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
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software good first issue Good for newcomers type checker Area → compiler: Semantic analysis

Comments

@AnthonyLatsis
Copy link
Collaborator

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

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

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 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

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

Fixed alongside SR-9781

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 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 crash Bug: A crash, i.e., an abnormal termination of software good first issue Good for newcomers type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants