Skip to content

Commit f6f8d04

Browse files
committed
Fix printing catch clause
1 parent 5a14ce2 commit f6f8d04

File tree

3 files changed

+22
-67
lines changed

3 files changed

+22
-67
lines changed

compiler/test/dotty/tools/dotc/FromTastyTests.scala

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ class FromTastyTests extends ParallelTesting {
178178
"i1891",
179179
"i1976",
180180
"i1990a",
181-
"i2056",
182181
"i2064",
183182
"i2112",
184183
"i2146",
@@ -313,7 +312,6 @@ class FromTastyTests extends ParallelTesting {
313312
"SI-7638",
314313
"SI-7638a",
315314
"sigs",
316-
"simple-exceptions",
317315
"simplelists",
318316
"simplesams",
319317
"spec-constr-new",
@@ -349,22 +347,18 @@ class FromTastyTests extends ParallelTesting {
349347
"t1053",
350348
"t1070",
351349
"t1085",
352-
"t1107a",
353350
"t1136",
354351
"t1147",
355352
"t1164",
356-
"t1168",
357353
"t1208",
358354
"t1236",
359355
"t1237",
360-
"t1260",
361356
"t1279a",
362357
"t1280",
363358
"t1318",
364359
"t1391",
365360
"t1438",
366361
"t1756",
367-
"t1789",
368362
"t1858",
369363
"t1957",
370364
"t1974",
@@ -374,7 +368,6 @@ class FromTastyTests extends ParallelTesting {
374368
"t2130-1",
375369
"t2130-2",
376370
"t2168",
377-
"t2171",
378371
"t2179",
379372
"t2260",
380373
"t2261",
@@ -414,7 +407,6 @@ class FromTastyTests extends ParallelTesting {
414407
"t3430",
415408
"t3528",
416409
"t3560",
417-
"t3570",
418410
"t361",
419411
"t3672",
420412
"t3777",
@@ -468,7 +460,6 @@ class FromTastyTests extends ParallelTesting {
468460
"t6089b",
469461
"t611",
470462
"t6123-explaintypes-implicits",
471-
"t6157",
472463
"t616",
473464
"t6162-inheritance",
474465
"t6225",
@@ -493,7 +484,6 @@ class FromTastyTests extends ParallelTesting {
493484
"t7322",
494485
"t7329",
495486
"t7426",
496-
"t7433",
497487
"t7475a",
498488
"t7475b",
499489
"t7475d",
@@ -519,7 +509,6 @@ class FromTastyTests extends ParallelTesting {
519509
"t8177a",
520510
"t8177g",
521511
"t8207",
522-
"t8315b",
523512
"tcpoly_infer_easy",
524513
"tcpoly_infer_explicit_tuple_wrapper",
525514
"tcpoly_infer_implicit_tuple_wrapper",
@@ -540,7 +529,6 @@ class FromTastyTests extends ParallelTesting {
540529
"traits",
541530
"traits_1",
542531
"Transactions",
543-
"tryTyping",
544532
"tuplePatDef",
545533
"typeclass-encoding",
546534
"typeclass-encoding2",
@@ -637,7 +625,6 @@ class FromTastyTests extends ParallelTesting {
637625

638626
),
639627
recompilationBlacklist = Set(
640-
"1938",
641628
"adding-growing-set",
642629
"applydynamic_sip",
643630
"array-addition",
@@ -660,7 +647,6 @@ class FromTastyTests extends ParallelTesting {
660647
"concat-two-strings",
661648
"concurrent-map-conversions",
662649
"config",
663-
"contrib674",
664650
"correct-bind",
665651
"Course-2002-03",
666652
"Course-2002-08",
@@ -696,15 +682,10 @@ class FromTastyTests extends ParallelTesting {
696682
"erased-4",
697683
"erased-machine-state",
698684
"erased-value-class",
699-
"exc",
700-
"exc1",
701-
"exc2",
702-
"exceptions",
703685
"exceptions-2",
704686
"exceptions-nest",
705687
"exoticnames",
706688
"final-var",
707-
"finally",
708689
"flat-flat-flat",
709690
"forwarder",
710691
"function-arity",
@@ -720,11 +701,9 @@ class FromTastyTests extends ParallelTesting {
720701
"i1423",
721702
"i1463",
722703
"i1503",
723-
"i1732",
724704
"i1748",
725705
"i1773",
726706
"i1779",
727-
"i2314",
728707
"i2360",
729708
"i2642",
730709
"i2795",
@@ -760,16 +739,12 @@ class FromTastyTests extends ParallelTesting {
760739
"inlinePrivates",
761740
"inlineProtected",
762741
"interpolation-opt",
763-
"interpolationArgs",
764742
"iterables",
765743
"iterator-from",
766-
"iterators",
767744
"lambda-sam-bridge",
768745
"lazy-implicit-lists",
769746
"lazy-implicit-nums",
770747
"lazy-traits",
771-
"liftedTry",
772-
"lists-run",
773748
"literals",
774749
"llift",
775750
"map_java_conversions",
@@ -794,9 +769,7 @@ class FromTastyTests extends ParallelTesting {
794769
"null-lazy-val",
795770
"null-val",
796771
"null-var",
797-
"optimizer-array-load",
798772
"overloads",
799-
"parmap-ops",
800773
"partialFunctions",
801774
"patmat-bind-typed",
802775
"pc-conversions",
@@ -807,25 +780,18 @@ class FromTastyTests extends ParallelTesting {
807780
"protectedSuper",
808781
"quote-compile-constants",
809782
"quote-simple-hole",
810-
"range",
811-
"range-unit",
812783
"reducable",
813784
"returning",
814785
"runtime",
815786
"search",
816787
"StackMap",
817788
"statics",
818-
"structuralNoSuchMethod",
819789
"supercalls-traits",
820-
"sysprops",
821790
"t0017",
822-
"t0325",
823791
"t0631",
824-
"t1335",
825792
"t1360",
826793
"t1505",
827794
"t1591",
828-
"t1672",
829795
"t1939",
830796
"t1987",
831797
"t1994",
@@ -842,9 +808,7 @@ class FromTastyTests extends ParallelTesting {
842808
"t2867",
843809
"t3038",
844810
"t3038d",
845-
"t3126",
846811
"t3199b",
847-
"t3232",
848812
"t3346g",
849813
"t3353",
850814
"t3361",
@@ -855,18 +819,13 @@ class FromTastyTests extends ParallelTesting {
855819
"t3613",
856820
"t3651",
857821
"t3763",
858-
"t3855",
859-
"t3935",
860822
"t4013",
861823
"t4013b",
862824
"t4013c",
863825
"t4024",
864826
"t405",
865-
"t4080",
866-
"t4148",
867827
"t4288",
868828
"t4300",
869-
"t4351",
870829
"t4536",
871830
"t4577",
872831
"t4582",
@@ -886,11 +845,9 @@ class FromTastyTests extends ParallelTesting {
886845
"t5604",
887846
"t5608",
888847
"t5610a",
889-
"t5629b",
890848
"t5648",
891849
"t5688",
892850
"t5733",
893-
"t5830",
894851
"t5866",
895852
"t5867",
896853
"t5879",
@@ -900,17 +857,14 @@ class FromTastyTests extends ParallelTesting {
900857
"t6052",
901858
"t6070",
902859
"t6077_patmat_cse_irrefutable",
903-
"t6089",
904860
"t6090",
905861
"t6111",
906-
"t6154",
907862
"t6220",
908863
"t6260",
909864
"t6260-delambdafy",
910865
"t6261",
911866
"t6272",
912867
"t6290",
913-
"t6370",
914868
"t6410",
915869
"t6443-varargs",
916870
"t6467",
@@ -919,11 +873,9 @@ class FromTastyTests extends ParallelTesting {
919873
"t6534",
920874
"t6574b",
921875
"t6611",
922-
"t6637",
923876
"t6644",
924877
"t6663",
925878
"t6706",
926-
"t6827",
927879
"t6908",
928880
"t7019",
929881
"t7120b",
@@ -938,10 +890,7 @@ class FromTastyTests extends ParallelTesting {
938890
"t7584",
939891
"t7584b",
940892
"t7685-class-simple",
941-
"t7763",
942-
"t7880",
943893
"t7899",
944-
"t7912",
945894
"t7985",
946895
"t7985b",
947896
"t7992",
@@ -950,30 +899,19 @@ class FromTastyTests extends ParallelTesting {
950899
"t8087",
951900
"t8100",
952901
"t8197",
953-
"t8233",
954-
"t8233-bcode",
955902
"t8346",
956903
"t8395",
957-
"t8601",
958-
"t8601b",
959-
"t8601c",
960-
"t8601d",
961904
"t8607",
962905
"t8823",
963-
"t8845",
964906
"t889",
965907
"t8931",
966-
"t8933c",
967908
"t978",
968909
"tcpoly_monads",
969910
"traitNoInit",
970911
"traitParamInit",
971912
"traitParams",
972913
"traits-initialization",
973-
"transpose",
974914
"try",
975-
"try-2",
976-
"try-catch-unify",
977915
"tryPatternMatch",
978916
"tuples",
979917
"typelevel",
@@ -984,9 +922,7 @@ class FromTastyTests extends ParallelTesting {
984922
"unit-var",
985923
"unit-volatile-var",
986924
"unit_erasure",
987-
"unittest_collection",
988925
"unittest_iterator",
989-
"unreachable",
990926
"value-class-extractor",
991927
"value-class-extractor-2",
992928
"value-class-partial-func-depmet",
@@ -1000,7 +936,6 @@ class FromTastyTests extends ParallelTesting {
1000936
"viewtest",
1001937
"virtpatmat_alts",
1002938
"virtpatmat_stringinterp",
1003-
"virtpatmat_switch",
1004939
"virtpatmat_try",
1005940
"virtpatmat_unapply",
1006941
"weakconform",
@@ -1107,6 +1042,7 @@ class FromTastyTests extends ParallelTesting {
11071042
"t8738",
11081043
"t3273",
11091044
"t3645",
1045+
"t3714",
11101046
"i1960",
11111047
"t2524",
11121048
"functionXXL",

library/src/scala/tasty/util/ShowSourceCode.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,12 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
408408
this += "try "
409409
printTree(body)
410410
if (cases.nonEmpty) {
411-
this += " catch "
412-
printCases(cases, lineBreak())
411+
this += " catch {"
412+
indented {
413+
this += lineBreak()
414+
printCases(cases, lineBreak())
415+
}
416+
this += lineBreak() += "}"
413417
}
414418
finallyOpt match {
415419
case Some(t) =>

tests/run/t6370.decompiled

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/** Decompiled from out/runTestFromTasty/run/t6370/Test.class */
2+
object Test {
3+
def main(args: scala.Array[scala.Predef.String]): scala.Unit = {
4+
val m: collection.immutable.ListMap[java.lang.String, scala.Int] = scala.collection.immutable.ListMap.apply[java.lang.String, scala.Int](scala.Predef.ArrowAssoc[java.lang.String]("x").->[scala.Int](1));
5+
try {
6+
{
7+
m.apply("y");
8+
()
9+
}
10+
} catch {
11+
case e: scala.NoSuchElementException =>
12+
dotty.DottyPredef.assert(e.getMessage().==("key not found: y"))
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)