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-7499] type recursion not caught in Sema #50042

Closed
dabrahams opened this issue Apr 22, 2018 · 2 comments
Closed

[SR-7499] type recursion not caught in Sema #50042

dabrahams opened this issue Apr 22, 2018 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-7499
Radar rdar://problem/39747895
Original Reporter @dabrahams
Type Bug
Status Resolved
Resolution Done

Attachment: Download

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

md5: 7af21fc5263c7a31b6141f4d56f1ae34

is duplicated by:

  • SR-8005 Compiler crash with extension that provides all Collection requirements

Issue Description:

Compile the attached with Swift master at 79a2e45 for an assertion. Uncommenting the typealias in `Fibonacci` suppresses it.

Assertion failed: (found->second && "type recursion not caught in Sema"), function find, file /Users/dave/src/s/swift/lib/SIL/TypeLowering.cpp, line 1413.
0 swift 0x000000010b11d8b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010b11df46 SignalHandler(int) + 422
2 libsystem_platform.dylib 0x00007fff5bed0f5a _sigtramp + 26
3 swift 0x000000010c48d6b0 cmark_strbuf__initbuf + 112907
4 libsystem_c.dylib 0x00007fff5bc6e1ae abort + 127
5 libsystem_c.dylib 0x00007fff5bc361ac basename_r + 0
6 swift 0x00000001084c34c2 swift::Lowering::TypeConverter::find(swift::Lowering::TypeConverter::TypeKey) + 258
7 swift 0x00000001084c3856 swift::Lowering::TypeConverter::getTypeLowering(swift::Lowering::AbstractionPattern, swift::Type) + 230
8 swift 0x0000000107e938a2 swift::Lowering::TypeConverter::getTypeLowering(swift::Type) + 178
9 swift 0x00000001084c9e01 (anonymous namespace)::TypeClassifier::visitAnyEnumType(swift::CanType, swift::EnumDecl*) + 129
10 swift 0x00000001084c94e6 swift::CanTypeVisitor<(anonymous namespace)::TypeClassifier, LoweredTypeKind>::visit(swift::CanType) + 262
11 swift 0x00000001084cd74a (anonymous namespace)::LowerType::visitAnyStructType(swift::CanType, swift::StructDecl*) + 378
12 swift 0x00000001084c50f0 swift::CanTypeVisitor<(anonymous namespace)::LowerType, swift::Lowering::TypeLowering const*>::visit(swift::CanType) + 160
13 swift 0x00000001084c4b9e swift::Lowering::TypeConverter::getTypeLoweringForUncachedLoweredType(swift::Lowering::TypeConverter::TypeKey) + 206
14 swift 0x00000001084c3a8c swift::Lowering::TypeConverter::getTypeLowering(swift::Lowering::AbstractionPattern, swift::Type) + 796
15 swift 0x0000000107e938a2 swift::Lowering::TypeConverter::getTypeLowering(swift::Type) + 178
16 swift 0x00000001084c9e7a (anonymous namespace)::TypeClassifier::visitAnyStructType(swift::CanType, swift::StructDecl*) + 90
17 swift 0x00000001084c955e swift::CanTypeVisitor<(anonymous namespace)::TypeClassifier, LoweredTypeKind>::visit(swift::CanType) + 382
18 swift 0x00000001084c9649 swift::CanTypeVisitor<(anonymous namespace)::TypeClassifier, LoweredTypeKind>::visit(swift::CanType) + 617
19 swift 0x00000001084cd02b (anonymous namespace)::LowerType::visitAnyEnumType(swift::CanType, swift::EnumDecl*) + 379
20 swift 0x00000001084c5166 swift::CanTypeVisitor<(anonymous namespace)::LowerType, swift::Lowering::TypeLowering const*>::visit(swift::CanType) + 278
21 swift 0x00000001084c4b9e swift::Lowering::TypeConverter::getTypeLoweringForUncachedLoweredType(swift::Lowering::TypeConverter::TypeKey) + 206
22 swift 0x00000001084c3a8c swift::Lowering::TypeConverter::getTypeLowering(swift::Lowering::AbstractionPattern, swift::Type) + 796
23 swift 0x0000000107e938a2 swift::Lowering::TypeConverter::getTypeLowering(swift::Type) + 178
24 swift 0x00000001084c9e01 (anonymous namespace)::TypeClassifier::visitAnyEnumType(swift::CanType, swift::EnumDecl*) + 129
25 swift 0x00000001084c94e6 swift::CanTypeVisitor<(anonymous namespace)::TypeClassifier, LoweredTypeKind>::visit(swift::CanType) + 262
26 swift 0x00000001084cd74a (anonymous namespace)::LowerType::visitAnyStructType(swift::CanType, swift::StructDecl*) + 378
27 swift 0x00000001084c50f0 swift::CanTypeVisitor<(anonymous namespace)::LowerType, swift::Lowering::TypeLowering const*>::visit(swift::CanType) + 160
28 swift 0x00000001084c4b9e swift::Lowering::TypeConverter::getTypeLoweringForUncachedLoweredType(swift::Lowering::TypeConverter::TypeKey) + 206
29 swift 0x00000001084c3a8c swift::Lowering::TypeConverter::getTypeLowering(swift::Lowering::AbstractionPattern, swift::Type) + 796
30 swift 0x00000001084128a9 (anonymous namespace)::SILTypeSubstituter::visitType(swift::CanType) + 313
31 swift 0x000000010841218f swift::CanTypeVisitor<(anonymous namespace)::SILTypeSubstituter, swift::CanType>::visit(swift::CanType) + 95
32 swift 0x000000010840cf51 (anonymous namespace)::SILTypeSubstituter::substSILFunctionType(swift::CanTypeWrapper<swift::SILFunctionType>) + 673
33 swift 0x000000010840cc67 swift::SILFunctionType::substGenericArgs(swift::SILModule&, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>) + 71
34 swift 0x000000010840cbd8 swift::SILFunctionType::substGenericArgs(swift::SILModule&, swift::SubstitutionMap const&) + 56
35 swift 0x000000010840cb16 swift::SILFunctionType::substGenericArgs(swift::SILModule&, llvm::ArrayRef<swift::Substitution>) + 54
36 swift 0x0000000107eb9ccc (anonymous namespace)::Callee::createCalleeTypeInfo(swift::Lowering::SILGenFunction&, llvm::Optional<swift::SILDeclRef>, swift::SILType) const & + 124
37 swift 0x0000000107ea2efd (anonymous namespace)::Callee::getTypeInfo(swift::Lowering::SILGenFunction&, bool) const & + 317
38 swift 0x0000000107e9fc31 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 2305
39 swift 0x0000000107e9f214 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 1476
40 swift 0x0000000107f04c82 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 82
41 swift 0x0000000107ef9ee9 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
42 swift 0x0000000107f14811 swift::Lowering::ManagedValue llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>::callback_fn<(anonymous namespace)::RValueEmitter::visitErasureExpr(swift::ErasureExpr*, swift::Lowering::SGFContext)::$_8>(long, swift::Lowering::SGFContext) + 113
43 swift 0x0000000107ee1712 std::__1::__function::__func<swift::Lowering::SILGenFunction::emitExistentialErasure(swift::SILLocation, swift::CanType, swift::Lowering::TypeLowering const&, swift::Lowering::TypeLowering const&, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>, bool)::$_5, std::__1::allocator<swift::Lowering::SILGenFunction::emitExistentialErasure(swift::SILLocation, swift::CanType, swift::Lowering::TypeLowering const&, swift::Lowering::TypeLowering const&, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>, bool)::$_5>, void (swift::SILValue)>::operator()(swift::SILValue&&) + 242
44 swift 0x0000000107ec8c0c swift::Lowering::SILGenBuilder::bufferForExpr(swift::SILLocation, swift::SILType, swift::Lowering::TypeLowering const&, swift::Lowering::SGFContext, std::__1::function<void (swift::SILValue)>) + 236
45 swift 0x0000000107edc7c3 swift::Lowering::SILGenFunction::emitExistentialErasure(swift::SILLocation, swift::CanType, swift::Lowering::TypeLowering const&, swift::Lowering::TypeLowering const&, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>, bool) + 2115
46 swift 0x0000000107f09621 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 18929
47 swift 0x0000000107f06578 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 6472
48 swift 0x0000000107ef424f swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 319
49 swift 0x0000000107e7cc45 swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::Initialization*) && + 229
50 swift 0x0000000107e7d8a0 swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*, swift::Lowering::TypeLowering const&) && + 560
51 swift 0x0000000107eb477f (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 2383
52 swift 0x0000000107eb6e4e (anonymous namespace)::ArgEmitter::emitShuffle(swift::TupleShuffleExpr*, swift::Lowering::AbstractionPattern) + 5054
53 swift 0x0000000107eb580e (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 1486
54 swift 0x0000000107eb3ee3 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 179
55 swift 0x0000000107eb3345 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 453
56 swift 0x0000000107eb2bd7 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1975
57 swift 0x0000000107ea0079 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3401
58 swift 0x0000000107e9f214 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 1476
59 swift 0x0000000107f04c82 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 82
60 swift 0x0000000107efa5fa swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 1258
61 swift 0x0000000107f64e43 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 8899
62 swift 0x0000000107f62b75 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
63 swift 0x0000000107f1ca6d swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 509
64 swift 0x0000000107e9a197 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 311
65 swift 0x0000000107e91c58 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 760
66 swift 0x0000000107e96c9b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 827
67 swift 0x0000000107e97aa5 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 437
68 swift 0x0000000107e97fec swift::performSILGeneration(swift::ModuleDecl*, swift::SILOptions&, bool) + 28
69 swift 0x0000000107728325 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 10133
70 swift 0x0000000107724b7e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3310
71 swift 0x00000001076e13bd main + 2317
72 libdyld.dylib 0x00007fff5bbc2015 start + 1
73 libdyld.dylib 0x0000000000000009 start + 2755911669
Stack dump:
0. Program arguments: /Users/dave/src/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/bin/swift -frontend -interpret Multipass1.swift -enable-objc-interop -sdk /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -module-name Multipass1 
1. While emitting SIL for 'test()' at Multipass1.swift:3:1
2. While silgen emitFunction SIL function "@$S10Multipass14testyyF".
for 'test()' at Multipass1.swift:3:1
@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Apr 26, 2018

Swift Sync System create

@CodaFi
Copy link
Member

CodaFi commented Jul 14, 2021

5.5 reports

typealias SubSequence = MultipassSubSequence<Self>
> Circular reference

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

No branches or pull requests

2 participants