[swift-dev] Generic typealiases

Ben Langmuir blangmuir at apple.com
Tue Mar 8 09:18:58 CST 2016

I tried doing a SourceKit cursor-info on a generic typealias of a tuple type, but it crashed when trying to mangle any of the typealias's generic parameters.  Should we be able to mangle the generic parameter, or do we need an early exit?

Assertion failed: (isa<NominalTypeDecl>(ctx) && "Only nominal types are contexts for mangleable entities"), function mangleContext, file /Users/blangmuir/src/s/swift/lib/AST/Mangle.cpp, line 254.
5  libsourcekitdInProc.dylib 0x0000000105a43591 __assert_rtn + 81
6  libsourcekitdInProc.dylib 0x000000010616b6a7 swift::Mangle::Mangler::mangleContext(swift::DeclContext const*, swift::Mangle::Mangler::BindGenerics) + 1735
7  libsourcekitdInProc.dylib 0x000000010616c0ba swift::Mangle::Mangler::mangleEntity(swift::ValueDecl const*, unsigned int) + 474
8  libsourcekitdInProc.dylib 0x00000001061af981 swift::ide::printDeclUSR(swift::ValueDecl const*, llvm::raw_ostream&) + 1041


> On Mar 7, 2016, at 11:09 PM, Chris Lattner via swift-dev <swift-dev at swift.org> wrote:
> Hi All,
> I just landed an implementation of generic typealiases, e.g. things like:
>    typealias StringDictionary<T> = Dictionary<String, T>
>    typealias IntFunction<T> = (T) -> Int
>    typealias MatchingTriple<T> = (T, T, T)
>    typealias BackwardTriple<T1,T2,T3> = (T3, T2, T1)
> etc now work.
> I have tested various scenarios with them, but I wouldn’t be surprised if there are corner cases that aren’t working yet.  Please try kicking them around and let me know if you run into any problems, thanks!
> -Chris
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

More information about the swift-dev mailing list