dart-lang / dart_style

An opinionated formatter/linter for Dart code
https://pub.dev/packages/dart_style
BSD 3-Clause "New" or "Revised" License
645 stars 118 forks source link

Tall style formatter hangs on this code snippet #1521

Open renggli opened 1 month ago

renggli commented 1 month ago

The tall style formatter does not halt when trying to format this code snippet:

typedef Map1<T1, R> = R Function(T1 arg1);

typedef Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> = R Function(
    T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);

extension Curry8<T1, T2, T3, T4, T5, T6, T7, T8, R>
    on Map8<T1, T2, T3, T4, T5, T6, T7, T8, R> {
  Map1<
          T1,
          Map1<T2,
              Map1<T3, Map1<T4, Map1<T5, Map1<T6, Map1<T7, Map1<T8, R>>>>>>>>
      get curry => (T1 arg1) => (T2 arg2) => (T3 arg3) => (T4 arg4) =>
          (T5 arg5) => (T6 arg6) => (T7 arg7) =>
              (T8 arg8) => this(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
}

The above snippet is quick minimal extraction that reproduces the problem I had formatting this code: https://github.com/renggli/dart-more/blob/0a6238928da483da55273c61b9807f51946e79d4/lib/src/functional/types/curry.dart#L61-L72.

munificent commented 3 weeks ago

Thanks, I'll take a look.