@@ -812,49 +812,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
812
812
this += name.stripSuffix(" $" )
813
813
814
814
case tpe @ Type .Refinement (_, _, _) =>
815
- def rec (tp : Type ): Unit = tp match {
816
- case Type .Refinement (parent, name, info) =>
817
- rec(parent)
818
- indented {
819
- this += lineBreak()
820
- info match {
821
- case info @ TypeBounds (_, _) =>
822
- this += " type " += name
823
- printBounds(info)
824
- case info @ Type () =>
825
- info match {
826
- case Type .ByNameType (_) | Type .MethodType (_, _, _) | Type .TypeLambda (_, _, _) =>
827
- this += " def " += name
828
- case _ =>
829
- this += " val " += name
830
- }
831
- def printMethodicType (tp : Type ): Unit = tp match {
832
- case tp @ Type .MethodType (paramNames, params, res) =>
833
- this += " ("
834
- printMethodicTypeParams(paramNames, params)
835
- this += " )"
836
- printMethodicType(res)
837
- case tp @ Type .TypeLambda (paramNames, params, res) =>
838
- this += " ["
839
- printMethodicTypeParams(paramNames, params)
840
- this += " ]"
841
- printMethodicType(res)
842
- case Type .ByNameType (t) =>
843
- this += " : "
844
- printType(t)
845
- case tp @ Type () =>
846
- this += " : "
847
- printType(tp)
848
- }
849
- printMethodicType(info)
850
- }
851
- }
852
- case tp =>
853
- printType(tp)
854
- this += " {"
855
- }
856
- rec(tpe)
857
- this += lineBreak() += " }"
815
+ printRefinement(tpe)
858
816
859
817
case Type .AppliedType (tp, args) =>
860
818
printType(tp)
@@ -950,6 +908,50 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
950
908
else this
951
909
}
952
910
911
+ def printRefinement (tpe : Type ): Buffer = {
912
+ def printMethodicType (tp : TypeOrBounds ): Unit = tp match {
913
+ case tp @ Type .MethodType (paramNames, params, res) =>
914
+ this += " ("
915
+ printMethodicTypeParams(paramNames, params)
916
+ this += " )"
917
+ printMethodicType(res)
918
+ case tp @ Type .TypeLambda (paramNames, params, res) =>
919
+ this += " ["
920
+ printMethodicTypeParams(paramNames, params)
921
+ this += " ]"
922
+ printMethodicType(res)
923
+ case Type .ByNameType (t) =>
924
+ this += " : "
925
+ printType(t)
926
+ case tp @ Type () =>
927
+ this += " : "
928
+ printType(tp)
929
+ }
930
+ def rec (tp : Type ): Unit = tp match {
931
+ case Type .Refinement (parent, name, info) =>
932
+ rec(parent)
933
+ indented {
934
+ this += lineBreak()
935
+ info match {
936
+ case info @ TypeBounds (_, _) =>
937
+ this += " type " += name
938
+ printBounds(info)
939
+ case Type .ByNameType (_) | Type .MethodType (_, _, _) | Type .TypeLambda (_, _, _) =>
940
+ this += " def " += name
941
+ printMethodicType(info)
942
+ case info @ Type () =>
943
+ this += " val " += name
944
+ printMethodicType(info)
945
+ }
946
+ }
947
+ case tp =>
948
+ printType(tp)
949
+ this += " {"
950
+ }
951
+ rec(tpe)
952
+ this += lineBreak() += " }"
953
+ }
954
+
953
955
def printMethodicTypeParams (paramNames : List [String ], params : List [TypeOrBounds ]): Unit = {
954
956
def printInfo (info : TypeOrBounds ) = info match {
955
957
case info @ TypeBounds (_, _) => printBounds(info)
0 commit comments