Swift REPL seg faults on tab completion

It seems like just about every time I try to use tab completion in the Swift REPL it blows up. Here's an example of it blowing up when I type just two characters: i and then TAB:

$ swift
Welcome to Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7).
Type :help for assistance.
  1> i0  lldb                     0x00000001014ab705 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  lldb                     0x00000001014aad77 llvm::sys::RunSignalHandlers() + 39
2  lldb                     0x00000001014abd58 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff7e309b5d _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 2177852608
5  LLDB                     0x0000000101f621dd (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 15469
6  LLDB                     0x00000001027407ba swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 458
7  LLDB                     0x0000000101f8603e doCodeCompletion(swift::SourceFile&, llvm::StringRef, unsigned int*, swift::CodeCompletionCallbacksFactory*) + 494
8  LLDB                     0x0000000101f85de1 swift::REPLCompletions::populate(swift::SourceFile&, llvm::StringRef) + 673
9  LLDB                     0x00000001019c5029 lldb_private::SwiftREPL::CompleteCode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, lldb_private::StringList&) + 569
10 LLDB                     0x00000001017744a9 lldb_private::REPL::IOHandlerComplete(lldb_private::IOHandler&, char const*, char const*, char const*, int, int, lldb_private::StringList&, lldb_private::StringList&) + 489
11 LLDB                     0x00000001016e8157 lldb_private::IOHandlerEditline::AutoCompleteCallback(char const*, char const*, char const*, int, int, lldb_private::StringList&, lldb_private::StringList&, void*) + 55
12 LLDB                     0x000000010178b1fe lldb_private::Editline::TabCommand(int) + 110
13 LLDB                     0x000000010178d531 lldb_private::Editline::ConfigureEditor(bool)::$_13::__invoke(editline*, int) + 33
14 libedit.3.dylib          0x00007fff7bc8974b el_wgets + 478
15 libedit.3.dylib          0x00007fff7bc9494b el_gets + 37
16 LLDB                     0x000000010178cd1e lldb_private::Editline::GetLines(int, lldb_private::StringList&, bool&) + 446
17 LLDB                     0x00000001016e8b03 lldb_private::IOHandlerEditline::Run() + 115
18 LLDB                     0x00000001016cffdb lldb_private::Debugger::ExecuteIOHandlers() + 123
19 LLDB                     0x00000001016d2a23 lldb_private::Debugger::IOHandlerThread(void*) + 19
20 LLDB                     0x000000010177d2d7 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 103
21 libsystem_pthread.dylib  0x00007fff7e3122eb _pthread_body + 126
22 libsystem_pthread.dylib  0x00007fff7e315249 _pthread_start + 66
23 libsystem_pthread.dylib  0x00007fff7e31140d thread_start + 13
Segmentation fault: 11
$ 

Running on macOS 10.14.6, launched from Terminal.

Summary

This text will be hidden

1 Like

Do you know if tabs are even supported other than in Strings in the Swift REPL? It's not a shell like bash or zsh.

They are supported. Mind works fine on Ubuntu 18.04.3

Welcome to Swift version 5.1.1 (swift-5.1.1-RELEASE).
Type :help for assistance.
  1> f
Available completions:
	fallthrough
	false: Bool
	fatalError() -> Never
	fatalError(message: String) -> Never
	fileprivate
	final
	for
	func

Edit:

Same problem with @x77686d with Swift 5.1.2 on macOS 10.15.1. Even have identical trace.

Looks like https://bugs.swift.org/browse/SR-11578

Ah, so it is! Thanks!

p.s.
How about an upvote?! :)

I have the same problem

Terms of Service

Privacy Policy

Cookie Policy