swift-auto-diagram icon indicating copy to clipboard operation
swift-auto-diagram copied to clipboard

Generic types are not handled correctly

Open maddiemort opened this issue 8 years ago • 3 comments

A type with a generic type annotation is not handled correctly (the generic type is not recognised).

For example:

struct STError<T: ErrorKind>: Error, CustomStringConvertible {
    // ...
}

produces this:

screen shot 2017-02-25 at 14 09 56

maddiemort avatar Feb 25 '17 14:02 maddiemort

I tried adapting the regex to fix the issue for this case, but I can't get it to work without breaking the other cases. :( If you want you can take a look at it at line 68 in rubyResources/helpers.rb... Thanks for noticing this issue

yoshimkd avatar Feb 28 '17 01:02 yoshimkd

I think I managed to fix the regex to ignore the generic declaration by adding an additional group (?<genericPart>(<.*>)?) to match before inheritancePart group, see https://github.com/yoshimkd/swift-auto-diagram/pull/7 for the changes

Tested the above given example against the updated regex at https://regex101.com/r/HCX86K/1

ivanfoong avatar Aug 17 '17 03:08 ivanfoong

@sorenmortensen Hello, sorry I accidentally closed the issue. @ivanfoong made a change in a pull request that should fix your issue that you can check out.

yoshimkd avatar Aug 17 '17 07:08 yoshimkd