diff options
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | project/Build.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/Compiler.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 20 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 14 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/untpd.scala | 10 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Constraint.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/OrderingConstraint.scala | 44 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 27 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TyperState.scala | 34 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 9 | ||||
-rw-r--r-- | src/dotty/tools/dotc/parsing/Parsers.scala | 18 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/InterceptedMethods.scala | 1 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/PatternMatcher.scala | 160 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/PostTyper.scala | 7 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/TailRec.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/TreeChecker.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/TypeTestsCasts.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 30 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Dynamic.scala | 85 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Implicits.scala | 9 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/ImportInfo.scala | 1 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 27 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/ProtoTypes.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/RefChecks.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/TypeAssigner.scala | 36 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 204 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction.java | 87 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction1.java | 76 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction10.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction11.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction12.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction13.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction14.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction15.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction16.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction17.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction18.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction19.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction2.java | 164 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction20.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction21.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction22.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction3.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction4.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction5.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction6.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction7.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction8.java | 2 | ||||
-rw-r--r-- | src/scala/compat/java8/JFunction9.java | 2 | ||||
-rw-r--r-- | test/dotc/build.scala | 1 | ||||
-rw-r--r-- | test/dotc/tests.scala | 1 | ||||
-rw-r--r-- | tests/disabled/not-representable/hkt/compiler.error (renamed from tests/pending/hkt/compiler.error) | 0 | ||||
-rw-r--r-- | tests/disabled/not-representable/hkt/hkt.scala (renamed from tests/pending/hkt/hkt.scala) | 3 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t3999b.scala (renamed from tests/pending/pos/t3999b.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t5544/Api_1.scala (renamed from tests/run/t5544/Api_1.scala) | 1 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t5544/Test_2.scala (renamed from tests/run/t5544/Test_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t7035.scala (renamed from tests/pending/pos/t7035.scala) | 2 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t7228.scala (renamed from tests/pending/pos/t7228.scala) | 1 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t8111.scala (renamed from tests/pending/pos/t8111.scala) | 1 | ||||
-rw-r--r-- | tests/disabled/not-representable/t2337.scala (renamed from tests/pending/run/t2337.scala) | 2 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5604b/T_1.scala (renamed from tests/pending/pos/t5604b/T_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5604b/T_2.scala (renamed from tests/pending/pos/t5604b/T_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5604b/Test_1.scala (renamed from tests/pending/pos/t5604b/Test_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5604b/Test_2.scala (renamed from tests/pending/pos/t5604b/Test_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5604b/pack_1.scala (renamed from tests/pending/pos/t5604b/pack_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5954a/A_1.scala (renamed from tests/pending/pos/t5954a/A_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5954a/B_2.scala (renamed from tests/pending/pos/t5954a/B_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5954b/A_1.scala (renamed from tests/pending/pos/t5954b/A_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5954b/B_2.scala (renamed from tests/pending/pos/t5954b/B_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5954c/A_1.scala (renamed from tests/pending/pos/t5954c/A_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5954c/B_2.scala (renamed from tests/pending/pos/t5954c/B_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5954d/A_1.scala (renamed from tests/pending/pos/t5954d/A_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t5954d/B_2.scala (renamed from tests/pending/pos/t5954d/B_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t8134/A_1.scala (renamed from tests/pending/pos/t8134/A_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-testable/t8134/B_2.scala (renamed from tests/pending/pos/t8134/B_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/structural-type/pos/depmet_implicit_oopsla_zipwith.scala (renamed from tests/pending/pos/depmet_implicit_oopsla_zipwith.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/typetags/pos/t8237b.scala (renamed from tests/pending/pos/t8237b.scala) | 0 | ||||
-rw-r--r-- | tests/neg/applydynamic_sip.check | 52 | ||||
-rw-r--r-- | tests/neg/applydynamic_sip.flags (renamed from tests/untried/neg/applydynamic_sip.flags) | 0 | ||||
-rw-r--r-- | tests/neg/applydynamic_sip.scala | 36 | ||||
-rw-r--r-- | tests/neg/emptyCatch.scala | 3 | ||||
-rw-r--r-- | tests/neg/i1503.scala | 14 | ||||
-rw-r--r-- | tests/neg/t6355b.check (renamed from tests/untried/neg/t6355b.check) | 4 | ||||
-rw-r--r-- | tests/neg/t6355b.scala (renamed from tests/untried/neg/t6355b.scala) | 4 | ||||
-rw-r--r-- | tests/neg/t6663.check (renamed from tests/untried/neg/t6663.check) | 0 | ||||
-rw-r--r-- | tests/neg/t6663.scala (renamed from tests/untried/neg/t6663.scala) | 2 | ||||
-rw-r--r-- | tests/neg/t6920.check (renamed from tests/untried/neg/t6920.check) | 2 | ||||
-rw-r--r-- | tests/neg/t6920.scala (renamed from tests/untried/neg/t6920.scala) | 2 | ||||
-rw-r--r-- | tests/neg/t7239.scala (renamed from tests/pending/pos/t7239.scala) | 10 | ||||
-rw-r--r-- | tests/neg/t8002-nested-scope.scala (renamed from tests/pending/pos/t8002-nested-scope.scala) | 2 | ||||
-rw-r--r-- | tests/neg/t8006.check (renamed from tests/untried/neg/t8006.check) | 2 | ||||
-rw-r--r-- | tests/neg/t8006.scala (renamed from tests/untried/neg/t8006.scala) | 2 | ||||
-rw-r--r-- | tests/pending/import-rewrite/compiler.error | 6 | ||||
-rw-r--r-- | tests/pending/neg/i533/Compat.scala | 7 | ||||
-rw-r--r-- | tests/pending/neg/i533/JA.java | 5 | ||||
-rw-r--r-- | tests/pending/pos/contraImplicits.scala | 18 | ||||
-rw-r--r-- | tests/pending/pos/depmet_implicit_norm_ret.scala | 9 | ||||
-rw-r--r-- | tests/pending/pos/depsel.scala | 14 | ||||
-rw-r--r-- | tests/pending/pos/exponential-spec.scala | 4 | ||||
-rw-r--r-- | tests/pending/pos/generic-sigs.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/infersingle.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/isApplicableSafe.scala | 8 | ||||
-rw-r--r-- | tests/pending/pos/setter-not-implicit.scala | 3 | ||||
-rw-r--r-- | tests/pending/pos/stable.scala | 11 | ||||
-rw-r--r-- | tests/pending/pos/t3631.scala | 1 | ||||
-rw-r--r-- | tests/pending/pos/t3960.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t4188.scala | 1 | ||||
-rw-r--r-- | tests/pending/pos/t4579.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t4911.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t5029.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t5899.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t5932.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t6123-explaintypes-implicits.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t6994.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t7011.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t7285a.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/t7296.scala | 1 | ||||
-rw-r--r-- | tests/pending/pos/t762.scala | 2 | ||||
-rw-r--r-- | tests/pending/pos/t8187.check | 0 | ||||
-rw-r--r-- | tests/pending/pos/t8364.check | 0 | ||||
-rw-r--r-- | tests/pending/pos/t8369a.check | 0 | ||||
-rw-r--r-- | tests/pending/pos/trait-force-info.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/virtpatmat_alts_subst.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/virtpatmat_exist1.flags | 1 | ||||
-rw-r--r-- | tests/pending/pos/virtpatmat_exist3.flags | 1 | ||||
-rw-r--r-- | tests/pending/run/t2337.check | 4 | ||||
-rw-r--r-- | tests/pending/run/t3150.scala | 36 | ||||
-rw-r--r-- | tests/pending/run/unapply.check | 3 | ||||
-rw-r--r-- | tests/pos-scala2/naming-resolution/callsite.scala | 10 | ||||
-rw-r--r-- | tests/pos-scala2/naming-resolution/package.scala | 5 | ||||
-rw-r--r-- | tests/pos-scala2/t3050.scala (renamed from tests/pending/run/t3050.scala) | 0 | ||||
-rw-r--r-- | tests/pos-scala2/t7688.scala (renamed from tests/pending/pos/t7688.scala) | 0 | ||||
-rw-r--r-- | tests/pos-special/t8146a.scala (renamed from tests/pending/pos/t8146a.scala) | 0 | ||||
-rw-r--r-- | tests/pos/apply-equiv.scala (renamed from tests/pending/pos/apply-equiv.scala) | 0 | ||||
-rw-r--r-- | tests/pos/dependent-implicits.scala | 7 | ||||
-rw-r--r-- | tests/pos/extractor-types.scala (renamed from tests/pending/pos/extractor-types.scala) | 0 | ||||
-rw-r--r-- | tests/pos/for-filter.scala | 12 | ||||
-rw-r--r-- | tests/pos/gadts2.scala (renamed from tests/pending/pos/gadts2.scala) | 2 | ||||
-rw-r--r-- | tests/pos/hk-infer.scala (renamed from tests/pending/pos/hk-infer.scala) | 0 | ||||
-rw-r--r-- | tests/pos/i743.scala (renamed from tests/pending/pos/i743.scala) | 0 | ||||
-rw-r--r-- | tests/pos/import-rewrite/file.scala (renamed from tests/pending/import-rewrite/file.scala) | 0 | ||||
-rw-r--r-- | tests/pos/import-rewrite/rewrite.scala (renamed from tests/pending/import-rewrite/rewrite.scala) | 0 | ||||
-rw-r--r-- | tests/pos/infersingle.scala (renamed from tests/pending/pos/infersingle.scala) | 0 | ||||
-rw-r--r-- | tests/pos/isApplicableSafe.scala | 54 | ||||
-rw-r--r-- | tests/pos/lazyvals.scala (renamed from tests/pending/pos/lazyvals.scala) | 0 | ||||
-rw-r--r-- | tests/pos/matthias4.scala (renamed from tests/pending/pos/matthias4.scala) | 0 | ||||
-rw-r--r-- | tests/pos/mixins.scala (renamed from tests/pending/pos/mixins.scala) | 0 | ||||
-rw-r--r-- | tests/pos/return_thistype.scala (renamed from tests/pending/pos/return_thistype.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1500a.scala | 28 | ||||
-rw-r--r-- | tests/pos/t1513a.scala | 36 | ||||
-rw-r--r-- | tests/pos/t1513b.scala | 25 | ||||
-rw-r--r-- | tests/pos/t3494.scala (renamed from tests/pending/pos/t3494.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t3800.scala (renamed from tests/pending/pos/t3800.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t3862.scala (renamed from tests/pending/pos/t3862.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t3880.scala (renamed from tests/pending/pos/t3880.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t3999/a_1.scala (renamed from tests/pending/pos/t3999/a_1.scala) | 2 | ||||
-rw-r--r-- | tests/pos/t3999/b_2.scala (renamed from tests/pending/pos/t3999/b_2.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t4269.scala (renamed from tests/pending/pos/t4269.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t5070.scala | 15 | ||||
-rw-r--r-- | tests/pos/t5330.scala (renamed from tests/pending/pos/t5330.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t5604/ReplConfig.scala (renamed from tests/pending/pos/t5604/ReplConfig.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t5604/ReplReporter.scala (renamed from tests/pending/pos/t5604/ReplReporter.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t5726.scala (renamed from tests/pending/pos/t5726.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t5769.scala (renamed from tests/pending/pos/t5769.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t578.scala (renamed from tests/pending/pos/t578.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t5899.scala (renamed from tests/pending/pos/t5899.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t6084.scala (renamed from tests/pending/pos/t6084.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t6722.scala (renamed from tests/pending/pos/t6722.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t6815_import.scala (renamed from tests/pending/pos/t6815_import.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t6948.scala (renamed from tests/pending/pos/t6948.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t7294.scala (renamed from tests/pending/pos/t7294.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t7426.scala (renamed from tests/pending/pos/t7426.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t7517.scala (renamed from tests/pending/pos/t7517.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t762.scala | 4 | ||||
-rw-r--r-- | tests/pos/t7668.scala (renamed from tests/pending/pos/t7668.scala) | 2 | ||||
-rw-r--r-- | tests/pos/t7902.scala (renamed from tests/pending/pos/t7902.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t8046c.scala (renamed from tests/pending/pos/t8046c.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t807.scala (renamed from tests/pending/pos/t807.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t8300-patmat-a.scala (renamed from tests/pending/pos/t8300-patmat-a.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t8300-patmat-b.scala (renamed from tests/pending/pos/t8300-patmat-b.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t8301b.scala (renamed from tests/pending/pos/t8301b.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t8364.scala (renamed from tests/pending/pos/t8364.scala) | 0 | ||||
-rw-r--r-- | tests/pos/trait-force-info.scala (renamed from tests/pending/pos/trait-force-info.scala) | 0 | ||||
-rw-r--r-- | tests/pos/tryWithoutHandler.scala | 7 | ||||
-rw-r--r-- | tests/run/applydynamic_sip.check (renamed from tests/pending/run/applydynamic_sip.check) | 0 | ||||
-rw-r--r-- | tests/run/applydynamic_sip.flags (renamed from tests/pending/run/applydynamic_sip.flags) | 0 | ||||
-rw-r--r-- | tests/run/applydynamic_sip.scala (renamed from tests/pending/run/applydynamic_sip.scala) | 1 | ||||
-rw-r--r-- | tests/run/dynamic-anyval.check (renamed from tests/pending/run/dynamic-anyval.check) | 0 | ||||
-rw-r--r-- | tests/run/dynamic-anyval.scala (renamed from tests/pending/run/dynamic-anyval.scala) | 0 | ||||
-rw-r--r-- | tests/run/dynamicDynamicTests.scala | 41 | ||||
-rw-r--r-- | tests/run/i1490.check | 3 | ||||
-rw-r--r-- | tests/run/i1490.scala | 13 | ||||
-rw-r--r-- | tests/run/i1503.check | 5 | ||||
-rw-r--r-- | tests/run/i1503.scala | 38 | ||||
-rw-r--r-- | tests/run/t1335.scala | 11 | ||||
-rw-r--r-- | tests/run/t1500b.scala | 21 | ||||
-rw-r--r-- | tests/run/t1500c.scala | 19 | ||||
-rw-r--r-- | tests/run/t298.check (renamed from tests/pending/run/t298.check) | 0 | ||||
-rw-r--r-- | tests/run/t298.scala (renamed from tests/pending/run/t298.scala) | 0 | ||||
-rw-r--r-- | tests/run/t3026.check (renamed from tests/pending/run/t3026.check) | 0 | ||||
-rwxr-xr-x | tests/run/t3026.scala (renamed from tests/pending/run/t3026.scala) | 0 | ||||
-rw-r--r-- | tests/run/t3353.check (renamed from tests/pending/run/t3353.check) | 0 | ||||
-rw-r--r-- | tests/run/t3353.scala (renamed from tests/pending/run/t3353.scala) | 0 | ||||
-rw-r--r-- | tests/run/t4536.check (renamed from tests/pending/run/t4536.check) | 0 | ||||
-rw-r--r-- | tests/run/t4536.flags (renamed from tests/pending/run/t4536.flags) | 0 | ||||
-rw-r--r-- | tests/run/t4536.scala (renamed from tests/pending/run/t4536.scala) | 8 | ||||
-rw-r--r-- | tests/run/t5040.check (renamed from tests/pending/run/t5040.check) | 0 | ||||
-rw-r--r-- | tests/run/t5040.flags (renamed from tests/pending/run/t5040.flags) | 0 | ||||
-rw-r--r-- | tests/run/t5040.scala (renamed from tests/pending/run/t5040.scala) | 1 | ||||
-rw-r--r-- | tests/run/t5733.check (renamed from tests/pending/run/t5733.check) | 0 | ||||
-rw-r--r-- | tests/run/t5733.scala (renamed from tests/pending/run/t5733.scala) | 0 | ||||
-rw-r--r-- | tests/run/t6353.check (renamed from tests/pending/run/t6353.check) | 0 | ||||
-rw-r--r-- | tests/run/t6353.scala (renamed from tests/pending/run/t6353.scala) | 0 | ||||
-rw-r--r-- | tests/run/t6355.check (renamed from tests/pending/run/t6355.check) | 0 | ||||
-rw-r--r-- | tests/run/t6355.scala (renamed from tests/pending/run/t6355.scala) | 0 | ||||
-rw-r--r-- | tests/run/t6663.check (renamed from tests/pending/run/t6663.check) | 0 | ||||
-rw-r--r-- | tests/run/t6663.flags (renamed from tests/pending/run/t6663.flags) | 0 | ||||
-rw-r--r-- | tests/run/t6663.scala (renamed from tests/pending/run/t6663.scala) | 0 | ||||
-rw-r--r-- | tests/run/unapply.scala (renamed from tests/pending/run/unapply.scala) | 4 | ||||
-rw-r--r-- | tests/untried/neg/applydynamic_sip.check | 73 | ||||
-rw-r--r-- | tests/untried/neg/applydynamic_sip.scala | 33 |
224 files changed, 1395 insertions, 525 deletions
@@ -30,8 +30,10 @@ See [github contributors page](https://github.com/lampepfl/dotty/graphs/contribu | Colored Repl | Implemented | | Sbt incremental build | Implemented | | Non-blocking lazy vals | Implemented | +| Multiverse equality | Implemented | | Option-less pattern matching(based on [name-based patmat](https://github.com/scala/scala/pull/2848)) | Implemented | | Function arity adaptation | Implemented | +| Exhaustivity checks in pattern matching | Implemented | | | | | Non-boxed arrays of value classes | In progress | | Working contravariant implicits | In progress | @@ -44,8 +46,7 @@ See [github contributors page](https://github.com/lampepfl/dotty/graphs/contribu | Effects | Under consideration | | Auto-completion in repl | Under consideration | | Spec Option-less pattern matching | Under consideration | -| Multiverse equality | Under consideration | -| Exhaustivity checks in pattern matching | Under consideration | + There are also plethora of small details such as [per-callsite @tailrec annotations](https://github.com/lampepfl/dotty/issues/1221) ####What are the complications that I can have If I start using Dotty? diff --git a/project/Build.scala b/project/Build.scala index eb3e41126..1412556a9 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -10,7 +10,7 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ object DottyBuild extends Build { val baseVersion = "0.1" - val isNightly = sys.props.get("NIGHTLYBUILD") == Some("yes") + val isNightly = sys.env.get("NIGHTLYBUILD") == Some("yes") val jenkinsMemLimit = List("-Xmx1300m") @@ -93,8 +93,6 @@ object DottyBuild extends Build { //http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728 com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys.withSource := true, - resolvers += Resolver.sonatypeRepo("snapshots"), - // get libraries onboard partestDeps := Seq(scalaCompiler, "org.scala-lang" % "scala-reflect" % scalaVersion.value, @@ -102,7 +100,7 @@ object DottyBuild extends Build { libraryDependencies ++= partestDeps.value, libraryDependencies ++= Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.1", "org.scala-lang.modules" %% "scala-partest" % "1.0.11" % "test", - "ch.epfl.lamp" % "dottydoc-client" % "0.1-SNAPSHOT", + "ch.epfl.lamp" % "dottydoc-client" % "0.1.0", "com.novocode" % "junit-interface" % "0.11" % "test", "com.github.spullara.mustache.java" % "compiler" % "0.9.3", "com.typesafe.sbt" % "sbt-interface" % sbtVersion.value), diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala index d1f126860..2120fa73e 100644 --- a/src/dotty/tools/dotc/Compiler.scala +++ b/src/dotty/tools/dotc/Compiler.scala @@ -25,7 +25,7 @@ class Compiler { /** Meta-ordering constraint: * - * DenotTransformers that change the signature of their denotation's info must go + * DenotTransformers that change the signature of their denotation's info must go * after erasure. The reason is that denotations are permanently referred to by * TermRefs which contain a signature. If the signature of a symbol would change, * all refs to it would become outdated - they could not be dereferenced in the @@ -83,7 +83,7 @@ class Compiler { new CapturedVars, // Represent vars captured by closures as heap objects new Constructors, // Collect initialization code in primary constructors // Note: constructors changes decls in transformTemplate, no InfoTransformers should be added after it - new FunctionalInterfaces,// Rewrites closures to implement @specialized types of Functions. + new FunctionalInterfaces, // Rewrites closures to implement @specialized types of Functions. new GetClass), // Rewrites getClass calls on primitive types. List(new LambdaLift, // Lifts out nested functions to class scope, storing free variables in environments // Note: in this mini-phase block scopes are incorrect. No phases that rely on scopes should be here diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index 346af42b8..631b1bf8d 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -8,6 +8,7 @@ import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._ import Decorators._ import language.higherKinds import collection.mutable.ListBuffer +import util.Attachment import config.Printers._ object desugar { @@ -17,11 +18,16 @@ object desugar { import untpd._ + /** Tags a .withFilter call generated by desugaring a for expression. + * Such calls can alternatively be rewritten to use filter. + */ + val MaybeFilter = new Attachment.Key[Unit] + /** Info of a variable in a pattern: The named tree and its type */ private type VarInfo = (NameTree, Tree) /** Names of methods that are added unconditionally to case classes */ - def isDesugaredCaseClassMethodName(name: Name)(implicit ctx: Context) = + def isDesugaredCaseClassMethodName(name: Name)(implicit ctx: Context): Boolean = name == nme.isDefined || name == nme.copy || name == nme.productArity || @@ -693,7 +699,7 @@ object desugar { Apply(Select(left, op), args) } else { val x = ctx.freshName().toTermName - Block( + new InfixOpBlock( ValDef(x, TypeTree(), left).withMods(synthetic), Apply(Select(right, op), Ident(x))) } @@ -773,6 +779,12 @@ object desugar { (Bind(name, pat), Ident(name)) } + /** Add MaybeFilter attachment */ + def orFilter(tree: Tree): tree.type = { + tree.putAttachment(MaybeFilter, ()) + tree + } + /** Make a pattern filter: * rhs.withFilter { case pat => true case _ => false } * @@ -803,7 +815,7 @@ object desugar { val cases = List( CaseDef(pat, EmptyTree, Literal(Constant(true))), CaseDef(Ident(nme.WILDCARD), EmptyTree, Literal(Constant(false)))) - Apply(Select(rhs, nme.withFilter), makeCaseLambda(cases)) + Apply(orFilter(Select(rhs, nme.withFilter)), makeCaseLambda(cases)) } /** Is pattern `pat` irrefutable when matched against `rhs`? @@ -858,7 +870,7 @@ object desugar { val vfrom1 = new IrrefutableGenFrom(makeTuple(allpats), rhs1) makeFor(mapName, flatMapName, vfrom1 :: rest1, body) case (gen: GenFrom) :: test :: rest => - val filtered = Apply(rhsSelect(gen, nme.withFilter), makeLambda(gen.pat, test)) + val filtered = Apply(orFilter(rhsSelect(gen, nme.withFilter)), makeLambda(gen.pat, test)) val genFrom = if (isIrrefutableGenFrom(gen)) new IrrefutableGenFrom(gen.pat, filtered) else GenFrom(gen.pat, filtered) diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index a48651ebf..7c3f7f385 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -630,20 +630,6 @@ object TreeInfo { } } - def isApplyDynamicName(name: Name) = (name == nme.updateDynamic) || (name == nme.selectDynamic) || (name == nme.applyDynamic) || (name == nme.applyDynamicNamed) - - class DynamicApplicationExtractor(nameTest: Name => Boolean) { - def unapply(tree: Tree) = tree match { - case Apply(TypeApply(Select(qual, oper), _), List(Literal(Constant(name)))) if nameTest(oper) => Some((qual, name)) - case Apply(Select(qual, oper), List(Literal(Constant(name)))) if nameTest(oper) => Some((qual, name)) - case Apply(Ident(oper), List(Literal(Constant(name)))) if nameTest(oper) => Some((EmptyTree(), name)) - case _ => None - } - } - object DynamicUpdate extends DynamicApplicationExtractor(_ == nme.updateDynamic) - object DynamicApplication extends DynamicApplicationExtractor(isApplyDynamicName) - object DynamicApplicationNamed extends DynamicApplicationExtractor(_ == nme.applyDynamicNamed) - object MacroImplReference { private def refPart(tree: Tree): Tree = tree match { case TypeApply(fun, _) => refPart(fun) diff --git a/src/dotty/tools/dotc/ast/untpd.scala b/src/dotty/tools/dotc/ast/untpd.scala index cef78c6e6..6bbb76b89 100644 --- a/src/dotty/tools/dotc/ast/untpd.scala +++ b/src/dotty/tools/dotc/ast/untpd.scala @@ -63,6 +63,16 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { class PolyTypeDef(name: TypeName, override val tparams: List[TypeDef], rhs: Tree) extends TypeDef(name, rhs) + /** A block arising from a right-associative infix operation, where, e.g. + * + * a +: b + * + * is expanded to + * + * { val x = a; b.+:(x) } + */ + class InfixOpBlock(leftOperand: Tree, rightOp: Tree) extends Block(leftOperand :: Nil, rightOp) + // ----- TypeTrees that refer to other tree's symbols ------------------- /** A type tree that gets its type from some other tree's symbol. Enters the diff --git a/src/dotty/tools/dotc/core/Constraint.scala b/src/dotty/tools/dotc/core/Constraint.scala index 436b035dc..99b4af0a9 100644 --- a/src/dotty/tools/dotc/core/Constraint.scala +++ b/src/dotty/tools/dotc/core/Constraint.scala @@ -143,6 +143,9 @@ abstract class Constraint extends Showable { /** The uninstantiated typevars of this constraint */ def uninstVars: collection.Seq[TypeVar] + /** The weakest constraint that subsumes both this constraint and `other` */ + def & (other: Constraint)(implicit ctx: Context): Constraint + /** Check that no constrained parameter contains itself as a bound */ def checkNonCyclic()(implicit ctx: Context): Unit diff --git a/src/dotty/tools/dotc/core/OrderingConstraint.scala b/src/dotty/tools/dotc/core/OrderingConstraint.scala index b0170b67c..e7e388be9 100644 --- a/src/dotty/tools/dotc/core/OrderingConstraint.scala +++ b/src/dotty/tools/dotc/core/OrderingConstraint.scala @@ -15,11 +15,13 @@ import annotation.tailrec object OrderingConstraint { + type ArrayValuedMap[T] = SimpleMap[GenericType, Array[T]] + /** The type of `OrderingConstraint#boundsMap` */ - type ParamBounds = SimpleMap[GenericType, Array[Type]] + type ParamBounds = ArrayValuedMap[Type] /** The type of `OrderingConstraint#lowerMap`, `OrderingConstraint#upperMap` */ - type ParamOrdering = SimpleMap[GenericType, Array[List[PolyParam]]] + type ParamOrdering = ArrayValuedMap[List[PolyParam]] /** A new constraint with given maps */ private def newConstraint(boundsMap: ParamBounds, lowerMap: ParamOrdering, upperMap: ParamOrdering)(implicit ctx: Context) : OrderingConstraint = { @@ -495,6 +497,44 @@ class OrderingConstraint(private val boundsMap: ParamBounds, } } + def & (other: Constraint)(implicit ctx: Context) = { + def merge[T](m1: ArrayValuedMap[T], m2: ArrayValuedMap[T], join: (T, T) => T): ArrayValuedMap[T] = { + var merged = m1 + def mergeArrays(xs1: Array[T], xs2: Array[T]) = { + val xs = xs1.clone + for (i <- xs.indices) xs(i) = join(xs1(i), xs2(i)) + xs + } + m2.foreachBinding { (poly, xs2) => + merged = merged.updated(poly, + if (m1.contains(poly)) mergeArrays(m1(poly), xs2) else xs2) + } + merged + } + + def mergeParams(ps1: List[PolyParam], ps2: List[PolyParam]) = + (ps1 /: ps2)((ps1, p2) => if (ps1.contains(p2)) ps1 else p2 :: ps1) + + def mergeEntries(e1: Type, e2: Type): Type = e1 match { + case e1: TypeBounds => + e2 match { + case e2: TypeBounds => e1 & e2 + case _ if e1 contains e2 => e2 + case _ => mergeError + } + case _ if e1 eq e2 => e1 + case _ => mergeError + } + + def mergeError = throw new AssertionError(i"cannot merge $this with $other") + + val that = other.asInstanceOf[OrderingConstraint] + new OrderingConstraint( + merge(this.boundsMap, that.boundsMap, mergeEntries), + merge(this.lowerMap, that.lowerMap, mergeParams), + merge(this.upperMap, that.upperMap, mergeParams)) + } + override def checkClosed()(implicit ctx: Context): Unit = { def isFreePolyParam(tp: Type) = tp match { case PolyParam(binder: GenericType, _) => !contains(binder) diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index 8d7e9d164..538a74198 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -76,6 +76,19 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { myNothingType } + /** Indicates whether a previous subtype check used GADT bounds */ + var GADTused = false + + /** Record that GADT bounds of `sym` were used in a subtype check. + * But exclude constructor type parameters, as these are aliased + * to the corresponding class parameters, which does not constitute + * a true usage of a GADT symbol. + */ + private def GADTusage(sym: Symbol) = { + if (!sym.owner.isConstructor) GADTused = true + true + } + // Subtype testing `<:<` def topLevelSubType(tp1: Type, tp2: Type): Boolean = { @@ -325,7 +338,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { val gbounds2 = ctx.gadt.bounds(tp2.symbol) (gbounds2 != null) && (isSubTypeWhenFrozen(tp1, gbounds2.lo) || - narrowGADTBounds(tp2, tp1, isUpper = false)) + narrowGADTBounds(tp2, tp1, isUpper = false)) && + GADTusage(tp2.symbol) } ((frozenConstraint || !isCappable(tp1)) && isSubType(tp1, lo2) || compareGADT || @@ -507,7 +521,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { val gbounds1 = ctx.gadt.bounds(tp1.symbol) (gbounds1 != null) && (isSubTypeWhenFrozen(gbounds1.hi, tp2) || - narrowGADTBounds(tp1, tp2, isUpper = true)) + narrowGADTBounds(tp1, tp2, isUpper = true)) && + GADTusage(tp1.symbol) } isSubType(hi1, tp2) || compareGADT case _ => @@ -846,11 +861,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { // special case for situations like: // class C { type T } // val foo: C - // foo.type <: C { type T = foo.T } + // foo.type <: C { type T {= , <: , >:} foo.T } def selfReferentialMatch = tp1.isInstanceOf[SingletonType] && { rinfo2 match { - case rinfo2: TypeAlias => - !defn.isBottomType(tp1.widen) && (tp1 select name) =:= rinfo2.alias + case rinfo2: TypeBounds => + val mbr1 = tp1.select(name) + !defn.isBottomType(tp1.widen) && + (mbr1 =:= rinfo2.hi || (rinfo2.hi ne rinfo2.lo) && mbr1 =:= rinfo2.lo) case _ => false } } diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala index 69c35faf5..7b8867ccc 100644 --- a/src/dotty/tools/dotc/core/TyperState.scala +++ b/src/dotty/tools/dotc/core/TyperState.scala @@ -59,18 +59,10 @@ class TyperState(r: Reporter) extends DotClass with Showable { /** Commit state so that it gets propagated to enclosing context */ def commit()(implicit ctx: Context): Unit = unsupported("commit") - /** The typer state has already been committed */ - def isCommitted: Boolean = false - - /** Optionally, if this is a mutable typerstate, it's creator state */ - def parent: Option[TyperState] = None - /** The closest ancestor of this typer state (including possibly this typer state itself) * which is not yet committed, or which does not have a parent. */ - def uncommittedAncestor: TyperState = - if (!isCommitted || !parent.isDefined) this - else parent.get.uncommittedAncestor + def uncommittedAncestor: TyperState = this /** Make type variable instances permanent by assigning to `inst` field if * type variable instantiation cannot be retracted anymore. Then, remove @@ -96,7 +88,8 @@ extends TyperState(r) { override def reporter = myReporter - private var myConstraint: Constraint = previous.constraint + private val previousConstraint = previous.constraint + private var myConstraint: Constraint = previousConstraint override def constraint = myConstraint override def constraint_=(c: Constraint)(implicit ctx: Context) = { @@ -109,7 +102,6 @@ extends TyperState(r) { override def ephemeral = myEphemeral override def ephemeral_=(x: Boolean): Unit = { myEphemeral = x } - override def fresh(isCommittable: Boolean): TyperState = new MutableTyperState(this, new StoreReporter(reporter), isCommittable) @@ -120,6 +112,11 @@ extends TyperState(r) { isCommittable && (!previous.isInstanceOf[MutableTyperState] || previous.isGlobalCommittable) + private var isCommitted = false + + override def uncommittedAncestor: TyperState = + if (isCommitted) previous.uncommittedAncestor else this + /** Commit typer state so that its information is copied into current typer state * In addition (1) the owning state of undetermined or temporarily instantiated * type variables changes from this typer state to the current one. (2) Variables @@ -128,25 +125,20 @@ extends TyperState(r) { */ override def commit()(implicit ctx: Context) = { val targetState = ctx.typerState - assert(targetState eq previous) assert(isCommittable) - targetState.constraint = constraint + targetState.constraint = + if (targetState.constraint eq previousConstraint) constraint + else targetState.constraint & constraint constraint foreachTypeVar { tvar => if (tvar.owningState eq this) tvar.owningState = targetState } - targetState.ephemeral = ephemeral + targetState.ephemeral |= ephemeral targetState.gc() reporter.flush() - myIsCommitted = true + isCommitted = true } - private var myIsCommitted = false - - override def isCommitted: Boolean = myIsCommitted - - override def parent = Some(previous) - override def gc()(implicit ctx: Context): Unit = { val toCollect = new mutable.ListBuffer[GenericType] constraint foreachTypeVar { tvar => diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 87d94dcbe..46a63555c 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -927,7 +927,7 @@ object Types { def narrow(implicit ctx: Context): TermRef = TermRef(NoPrefix, ctx.newSkolem(this)) - /** Useful for diagnsotics: The underlying type if this type is a type proxy, + /** Useful for diagnostics: The underlying type if this type is a type proxy, * otherwise NoType */ def underlyingIfProxy(implicit ctx: Context) = this match { @@ -935,6 +935,9 @@ object Types { case _ => NoType } + /** If this is a FunProto or PolyProto, WildcardType, otherwise this. */ + def notApplied: Type = this + // ----- Normalizing typerefs over refined types ---------------------------- /** If this normalizes* to a refinement type that has a refinement for `name` (which might be followed @@ -2532,8 +2535,8 @@ object Types { /** A type for polymorphic methods */ class PolyType(val paramNames: List[TypeName])(paramBoundsExp: GenericType => List[TypeBounds], resultTypeExp: GenericType => Type) extends CachedGroundType with GenericType with MethodOrPoly { - val paramBounds = paramBoundsExp(this) - val resType = resultTypeExp(this) + val paramBounds: List[TypeBounds] = paramBoundsExp(this) + val resType: Type = resultTypeExp(this) def variances = Nil protected def computeSignature(implicit ctx: Context) = resultSignature diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala index 378aa6ed7..a06930058 100644 --- a/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/src/dotty/tools/dotc/parsing/Parsers.scala @@ -1009,9 +1009,23 @@ object Parsers { in.nextToken() expr() } else EmptyTree + + handler match { + case Block(Nil, EmptyTree) => syntaxError( + "`catch` block does not contain a valid expression, try adding a case like - `case e: Exception =>` to the block", + handler.pos + ) + case _ => + } + val finalizer = - if (handler.isEmpty || in.token == FINALLY) { accept(FINALLY); expr() } - else EmptyTree + if (in.token == FINALLY) { accept(FINALLY); expr() } + else { + if (handler.isEmpty) + warning("A try without `catch` or `finally` is equivalent to putting its body in a block; no exceptions are handled.") + + EmptyTree + } ParsedTry(body, handler, finalizer) } case THROW => diff --git a/src/dotty/tools/dotc/transform/InterceptedMethods.scala b/src/dotty/tools/dotc/transform/InterceptedMethods.scala index ffb4ae756..7c60e8d72 100644 --- a/src/dotty/tools/dotc/transform/InterceptedMethods.scala +++ b/src/dotty/tools/dotc/transform/InterceptedMethods.scala @@ -22,7 +22,6 @@ import dotty.tools.dotc.ast.{untpd, tpd} import dotty.tools.dotc.core.Constants.Constant import dotty.tools.dotc.core.Types.MethodType import dotty.tools.dotc.core.Names.Name -import dotty.runtime.LazyVals import scala.collection.mutable.ListBuffer import dotty.tools.dotc.core.Denotations.SingleDenotation import dotty.tools.dotc.core.SymDenotations.SymDenotation diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala index 21b56959b..490feb7d0 100644 --- a/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -37,7 +37,7 @@ import scala.reflect.internal.util.Collections * elimRepeated is required * TODO: outer tests are not generated yet. */ -class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTransformer => +class PatternMatcher extends MiniPhaseTransform with DenotTransformer { import dotty.tools.dotc.ast.tpd._ override def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation = ref @@ -80,7 +80,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans ctx.newSymbol(owner, ctx.freshName(prefix + ctr).toTermName, Flags.Synthetic | Flags.Case, tp, coord = pos) } - def newSynthCaseLabel(name: String, tpe:Type, owner: Symbol = ctx.owner) = + def newSynthCaseLabel(name: String, tpe: Type, owner: Symbol = ctx.owner) = ctx.newSymbol(owner, ctx.freshName(name).toTermName, Flags.Label | Flags.Synthetic | Flags.Method, tpe).asTerm //NoSymbol.newLabel(freshName(name), NoPosition) setFlag treeInfo.SYNTH_CASE_FLAGS @@ -148,30 +148,28 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans } } + object Rebindings { + def apply(from: Symbol, to: Symbol) = new Rebindings(List(from), List(ref(to))) + // requires sameLength(from, to) + def apply(from: List[Symbol], to: List[Tree]) = + if (from nonEmpty) new Rebindings(from, to) else NoRebindings + } - object Rebindings { - def apply(from: Symbol, to: Symbol) = new Rebindings(List(from), List(ref(to))) - // requires sameLength(from, to) - def apply(from: List[Symbol], to: List[Tree]) = - if (from nonEmpty) new Rebindings(from, to) else NoRebindings - } - - class Rebindings(val lhs: List[Symbol], val rhs: List[Tree]) { - def >>(other: Rebindings) = { - if (other eq NoRebindings) this - else if (this eq NoRebindings) other - else { - assert((lhs.toSet ++ other.lhs.toSet).size == lhs.length + other.lhs.length, "no double assignments") - new Rebindings(this.lhs ++ other.lhs, this.rhs ++ other.rhs) - } - } - - def emitValDefs: List[ValDef] = { - Collections.map2(lhs, rhs)((symbol, tree) => ValDef(symbol.asTerm, tree.ensureConforms(symbol.info))) + class Rebindings(val lhs: List[Symbol], val rhs: List[Tree]) { + def >>(other: Rebindings) = { + if (other eq NoRebindings) this + else if (this eq NoRebindings) other + else { + assert((lhs.toSet ++ other.lhs.toSet).size == lhs.length + other.lhs.length, "no double assignments") + new Rebindings(this.lhs ++ other.lhs, this.rhs ++ other.rhs) } } - object NoRebindings extends Rebindings(Nil, Nil) + def emitValDefs: List[ValDef] = { + Collections.map2(lhs, rhs)((symbol, tree) => ValDef(symbol.asTerm, tree.ensureConforms(symbol.info))) + } + } + object NoRebindings extends Rebindings(Nil, Nil) trait OptimizedCodegen extends CodegenCore { override def codegen: AbsCodegen = optimizedCodegen @@ -192,12 +190,13 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans //val matchRes = ctx.newSymbol(NoSymbol, ctx.freshName("matchRes").toTermName, Flags.Synthetic | Flags.Param | Flags.Label | Flags.Method, restpe /*withoutAnnotations*/) //NoSymbol.newValueParameter(newTermName("x"), NoPosition, newFlags = SYNTHETIC) setInfo restpe.withoutAnnotations - val caseSyms = cases.scanLeft(ctx.owner.asTerm)((curOwner, nextTree) => newSynthCaseLabel(ctx.freshName("case"), MethodType(Nil, restpe), curOwner)).tail + + val caseSyms: List[TermSymbol] = cases.scanLeft(ctx.owner.asTerm)((curOwner, nextTree) => newSynthCaseLabel(ctx.freshName("case"), MethodType(Nil, restpe), curOwner)).tail // must compute catchAll after caseLabels (side-effects nextCase) // catchAll.isEmpty iff no synthetic default case needed (the (last) user-defined case is a default) // if the last user-defined case is a default, it will never jump to the next case; it will go immediately to matchEnd - val catchAllDef = matchFailGen.map { _(scrutSym)} + val catchAllDef = matchFailGen.map { _(scrutSym) } .getOrElse(Throw(New(defn.MatchErrorType, List(ref(scrutSym))))) val matchFail = newSynthCaseLabel(ctx.freshName("matchFail"), MethodType(Nil, restpe)) @@ -207,14 +206,13 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans val caseDefs = (cases zip caseSyms zip nextCases).foldRight[Tree](catchAllDefBody) { // dotty deviation //case (((mkCase, sym), nextCase), acc) => - (x:(((Casegen => Tree), TermSymbol), Tree), acc: Tree) => x match { - - case ((mkCase, sym), nextCase) => - val body = mkCase(new OptimizedCasegen(nextCase)).ensureConforms(restpe) - - DefDef(sym, _ => Block(List(acc), body)) - }} + (x: (((Casegen => Tree), TermSymbol), Tree), acc: Tree) => x match { + case ((mkCase, sym), nextCase) => + val body = mkCase(new OptimizedCasegen(nextCase)).ensureConforms(restpe) + DefDef(sym, _ => Block(List(acc), body)) + } + } // scrutSym == NoSymbol when generating an alternatives matcher // val scrutDef = scrutSym.fold(List[Tree]())(ValDef(_, scrut) :: Nil) // for alternatives @@ -255,9 +253,13 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans ) } else { assert(defn.isProductSubType(prev.tpe)) - Block( - List(ValDef(b.asTerm, prev)), - next //Substitution(b, ref(prevSym))(next) + val nullCheck: Tree = prev.select(defn.Object_ne).appliedTo(Literal(Constant(null))) + ifThenElseZero( + nullCheck, + Block( + List(ValDef(b.asTerm, prev)), + next //Substitution(b, ref(prevSym))(next) + ) ) } } @@ -285,7 +287,6 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans next )) } - } } final case class Suppression(exhaustive: Boolean, unreachable: Boolean) @@ -642,7 +643,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans val checkedLength: Option[Int], val prevBinder: Symbol, val ignoredSubPatBinders: Set[Symbol] - ) extends FunTreeMaker with PreserveSubPatBinders { + ) extends FunTreeMaker with PreserveSubPatBinders { def extraStoredBinders: Set[Symbol] = Set() @@ -664,9 +665,8 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans bindSubPats(next) } - if (extractorReturnsBoolean) casegen.flatMapCond(extractor, unitLiteral, nextBinder, condAndNext) - else casegen.flatMap(extractor, nextBinder, condAndNext) // getType? - + if (extractorReturnsBoolean) casegen.flatMapCond(extractor, unitLiteral, nextBinder, condAndNext) + else casegen.flatMap(extractor, nextBinder, condAndNext) // getType? } override def toString = "X" + ((extractor, nextBinder.name)) @@ -700,7 +700,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans val mutableBinders: List[Symbol], binderKnownNonNull: Boolean, val ignoredSubPatBinders: Set[Symbol] - ) extends FunTreeMaker with PreserveSubPatBinders { + ) extends FunTreeMaker with PreserveSubPatBinders { val nextBinder = prevBinder // just passing through @@ -709,6 +709,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans def chainBefore(next: Tree)(casegen: Casegen): Tree = { val nullCheck: Tree = ref(prevBinder).select(defn.Object_ne).appliedTo(Literal(Constant(null))) + val cond: Option[Tree] = if (binderKnownNonNull) extraCond else extraCond.map(nullCheck.select(defn.Boolean_&&).appliedTo).orElse(Some(nullCheck)) @@ -782,9 +783,9 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans val expectedClass = expectedTp.dealias.classSymbol.asClass val test = codegen._asInstanceOf(testedBinder, expectedTp) val outerAccessorTested = ctx.atPhase(ctx.explicitOuterPhase.next) { implicit ctx => - ExplicitOuter.ensureOuterAccessors(expectedClass) - test.select(ExplicitOuter.outerAccessor(expectedClass)).select(defn.Object_eq).appliedTo(expectedOuter) - } + ExplicitOuter.ensureOuterAccessors(expectedClass) + test.select(ExplicitOuter.outerAccessor(expectedClass)).select(defn.Object_eq).appliedTo(expectedOuter) + } outerAccessorTested } } @@ -848,7 +849,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans val nextBinder = afterTest.asTerm - def needsOuterTest(patType: Type, selType: Type, currentOwner: Symbol) = { + def needsOuterTest(patType: Type, selType: Type, currentOwner: Symbol): Boolean = { // See the test for SI-7214 for motivation for dealias. Later `treeCondStrategy#outerTest` // generates an outer test based on `patType.prefix` with automatically dealises. patType.dealias match { @@ -866,7 +867,6 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans val np = expectedTp.normalizedPrefix val ts = np.termSymbol (ts ne NoSymbol) && needsOuterTest(expectedTp, testedBinder.info, ctx.owner) - } // the logic to generate the run-time test that follows from the fact that @@ -906,7 +906,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans if (isExpectedReferenceType) mkNullTest else mkTypeTest ) - ) + ) // true when called to type-test the argument to an extractor // don't do any fancy equality checking, just test the type @@ -920,7 +920,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans and(mkEqualsTest(ref(tref.symbol.companionModule)), mkTypeTest) // must use == to support e.g. List() == Nil case ConstantType(Constant(null)) if isAnyRef => mkEqTest(expTp(Literal(Constant(null)))) case ConstantType(const) => mkEqualsTest(expTp(Literal(const))) - case t:SingletonType => mkEqTest(singleton(expectedTp)) // SI-4577, SI-4897 + case t: SingletonType => mkEqTest(singleton(expectedTp)) // SI-4577, SI-4897 //case ThisType(sym) => mkEqTest(expTp(This(sym))) case _ => mkDefault } @@ -1050,7 +1050,6 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans val (cases, toHoist) = optimizeCases(scrutSym, casesRebindingPropagated, pt) - val matchRes = codegen.matcher(scrut, scrutSym, pt)(cases.map(x => combineExtractors(x) _), synthCatchAll) if (toHoist isEmpty) matchRes else Block(toHoist, matchRes) @@ -1092,7 +1091,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans def unapply(pat: Tree): Boolean = pat match { case Typed(_, arg) if arg.tpe.isRepeatedParam => true case Bind(nme.WILDCARD, WildcardPattern()) => true // don't skip when binding an interesting symbol! - case t if (tpd.isWildcardArg(t)) => true + case t if (tpd.isWildcardArg(t)) => true case x: Ident => isVarPattern(x) case Alternative(ps) => ps forall unapply case EmptyTree => true @@ -1113,7 +1112,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans object SymbolBound { def unapply(tree: Tree): Option[(Symbol, Tree)] = tree match { case Bind(_, expr) if tree.symbol.exists => Some(tree.symbol -> expr) - case _ => None + case _ => None } } @@ -1126,13 +1125,13 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans final case class BoundTree(binder: Symbol, tree: Tree) { private lazy val extractor = ExtractorCall(tree, binder) - def pos = tree.pos - def tpe = binder.info.widenDealias - def pt = unbound match { - // case Star(tpt) => this glbWith seqType(tpt.tpe) dd todo: - case TypeBound(tpe) => tpe - case tree => tree.tpe - } + def pos = tree.pos + def tpe = binder.info.widenDealias + def pt = unbound match { + // case Star(tpt) => this glbWith seqType(tpt.tpe) dd todo: + case TypeBound(tpe) => tpe + case tree => tree.tpe + } def glbWith(other: Type) = ctx.typeComparer.glb(tpe :: other :: Nil)// .normalize @@ -1200,7 +1199,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans // Statically conforms to paramType if (tpe <:< paramType) treeMaker(binder, false, pos, tpe) :: Nil else typeTest :: extraction :: Nil - ) + ) step(makers: _*)(extractor.subBoundTrees: _*) } @@ -1219,7 +1218,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans // [7] symbol-less bind patterns - this happens in certain ill-formed programs, there'll be an error later // don't fail here though (or should we?) def nextStep(): TranslationStep = tree match { - case _: UnApply | _: Apply| Typed(_: UnApply | _: Apply, _) => extractorStep() + case _: UnApply | _: Apply | Typed(_: UnApply | _: Apply, _) => extractorStep() case SymbolAndTypeBound(sym, tpe) => typeTestStep(sym, tpe) case TypeBound(tpe) => typeTestStep(binder, tpe) case SymbolBound(sym, expr) => bindingStep(sym, expr) @@ -1230,7 +1229,6 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans } def translate(): List[TreeMaker] = nextStep() merge (_.translate()) - private def concreteType = tpe.bounds.hi private def unbound = unbind(tree) private def tpe_s = if (pt <:< concreteType) "" + pt else s"$pt (binder: $tpe)" @@ -1260,7 +1258,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans * * NOTE: the resulting tree is not type checked, nor are nested pattern matches transformed * thus, you must typecheck the result (and that will in turn translate nested matches) - * this could probably optimized... (but note that the matchStrategy must be solved for each nested patternmatch) + * this could probably be optimized... (but note that the matchStrategy must be solved for each nested patternmatch) */ def translateMatch(match_ : Match): Tree = { val Match(sel, cases) = match_ @@ -1271,7 +1269,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans val (nonSyntheticCases, defaultOverride) = cases match { case init :+ last if isSyntheticDefaultCase(last) => (init, Some(((scrut: Symbol) => last.body))) - case _ => (cases, None) + case _ => (cases, None) } @@ -1331,7 +1329,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans * a function that will take care of binding and substitution of the next ast (to the right). * */ - def translateCase(scrutSym: Symbol, pt: Type)(caseDef: CaseDef) = { + def translateCase(scrutSym: Symbol, pt: Type)(caseDef: CaseDef): List[TreeMaker] = { val CaseDef(pattern, guard, body) = caseDef translatePattern(BoundTree(scrutSym, pattern)) ++ translateGuard(guard) :+ translateBody(body, pt) } @@ -1400,7 +1398,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans object ExtractorCall { // TODO: check unargs == args - def apply(tree: Tree, binder: Symbol): ExtractorCall = { + def apply(tree: Tree, binder: Symbol): ExtractorCall = { tree match { case UnApply(unfun, implicits, args) => val castedBinder = ref(binder).ensureConforms(tree.tpe) @@ -1479,8 +1477,8 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans productSelectors(binder.info) else binder.caseAccessors val res = - if (accessors.isDefinedAt(i - 1)) ref(binder).select(accessors(i - 1).name) - else codegen.tupleSel(binder)(i) // this won't type check for case classes, as they do not inherit ProductN + if (accessors.isDefinedAt(i - 1)) ref(binder).select(accessors(i - 1).name) + else codegen.tupleSel(binder)(i) // this won't type check for case classes, as they do not inherit ProductN val rsym = res.symbol // just for debugging res } @@ -1492,7 +1490,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans if (!aligner.isStar) Nil else if (expectedLength == 0) seqTree(binder) :: Nil else genDrop(binder, expectedLength) - ) + ) // this error-condition has already been checked by checkStarPatOK: // if (isSeq) assert(firstIndexingBinder + nbIndexingIndices + (if (lastIsStar) 1 else 0) == totalArity, "(resultInMonad, ts, subPatTypes, subPats)= " +(resultInMonad, ts, subPatTypes, subPats)) @@ -1503,7 +1501,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans ( productElemsToN(binder, firstIndexingBinder) ++ genTake(binder, expectedLength) ++ lastTrees - ).toList + ).toList } // the trees that select the subpatterns on the extractor's result, referenced by `binder` @@ -1511,7 +1509,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans protected def subPatRefs(binder: Symbol): List[Tree] = { val refs = if (totalArity > 0 && isSeq) subPatRefsSeq(binder) else if (binder.info.member(nme._1).exists && !isSeq) productElemsToN(binder, totalArity) - else ref(binder):: Nil + else ref(binder) :: Nil refs } @@ -1601,7 +1599,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans // can't simplify this when subPatBinders.isEmpty, since UnitTpe is definitely // wrong when isSeq, and resultInMonad should always be correct since it comes // directly from the extractor's result type - val binder = freshSym(pos, resultInMonad) + val binder = freshSym(pos, resultInMonad) val spb = subPatBinders ExtractorTreeMaker(extractorApply, lengthGuard(binder), binder)( spb, @@ -1819,6 +1817,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans def expectedTypes = typedPatterns map (_.tpe) def unexpandedFormals = extractor.varargsTypes } + trait ScalacPatternExpander extends PatternExpander[Tree, Type] { def NoPattern = EmptyTree def NoType = core.Types.NoType @@ -1836,7 +1835,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans ( typeOfMemberNamedHead(seq) orElse typeOfMemberNamedApply(seq) orElse seq.elemType - ) + ) } def newExtractor(whole: Type, fixed: List[Type], repeated: Repeated): Extractor = { ctx.log(s"newExtractor($whole, $fixed, $repeated") @@ -1863,7 +1862,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans method.paramTypess.head match { case init :+ last if last.isRepeatedParam => newExtractor(whole, init, repeatedFromVarargs(last)) - case tps => newExtractor(whole, tps, NoRepeated) + case tps => newExtractor(whole, tps, NoRepeated) } } @@ -1874,15 +1873,14 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans * Unfortunately the MethodType does not carry the information of whether * it was unapplySeq, so we have to funnel that information in separately. */ - def unapplyMethodTypes(tree:Tree, fun: Tree, args:List[Tree], resultType:Type, isSeq: Boolean): Extractor = { + def unapplyMethodTypes(tree: Tree, fun: Tree, args: List[Tree], resultType: Type, isSeq: Boolean): Extractor = { _id = _id + 1 - val whole = tree.tpe// see scaladoc for Trees.Unapply + val whole = tree.tpe // see scaladoc for Trees.Unapply // fun.tpe.widen.paramTypess.headOption.flatMap(_.headOption).getOrElse(NoType)//firstParamType(method) val resultOfGet = extractorMemberType(resultType, nme.get) - //println(s"${_id}unapplyArgs(${result.widen}") - val expanded:List[Type] = /*( + val expanded: List[Type] = /*( if (result =:= defn.BooleanType) Nil else if (defn.isProductSubType(result)) productSelectorTypes(result) else if (result.classSymbol is Flags.CaseClass) result.decls.filter(x => x.is(Flags.CaseAccessor) && x.is(Flags.Method)).map(_.info).toList @@ -1917,7 +1915,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans def offering = extractor.offeringString def symString = tree.symbol.showLocated def offerString = if (extractor.isErroneous) "" else s" offering $offering" - def arityExpected = ( if (extractor.hasSeq) "at least " else "" ) + prodArity + def arityExpected = (if (extractor.hasSeq) "at least " else "") + prodArity def err(msg: String) = ctx.error(msg, tree.pos) def warn(msg: String) = ctx.warning(msg, tree.pos) @@ -1944,10 +1942,10 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans } } - def apply(tree:Tree, sel: Tree, args: List[Tree], resultType: Type): Aligned = { + def apply(tree: Tree, sel: Tree, args: List[Tree], resultType: Type): Aligned = { val fn = sel match { case Applied(fn) => fn - case _ => sel + case _ => sel } val patterns = newPatterns(args) val isSeq = sel.symbol.name == nme.unapplySeq @@ -1977,8 +1975,8 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans } def apply(tree: Tree, resultType: Type): Aligned = tree match { - case Typed(tree, _) => apply(tree, resultType) - case Apply(fn, args) => apply(tree, fn, args, resultType) + case Typed(tree, _) => apply(tree, resultType) + case Apply(fn, args) => apply(tree, fn, args, resultType) case UnApply(fn, implicits, args) => apply(tree, fn, args, resultType) } } diff --git a/src/dotty/tools/dotc/transform/PostTyper.scala b/src/dotty/tools/dotc/transform/PostTyper.scala index fd22a0ad9..e74709282 100644 --- a/src/dotty/tools/dotc/transform/PostTyper.scala +++ b/src/dotty/tools/dotc/transform/PostTyper.scala @@ -93,7 +93,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran * * should behave differently. * - * O1.x should have the same effect as { println("43"; 42 } + * O1.x should have the same effect as { println("43"); 42 } * * whereas * @@ -103,10 +103,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran * purity of the prefix unless the selection goes to an inline val. */ private def normalizeTree(tree: Tree)(implicit ctx: Context): Tree = tree match { - case tree: TypeTree => tree - case TypeApply(fn, args) => - Checking.checkBounds(args, fn.tpe.widen.asInstanceOf[PolyType]) - tree + case _: TypeTree | _: TypeApply => tree case _ => if (tree.isType) { Checking.typeChecker.traverse(tree) diff --git a/src/dotty/tools/dotc/transform/TailRec.scala b/src/dotty/tools/dotc/transform/TailRec.scala index efa0633d8..b345dda61 100644 --- a/src/dotty/tools/dotc/transform/TailRec.scala +++ b/src/dotty/tools/dotc/transform/TailRec.scala @@ -338,14 +338,16 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete assert(false, "We should never have gotten inside a pattern") tree + case t @ DefDef(_, _, _, _, _) => + t // todo: could improve to handle DefDef's with a label flag calls to which are in tail position + case ValDef(_, _, _) | EmptyTree | Super(_, _) | This(_) | - Literal(_) | TypeTree(_) | DefDef(_, _, _, _, _) | TypeDef(_, _) => + Literal(_) | TypeTree(_) | TypeDef(_, _) => tree case Return(expr, from) => tpd.cpy.Return(tree)(noTailTransform(expr), from) - case t: DefDef => - t // todo: could improve to handle DefDef's with a label flag calls to which are in tail position + case _ => super.transform(tree) } diff --git a/src/dotty/tools/dotc/transform/TreeChecker.scala b/src/dotty/tools/dotc/transform/TreeChecker.scala index ce160d7b0..18e3a6c8a 100644 --- a/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -258,7 +258,7 @@ class TreeChecker extends Phase with SymTransformer { } override def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): tpd.Tree = { - val tpdTree = super.typed(tree) + val tpdTree = super.typed(tree, pt) checkIdentNotJavaClass(tpdTree) tpdTree } diff --git a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala index 6de2bf44c..3774127fa 100644 --- a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala +++ b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala @@ -100,7 +100,7 @@ trait TypeTestsCasts { * The transform happens before erasure of `argType`, thus cannot be merged * with `transformIsInstanceOf`, which depends on erased type of `argType`. */ - def transformOrTypeTest(qual: Tree, argType: Type): Tree = argType match { + def transformOrTypeTest(qual: Tree, argType: Type): Tree = argType.dealias match { case OrType(tp1, tp2) => evalOnce(qual) { fun => transformOrTypeTest(fun, tp1) diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 45ed4d938..20850e21d 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -31,7 +31,7 @@ import language.implicitConversions object Applications { import tpd._ - def extractorMemberType(tp: Type, name: Name, errorPos: Position = NoPosition)(implicit ctx:Context) = { + def extractorMemberType(tp: Type, name: Name, errorPos: Position = NoPosition)(implicit ctx: Context) = { val ref = tp.member(name).suchThat(_.info.isParameterless) if (ref.isOverloaded) errorType(i"Overloaded reference to $ref is not allowed in extractor", errorPos) @@ -41,12 +41,12 @@ object Applications { ref.info.widenExpr.dealias } - def productSelectorTypes(tp: Type, errorPos: Position = NoPosition)(implicit ctx:Context): List[Type] = { + def productSelectorTypes(tp: Type, errorPos: Position = NoPosition)(implicit ctx: Context): List[Type] = { val sels = for (n <- Iterator.from(0)) yield extractorMemberType(tp, nme.selectorName(n), errorPos) sels.takeWhile(_.exists).toList } - def productSelectors(tp: Type)(implicit ctx:Context): List[Symbol] = { + def productSelectors(tp: Type)(implicit ctx: Context): List[Symbol] = { val sels = for (n <- Iterator.from(0)) yield tp.member(nme.selectorName(n)).symbol sels.takeWhile(_.exists).toList } @@ -58,7 +58,7 @@ object Applications { else tp :: Nil } else tp :: Nil - def unapplyArgs(unapplyResult: Type, unapplyFn:Tree, args:List[untpd.Tree], pos: Position = NoPosition)(implicit ctx: Context): List[Type] = { + def unapplyArgs(unapplyResult: Type, unapplyFn: Tree, args: List[untpd.Tree], pos: Position = NoPosition)(implicit ctx: Context): List[Type] = { def seqSelector = defn.RepeatedParamType.appliedTo(unapplyResult.elemType :: Nil) def getTp = extractorMemberType(unapplyResult, nme.get, pos) @@ -591,13 +591,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic => fun1.tpe match { case ErrorType => tree.withType(ErrorType) - case TryDynamicCallType => - tree match { - case tree @ Apply(Select(qual, name), args) if !isDynamicMethod(name) => - typedDynamicApply(qual, name, args, pt)(tree) - case _ => - handleUnexpectedFunType(tree, fun1) - } + case TryDynamicCallType => typedDynamicApply(tree, pt) case _ => tryEither { implicit ctx => simpleApply(fun1, proto) @@ -658,7 +652,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic => /** Overridden in ReTyper to handle primitive operations that can be generated after erasure */ protected def handleUnexpectedFunType(tree: untpd.Apply, fun: Tree)(implicit ctx: Context): Tree = - throw new Error(s"unexpected type.\n fun = $fun,\n methPart(fun) = ${methPart(fun)},\n methPart(fun).tpe = ${methPart(fun).tpe},\n tpe = ${fun.tpe}") + throw new Error(i"unexpected type.\n fun = $fun,\n methPart(fun) = ${methPart(fun)},\n methPart(fun).tpe = ${methPart(fun).tpe},\n tpe = ${fun.tpe}") def typedNamedArgs(args: List[untpd.Tree])(implicit ctx: Context) = for (arg @ NamedArg(id, argtpt) <- args) yield { @@ -679,7 +673,12 @@ trait Applications extends Compatibility { self: Typer with Dynamic => } case _ => } - assignType(cpy.TypeApply(tree)(typedFn, typedArgs), typedFn, typedArgs) + def tryDynamicTypeApply(): Tree = typedFn match { + case typedFn: Select if !pt.isInstanceOf[FunProto] => typedDynamicSelect(typedFn, typedArgs, pt) + case _ => tree.withType(TryDynamicCallType) + } + if (typedFn.tpe eq TryDynamicCallType) tryDynamicTypeApply() + else assignType(cpy.TypeApply(tree)(typedFn, typedArgs), typedFn, typedArgs) } /** Rewrite `new Array[T](....)` if T is an unbounded generic to calls to newGenericArray. @@ -775,14 +774,13 @@ trait Applications extends Compatibility { self: Typer with Dynamic => * The generalizations of a type T are the smallest set G such that * * - T is in G - * - If a typeref R in G represents a trait, R's superclass is in G. + * - If a typeref R in G represents a class or trait, R's superclass is in G. * - If a type proxy P is not a reference to a class, P's supertype is in G */ def isSubTypeOfParent(subtp: Type, tp: Type)(implicit ctx: Context): Boolean = if (subtp <:< tp) true else tp match { - case tp: TypeRef if tp.symbol.isClass => - tp.symbol.is(Trait) && isSubTypeOfParent(subtp, tp.firstParent) + case tp: TypeRef if tp.symbol.isClass => isSubTypeOfParent(subtp, tp.firstParent) case tp: TypeProxy => isSubTypeOfParent(subtp, tp.superType) case _ => false } diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index d77520c77..101974b32 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -37,7 +37,7 @@ object Checking { * well as for AppliedTypeTree nodes. Also checks that type arguments to * *-type parameters are fully applied. */ - def checkBounds(args: List[tpd.Tree], boundss: List[TypeBounds], instantiate: (Type, List[Type]) => Type)(implicit ctx: Context) = { + def checkBounds(args: List[tpd.Tree], boundss: List[TypeBounds], instantiate: (Type, List[Type]) => Type)(implicit ctx: Context): Unit = { (args, boundss).zipped.foreach { (arg, bound) => if (!bound.isHK && arg.tpe.isHK) ctx.error(ex"missing type parameter(s) for $arg", arg.pos) diff --git a/src/dotty/tools/dotc/typer/Dynamic.scala b/src/dotty/tools/dotc/typer/Dynamic.scala index aeb3cca8c..b5ace87d3 100644 --- a/src/dotty/tools/dotc/typer/Dynamic.scala +++ b/src/dotty/tools/dotc/typer/Dynamic.scala @@ -2,15 +2,14 @@ package dotty.tools package dotc package typer -import dotty.tools.dotc.ast.Trees.NamedArg -import dotty.tools.dotc.ast.tpd._ +import dotty.tools.dotc.ast.Trees._ +import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.ast.untpd import dotty.tools.dotc.core.Constants.Constant import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.Names.Name import dotty.tools.dotc.core.StdNames._ import dotty.tools.dotc.core.Types._ -import dotty.tools.dotc.core.Mode import dotty.tools.dotc.core.Decorators._ object Dynamic { @@ -28,44 +27,78 @@ object Dynamic { * The first matching rule of is applied. */ trait Dynamic { self: Typer with Applications => + import Dynamic._ + import tpd._ /** Translate selection that does not typecheck according to the normal rules into a applyDynamic/applyDynamicNamed. - * foo.bar(baz0, baz1, ...) ~~> foo.applyDynamic(bar)(baz0, baz1, ...) - * foo.bar(x = bazX, y = bazY, baz, ...) ~~> foo.applyDynamicNamed("bar")(("x", bazX), ("y", bazY), ("", baz), ...) + * foo.bar(baz0, baz1, ...) ~~> foo.applyDynamic(bar)(baz0, baz1, ...) + * foo.bar[T0, ...](baz0, baz1, ...) ~~> foo.applyDynamic[T0, ...](bar)(baz0, baz1, ...) + * foo.bar(x = bazX, y = bazY, baz, ...) ~~> foo.applyDynamicNamed("bar")(("x", bazX), ("y", bazY), ("", baz), ...) + * foo.bar[T0, ...](x = bazX, y = bazY, baz, ...) ~~> foo.applyDynamicNamed[T0, ...]("bar")(("x", bazX), ("y", bazY), ("", baz), ...) */ - def typedDynamicApply(qual: untpd.Tree, name: Name, args: List[untpd.Tree], pt: Type)(original: untpd.Apply)( - implicit ctx: Context): Tree = { - def isNamedArg(arg: untpd.Tree): Boolean = arg match { case NamedArg(_, _) => true; case _ => false } - val dynName = if (args.exists(isNamedArg)) nme.applyDynamicNamed else nme.applyDynamic - if (dynName == nme.applyDynamicNamed && untpd.isWildcardStarArgList(args)) { - ctx.error("applyDynamicNamed does not support passing a vararg parameter", original.pos) - original.withType(ErrorType) - } else { - def namedArgTuple(name: String, arg: untpd.Tree) = untpd.Tuple(List(Literal(Constant(name)), arg)) - def namedArgs = args.map { - case NamedArg(argName, arg) => namedArgTuple(argName.toString, arg) - case arg => namedArgTuple("", arg) + def typedDynamicApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = { + def typedDynamicApply(qual: untpd.Tree, name: Name, targs: List[untpd.Tree]): Tree = { + def isNamedArg(arg: untpd.Tree): Boolean = arg match { case NamedArg(_, _) => true; case _ => false } + val args = tree.args + val dynName = if (args.exists(isNamedArg)) nme.applyDynamicNamed else nme.applyDynamic + if (dynName == nme.applyDynamicNamed && untpd.isWildcardStarArgList(args)) { + ctx.error("applyDynamicNamed does not support passing a vararg parameter", tree.pos) + tree.withType(ErrorType) + } else { + def namedArgTuple(name: String, arg: untpd.Tree) = untpd.Tuple(List(Literal(Constant(name)), arg)) + def namedArgs = args.map { + case NamedArg(argName, arg) => namedArgTuple(argName.toString, arg) + case arg => namedArgTuple("", arg) + } + val args1 = if (dynName == nme.applyDynamic) args else namedArgs + typedApply(untpd.Apply(coreDynamic(qual, dynName, name, targs), args1), pt) } - val args1 = if (dynName == nme.applyDynamic) args else namedArgs - typedApply(untpd.Apply(coreDynamic(qual, dynName, name), args1), pt) + } + + tree.fun match { + case Select(qual, name) if !isDynamicMethod(name) => + typedDynamicApply(qual, name, Nil) + case TypeApply(Select(qual, name), targs) if !isDynamicMethod(name) => + typedDynamicApply(qual, name, targs) + case TypeApply(fun, targs) => + typedDynamicApply(fun, nme.apply, targs) + case fun => + typedDynamicApply(fun, nme.apply, Nil) } } /** Translate selection that does not typecheck according to the normal rules into a selectDynamic. - * foo.bar ~~> foo.selectDynamic(bar) + * foo.bar ~~> foo.selectDynamic(bar) + * foo.bar[T0, ...] ~~> foo.selectDynamic[T0, ...](bar) * * Note: inner part of translation foo.bar(baz) = quux ~~> foo.selectDynamic(bar).update(baz, quux) is achieved * through an existing transformation of in typedAssign [foo.bar(baz) = quux ~~> foo.bar.update(baz, quux)]. */ - def typedDynamicSelect(tree: untpd.Select, pt: Type)(implicit ctx: Context): Tree = - typedApply(coreDynamic(tree.qualifier, nme.selectDynamic, tree.name), pt) + def typedDynamicSelect(tree: untpd.Select, targs: List[Tree], pt: Type)(implicit ctx: Context): Tree = + typedApply(coreDynamic(tree.qualifier, nme.selectDynamic, tree.name, targs), pt) /** Translate selection that does not typecheck according to the normal rules into a updateDynamic. * foo.bar = baz ~~> foo.updateDynamic(bar)(baz) */ - def typedDynamicAssign(qual: untpd.Tree, name: Name, rhs: untpd.Tree, pt: Type)(implicit ctx: Context): Tree = - typedApply(untpd.Apply(coreDynamic(qual, nme.updateDynamic, name), rhs), pt) + def typedDynamicAssign(tree: untpd.Assign, pt: Type)(implicit ctx: Context): Tree = { + def typedDynamicAssign(qual: untpd.Tree, name: Name, targs: List[untpd.Tree]): Tree = + typedApply(untpd.Apply(coreDynamic(qual, nme.updateDynamic, name, targs), tree.rhs), pt) + tree.lhs match { + case Select(qual, name) if !isDynamicMethod(name) => + typedDynamicAssign(qual, name, Nil) + case TypeApply(Select(qual, name), targs) if !isDynamicMethod(name) => + typedDynamicAssign(qual, name, targs) + case _ => + ctx.error("reassignment to val", tree.pos) + tree.withType(ErrorType) + } + } - private def coreDynamic(qual: untpd.Tree, dynName: Name, name: Name)(implicit ctx: Context): untpd.Apply = - untpd.Apply(untpd.Select(qual, dynName), Literal(Constant(name.toString))) + private def coreDynamic(qual: untpd.Tree, dynName: Name, name: Name, targs: List[untpd.Tree])(implicit ctx: Context): untpd.Apply = { + val select = untpd.Select(qual, dynName) + val selectWithTypes = + if (targs.isEmpty) select + else untpd.TypeApply(select, targs) + untpd.Apply(selectWithTypes, Literal(Constant(name.toString))) + } } diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index 0a3307140..2a1c18f7d 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -801,14 +801,15 @@ class SearchHistory(val searchDepth: Int, val seen: Map[ClassSymbol, Int]) { def updateMap(csyms: List[ClassSymbol], seen: Map[ClassSymbol, Int]): SearchHistory = csyms match { case csym :: csyms1 => seen get csym match { + // proto complexity is >= than the last time it was seen → diverge case Some(prevSize) if size >= prevSize => this case _ => updateMap(csyms1, seen.updated(csym, size)) } - case nil => - if (csyms.isEmpty) this - else new SearchHistory(searchDepth + 1, seen) + case _ => + new SearchHistory(searchDepth + 1, seen) } - updateMap(proto.classSymbols, seen) + if (proto.classSymbols.isEmpty) this + else updateMap(proto.classSymbols, seen) } } } diff --git a/src/dotty/tools/dotc/typer/ImportInfo.scala b/src/dotty/tools/dotc/typer/ImportInfo.scala index 2ca90311f..2105d9ccc 100644 --- a/src/dotty/tools/dotc/typer/ImportInfo.scala +++ b/src/dotty/tools/dotc/typer/ImportInfo.scala @@ -64,6 +64,7 @@ class ImportInfo(symf: => Symbol, val selectors: List[untpd.Tree], val isRootImp myExcluded += name case Pair(Ident(from: TermName), Ident(to: TermName)) => myMapped = myMapped.updated(to, from) + myExcluded += from myOriginals += from case Ident(nme.WILDCARD) => myWildcardImport = true diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 7c61f8c23..719e8d7fc 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -78,7 +78,8 @@ object Inferencing { def apply(x: Boolean, tp: Type): Boolean = tp.dealias match { case _: WildcardType | _: ProtoType => false - case tvar: TypeVar if !tvar.isInstantiated => + case tvar: TypeVar + if !tvar.isInstantiated && ctx.typerState.constraint.contains(tvar) => force.appliesTo(tvar) && { val direction = instDirection(tvar.origin) if (direction != 0) { diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 3c0a45e94..d90f37860 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -726,7 +726,7 @@ class Namer { typer: Typer => // the parent types are elaborated. index(constr) symbolOfTree(constr).ensureCompleted() - + index(rest)(inClassContext(selfInfo)) val tparamAccessors = decls.filter(_ is TypeParamAccessor).toList @@ -807,20 +807,27 @@ class Namer { typer: Typer => lazy val schema = paramFn(WildcardType) val site = sym.owner.thisType ((NoType: Type) /: sym.owner.info.baseClasses.tail) { (tp, cls) => - val iRawInfo = - cls.info.nonPrivateDecl(sym.name).matchingDenotation(site, schema).info - val iInstInfo = iRawInfo match { - case iRawInfo: PolyType => - if (iRawInfo.paramNames.length == typeParams.length) - iRawInfo.instantiate(typeParams map (_.typeRef)) + def instantiatedResType(info: Type, tparams: List[Symbol], paramss: List[List[Symbol]]): Type = info match { + case info: PolyType => + if (info.paramNames.length == typeParams.length) + instantiatedResType(info.instantiate(tparams.map(_.typeRef)), Nil, paramss) else NoType + case info: MethodType => + paramss match { + case params :: paramss1 if info.paramNames.length == params.length => + instantiatedResType(info.instantiate(params.map(_.termRef)), tparams, paramss1) + case _ => + NoType + } case _ => - if (typeParams.isEmpty) iRawInfo + if (tparams.isEmpty && paramss.isEmpty) info.widenExpr else NoType } - val iResType = iInstInfo.finalResultType.asSeenFrom(site, cls) + val iRawInfo = + cls.info.nonPrivateDecl(sym.name).matchingDenotation(site, schema).info + val iResType = instantiatedResType(iRawInfo, typeParams, paramss).asSeenFrom(site, cls) if (iResType.exists) - typr.println(i"using inherited type for ${mdef.name}; raw: $iRawInfo, inst: $iInstInfo, inherited: $iResType") + typr.println(i"using inherited type for ${mdef.name}; raw: $iRawInfo, inherited: $iResType") tp & iResType } } diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala index f209c99be..41628f0dc 100644 --- a/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -182,6 +182,8 @@ object ProtoTypes { if ((args eq this.args) && (resultType eq this.resultType) && (typer eq this.typer)) this else new FunProto(args, resultType, typer) + override def notApplied = WildcardType + /** Forget the types of any arguments that have been typed producing a constraint in a * typer state that is not yet committed into the one of the current context `ctx`. * This is necessary to avoid "orphan" PolyParams that are referred to from @@ -319,6 +321,8 @@ object ProtoTypes { if ((targs eq this.targs) && (resType eq this.resType)) this else PolyProto(targs, resType) + override def notApplied = WildcardType + def map(tm: TypeMap)(implicit ctx: Context): PolyProto = derivedPolyProto(targs mapConserve tm, tm(resultType)) diff --git a/src/dotty/tools/dotc/typer/RefChecks.scala b/src/dotty/tools/dotc/typer/RefChecks.scala index 2838866fd..1f150c519 100644 --- a/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/src/dotty/tools/dotc/typer/RefChecks.scala @@ -525,7 +525,7 @@ object RefChecks { subclassMsg(concreteSym, abstractSym) else "" - undefined(s"\n(Note that $pa does not match $pc$addendum)") + undefined(s"\n(Note that ${pa.show} does not match ${pc.show}$addendum)") case xs => undefined(s"\n(The class implements a member with a different type: ${concrete.showDcl})") } diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index 36404a68f..e1c9850d9 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -168,7 +168,9 @@ trait TypeAssigner { val d2 = pre.nonPrivateMember(name) if (reallyExists(d2) && firstTry) test(tpe.shadowed.withDenot(d2), false) - else { + else if (pre.derivesFrom(defn.DynamicClass)) { + TryDynamicCallType + } else { val alts = tpe.denot.alternatives.map(_.symbol).filter(_.exists) val what = alts match { case Nil => @@ -321,21 +323,30 @@ trait TypeAssigner { case pt: PolyType => val paramNames = pt.paramNames if (hasNamedArg(args)) { - val argMap = new mutable.HashMap[Name, Type] + // Type arguments which are specified by name (immutable after this first loop) + val namedArgMap = new mutable.HashMap[Name, Type] for (NamedArg(name, arg) <- args) - if (argMap.contains(name)) + if (namedArgMap.contains(name)) ctx.error("duplicate name", arg.pos) else if (!paramNames.contains(name)) ctx.error(s"undefined parameter name, required: ${paramNames.mkString(" or ")}", arg.pos) else - argMap(name) = arg.tpe + namedArgMap(name) = arg.tpe + + // Holds indexes of non-named typed arguments in paramNames val gapBuf = new mutable.ListBuffer[Int] - def nextPoly = { - val idx = gapBuf.length + def nextPoly(idx: Int) = { + val newIndex = gapBuf.length gapBuf += idx - PolyParam(pt, idx) + // Re-index unassigned type arguments that remain after transformation + PolyParam(pt, newIndex) } - val normArgs = paramNames.map(pname => argMap.getOrElse(pname, nextPoly)) + + // Type parameters after naming assignment, conserving paramNames order + val normArgs: List[Type] = paramNames.zipWithIndex.map { case (pname, idx) => + namedArgMap.getOrElse(pname, nextPoly(idx)) + } + val transform = new TypeMap { def apply(t: Type) = t match { case PolyParam(`pt`, idx) => normArgs(idx) @@ -347,19 +358,20 @@ trait TypeAssigner { else { val gaps = gapBuf.toList pt.derivedPolyType( - gaps.map(paramNames.filterNot(argMap.contains)), + gaps.map(paramNames), gaps.map(idx => transform(pt.paramBounds(idx)).bounds), resultType1) } } else { val argTypes = args.tpes - if (sameLength(argTypes, paramNames)|| ctx.phase.prev.relaxedTyping) pt.instantiate(argTypes) + if (sameLength(argTypes, paramNames) || ctx.phase.prev.relaxedTyping) pt.instantiate(argTypes) else wrongNumberOfArgs(fn.tpe, "type ", pt.paramNames.length, tree.pos) } case _ => errorType(i"${err.exprStr(fn)} does not take type parameters", tree.pos) } + tree.withType(ownType) } @@ -383,8 +395,8 @@ trait TypeAssigner { def assignType(tree: untpd.Closure, meth: Tree, target: Tree)(implicit ctx: Context) = tree.withType( - if (target.isEmpty) meth.tpe.widen.toFunctionType(tree.env.length) - else target.tpe) + if (target.isEmpty) meth.tpe.widen.toFunctionType(tree.env.length) + else target.tpe) def assignType(tree: untpd.CaseDef, body: Tree)(implicit ctx: Context) = tree.withType(body.tpe) diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 7eb022b51..6041e7732 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -72,6 +72,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit */ private var importedFromRoot: Set[Symbol] = Set() + /** Temporary data item for single call to typed ident: + * This symbol would be found under Scala2 mode, but is not + * in dotty (because dotty conforms to spec section 2 + * wrt to package member resolution but scalac doe not). + */ + private var foundUnderScala2: Type = NoType + def newLikeThis: Typer = new Typer /** Attribute an identifier consisting of a simple name or wildcard @@ -133,14 +140,20 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit * imported by <tree> * or defined in <symbol> */ - def bindingString(prec: Int, whereFound: Context, qualifier: String = "") = + def bindingString(prec: Int, whereFound: Context, qualifier: String = "")(implicit ctx: Context) = if (prec == wildImport || prec == namedImport) ex"imported$qualifier by ${whereFound.importInfo}" else ex"defined$qualifier in ${whereFound.owner}" /** Check that any previously found result from an inner context * does properly shadow the new one from an outer context. + * @param found The newly found result + * @param newPrec Its precedence + * @param scala2pkg Special mode where we check members of the same package, but defined + * in different compilation units under Scala2. If set, and the + * previous and new contexts do not have the same scope, we select + * the previous (inner) definition. This models what scalac does. */ - def checkNewOrShadowed(found: Type, newPrec: Int): Type = + def checkNewOrShadowed(found: Type, newPrec: Int, scala2pkg: Boolean = false)(implicit ctx: Context): Type = if (!previous.exists || ctx.typeComparer.isSameRef(previous, found)) found else if ((prevCtx.scope eq ctx.scope) && (newPrec == definition || @@ -150,7 +163,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit found } else { - if (!previous.isError && !found.isError) { + if (!scala2pkg && !previous.isError && !found.isError) { error( ex"""reference to $name is ambiguous; |it is both ${bindingString(newPrec, ctx, "")} @@ -163,7 +176,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit /** The type representing a named import with enclosing name when imported * from given `site` and `selectors`. */ - def namedImportRef(site: Type, selectors: List[untpd.Tree]): Type = { + def namedImportRef(site: Type, selectors: List[untpd.Tree])(implicit ctx: Context): Type = { def checkUnambiguous(found: Type) = { val other = namedImportRef(site, selectors.tail) if (other.exists && found.exists && (found != other)) @@ -190,7 +203,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit /** The type representing a wildcard import with enclosing name when imported * from given import info */ - def wildImportRef(imp: ImportInfo): Type = { + def wildImportRef(imp: ImportInfo)(implicit ctx: Context): Type = { if (imp.isWildcardImport) { val pre = imp.site if (!isDisabled(imp, pre) && !(imp.excluded contains name.toTermName) && name != nme.CONSTRUCTOR) { @@ -204,54 +217,71 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit /** Is (some alternative of) the given predenotation `denot` * defined in current compilation unit? */ - def isDefinedInCurrentUnit(denot: Denotation): Boolean = denot match { + def isDefinedInCurrentUnit(denot: Denotation)(implicit ctx: Context): Boolean = denot match { case MultiDenotation(d1, d2) => isDefinedInCurrentUnit(d1) || isDefinedInCurrentUnit(d2) case denot: SingleDenotation => denot.symbol.sourceFile == ctx.source.file } /** Is `denot` the denotation of a self symbol? */ - def isSelfDenot(denot: Denotation) = denot match { + def isSelfDenot(denot: Denotation)(implicit ctx: Context) = denot match { case denot: SymDenotation => denot is SelfName case _ => false } - // begin findRef - if (ctx.scope == null) previous - else { - val outer = ctx.outer - if ((ctx.scope ne outer.scope) || (ctx.owner ne outer.owner)) { - val defDenot = ctx.denotNamed(name) - if (qualifies(defDenot)) { - val curOwner = ctx.owner - val found = - if (isSelfDenot(defDenot)) curOwner.enclosingClass.thisType - else curOwner.thisType.select(name, defDenot) - if (!(curOwner is Package) || isDefinedInCurrentUnit(defDenot)) - return checkNewOrShadowed(found, definition) // no need to go further out, we found highest prec entry - else if (defDenot.symbol is Package) - return checkNewOrShadowed(previous orElse found, packageClause) - else if (prevPrec < packageClause) - return findRef(found, packageClause, ctx)(outer) + /** Would import of kind `prec` be not shadowed by a nested higher-precedence definition? */ + def isPossibleImport(prec: Int)(implicit ctx: Context) = + prevPrec < prec || prevPrec == prec && (prevCtx.scope eq ctx.scope) + + @tailrec def loop(implicit ctx: Context): Type = { + if (ctx.scope == null) previous + else { + val outer = ctx.outer + var result: Type = NoType + + // find definition + if ((ctx.scope ne outer.scope) || (ctx.owner ne outer.owner)) { + val defDenot = ctx.denotNamed(name) + if (qualifies(defDenot)) { + val curOwner = ctx.owner + val found = + if (isSelfDenot(defDenot)) curOwner.enclosingClass.thisType + else curOwner.thisType.select(name, defDenot) + if (!(curOwner is Package) || isDefinedInCurrentUnit(defDenot)) + result = checkNewOrShadowed(found, definition) // no need to go further out, we found highest prec entry + else { + if (ctx.scala2Mode && !foundUnderScala2.exists) + foundUnderScala2 = checkNewOrShadowed(found, definition, scala2pkg = true) + if (defDenot.symbol is Package) + result = checkNewOrShadowed(previous orElse found, packageClause) + else if (prevPrec < packageClause) + result = findRef(found, packageClause, ctx)(outer) + } + } } - } - val curImport = ctx.importInfo - if (ctx.owner.is(Package) && curImport != null && curImport.isRootImport && previous.exists) - return previous // no more conflicts possible in this case - // would import of kind `prec` be not shadowed by a nested higher-precedence definition? - def isPossibleImport(prec: Int) = - prevPrec < prec || prevPrec == prec && (prevCtx.scope eq ctx.scope) - if (isPossibleImport(namedImport) && (curImport ne outer.importInfo) && !curImport.sym.isCompleting) { - val namedImp = namedImportRef(curImport.site, curImport.selectors) - if (namedImp.exists) - return findRef(checkNewOrShadowed(namedImp, namedImport), namedImport, ctx)(outer) - if (isPossibleImport(wildImport)) { - val wildImp = wildImportRef(curImport) - if (wildImp.exists) - return findRef(checkNewOrShadowed(wildImp, wildImport), wildImport, ctx)(outer) + + if (result.exists) result + else { // find import + val curImport = ctx.importInfo + if (ctx.owner.is(Package) && curImport != null && curImport.isRootImport && previous.exists) + previous // no more conflicts possible in this case + else if (isPossibleImport(namedImport) && (curImport ne outer.importInfo) && !curImport.sym.isCompleting) { + val namedImp = namedImportRef(curImport.site, curImport.selectors) + if (namedImp.exists) + findRef(checkNewOrShadowed(namedImp, namedImport), namedImport, ctx)(outer) + else if (isPossibleImport(wildImport)) { + val wildImp = wildImportRef(curImport) + if (wildImp.exists) + findRef(checkNewOrShadowed(wildImp, wildImport), wildImport, ctx)(outer) + else loop(outer) + } + else loop(outer) + } + else loop(outer) } } - findRef(previous, prevPrec, prevCtx)(outer) } + + loop } // begin typedIdent @@ -264,12 +294,28 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit return typed(desugar.patternVar(tree), pt) } - val saved = importedFromRoot - importedFromRoot = Set.empty - val rawType = - try findRef(NoType, BindingPrec.nothingBound, NoContext) - finally importedFromRoot = saved + val rawType = { + val saved1 = importedFromRoot + val saved2 = foundUnderScala2 + importedFromRoot = Set.empty + foundUnderScala2 = NoType + try { + var found = findRef(NoType, BindingPrec.nothingBound, NoContext) + if (foundUnderScala2.exists && !(foundUnderScala2 =:= found)) { + ctx.migrationWarning( + ex"""Name resolution will change. + | currently selected : $foundUnderScala2 + | in the future, without -language:Scala2: $found""", tree.pos) + found = foundUnderScala2 + } + found + } + finally { + importedFromRoot = saved1 + foundUnderScala2 = saved2 + } + } val ownType = if (rawType.exists) @@ -317,12 +363,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val qual1 = typedExpr(tree.qualifier, selectionProto(tree.name, pt, this)) if (tree.name.isTypeName) checkStable(qual1.tpe, qual1.pos) val select = typedSelect(tree, pt, qual1) - pt match { - case _: FunProto | AssignProto => select - case _ => - if (select.tpe eq TryDynamicCallType) typedDynamicSelect(tree, pt) - else select - } + if (select.tpe ne TryDynamicCallType) select + else if (pt.isInstanceOf[PolyProto] || pt.isInstanceOf[FunProto] || pt == AssignProto) select + else typedDynamicSelect(tree, Nil, pt) } def asJavaSelectFromTypeTree(implicit ctx: Context): Tree = { @@ -346,11 +389,17 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } } - if (ctx.compilationUnit.isJava && tree.name.isTypeName) { + def selectWithFallback(fallBack: => Tree) = + tryEither(tryCtx => asSelect(tryCtx))((_, _) => fallBack) + + if (ctx.compilationUnit.isJava && tree.name.isTypeName) // SI-3120 Java uses the same syntax, A.B, to express selection from the // value A and from the type A. We have to try both. - tryEither(tryCtx => asSelect(tryCtx))((_, _) => asJavaSelectFromTypeTree(ctx)) - } else asSelect(ctx) + selectWithFallback(asJavaSelectFromTypeTree(ctx)) + else if (tree.name == nme.withFilter && tree.getAttachment(desugar.MaybeFilter).isDefined) + selectWithFallback(typedSelect(untpd.cpy.Select(tree)(tree.qualifier, nme.filter), pt)) + else + asSelect(ctx) } def typedSelectFromTypeTree(tree: untpd.SelectFromTypeTree, pt: Type)(implicit ctx: Context): Tree = track("typedSelectFromTypeTree") { @@ -512,11 +561,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit reassignmentToVal } case TryDynamicCallType => - tree match { - case Assign(Select(qual, name), rhs) if !isDynamicMethod(name) => - typedDynamicAssign(qual, name, rhs, pt) - case _ => reassignmentToVal - } + typedDynamicAssign(tree, pt) case tpe => reassignmentToVal } @@ -527,7 +572,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedBlock(tree: untpd.Block, pt: Type)(implicit ctx: Context) = track("typedBlock") { val exprCtx = index(tree.stats) val stats1 = typedStats(tree.stats, ctx.owner) - val expr1 = typedExpr(tree.expr, pt)(exprCtx) + val ept = + if (tree.isInstanceOf[untpd.InfixOpBlock]) + // Right-binding infix operations are expanded to InfixBlocks, which may be followed by arguments. + // Example: `(a /: bs)(op)` expands to `{ val x = a; bs./:(x) } (op)` where `{...}` is an InfixBlock. + pt + else pt.notApplied + val expr1 = typedExpr(tree.expr, ept)(exprCtx) ensureNoLocalRefs( assignType(cpy.Block(tree)(stats1, expr1), stats1, expr1), pt, localSyms(stats1)) } @@ -574,8 +625,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedIf(tree: untpd.If, pt: Type)(implicit ctx: Context) = track("typedIf") { val cond1 = typed(tree.cond, defn.BooleanType) - val thenp1 = typed(tree.thenp, pt) - val elsep1 = typed(tree.elsep orElse (untpd.unitLiteral withPos tree.pos), pt) + val thenp1 = typed(tree.thenp, pt.notApplied) + val elsep1 = typed(tree.elsep orElse (untpd.unitLiteral withPos tree.pos), pt.notApplied) val thenp2 :: elsep2 :: Nil = harmonize(thenp1 :: elsep1 :: Nil) assignType(cpy.If(tree)(cond1, thenp2, elsep2), thenp2, elsep2) } @@ -748,7 +799,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val selType = widenForMatchSelector( fullyDefinedType(sel1.tpe, "pattern selector", tree.pos)) - val cases1 = typedCases(tree.cases, selType, pt) + val cases1 = typedCases(tree.cases, selType, pt.notApplied) val cases2 = harmonize(cases1).asInstanceOf[List[CaseDef]] assignType(cpy.Match(tree)(sel1, cases2), cases2) } @@ -875,8 +926,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } def typedTry(tree: untpd.Try, pt: Type)(implicit ctx: Context): Try = track("typedTry") { - val expr1 = typed(tree.expr, pt) - val cases1 = typedCases(tree.cases, defn.ThrowableType, pt) + val expr1 = typed(tree.expr, pt.notApplied) + val cases1 = typedCases(tree.cases, defn.ThrowableType, pt.notApplied) val finalizer1 = typed(tree.finalizer, defn.UnitType) val expr2 :: cases2x = harmonize(expr1 :: cases1) val cases2 = cases2x.asInstanceOf[List[CaseDef]] @@ -889,7 +940,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } def typedSeqLiteral(tree: untpd.SeqLiteral, pt: Type)(implicit ctx: Context): SeqLiteral = track("typedSeqLiteral") { - val proto1 = pt.elemType orElse WildcardType + val proto1 = pt.elemType match { + case NoType => WildcardType + case bounds: TypeBounds => WildcardType(bounds) + case elemtp => elemtp + } val elems1 = tree.elems mapconserve (typed(_, proto1)) val proto2 = // the computed type of the `elemtpt` field if (!tree.elemtpt.isEmpty) WildcardType @@ -1066,8 +1121,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def completeAnnotations(mdef: untpd.MemberDef, sym: Symbol)(implicit ctx: Context): Unit = { // necessary to force annotation trees to be computed. sym.annotations.foreach(_.tree) + val annotCtx = ctx.outersIterator.dropWhile(_.owner == sym).next // necessary in order to mark the typed ahead annotations as definitely typed: - untpd.modsDeco(mdef).mods.annotations.foreach(typedAnnotation) + untpd.modsDeco(mdef).mods.annotations.foreach(typedAnnotation(_)(annotCtx)) } def typedAnnotation(annot: untpd.Tree)(implicit ctx: Context): Tree = track("typedAnnotation") { @@ -1485,8 +1541,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } /** If this tree is a select node `qual.name`, try to insert an implicit conversion - * `c` around `qual` so that `c(qual).name` conforms to `pt`. If that fails - * return `tree` itself. + * `c` around `qual` so that `c(qual).name` conforms to `pt`. */ def tryInsertImplicitOnQualifier(tree: Tree, pt: Type)(implicit ctx: Context): Option[Tree] = ctx.traceIndented(i"try insert impl on qualifier $tree $pt") { tree match { @@ -1715,6 +1770,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit else missingArgs case _ => + ctx.typeComparer.GADTused = false if (ctx.mode is Mode.Pattern) { tree match { case _: RefTree | _: Literal if !isVarPattern(tree) => @@ -1723,7 +1779,15 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } tree } - else if (tree.tpe <:< pt) tree + else if (tree.tpe <:< pt) + if (ctx.typeComparer.GADTused && pt.isValueType) + // Insert an explicit cast, so that -Ycheck in later phases succeeds. + // I suspect, but am not 100% sure that this might affect inferred types, + // if the expected type is a supertype of the GADT bound. It would be good to come + // up with a test case for this. + tree.asInstance(pt) + else + tree else if (wtp.isInstanceOf[MethodType]) missingArgs else { typr.println(i"adapt to subtype ${tree.tpe} !<:< $pt") diff --git a/src/scala/compat/java8/JFunction.java b/src/scala/compat/java8/JFunction.java index 8e5a77d47..d68805d08 100644 --- a/src/scala/compat/java8/JFunction.java +++ b/src/scala/compat/java8/JFunction.java @@ -11,96 +11,183 @@ public final class JFunction { private JFunction() {} public static <R> scala.Function0<R> func(JFunction0<R> f) { return f; } public static scala.Function0<BoxedUnit> proc(JProcedure0 p) { return p; } + @SuppressWarnings("unchecked") public static scala.Function0<BoxedUnit> procSpecialized(JFunction0$mcV$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function0<Byte> funcSpecialized(JFunction0$mcB$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function0<Short> funcSpecialized(JFunction0$mcS$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function0<Integer> funcSpecialized(JFunction0$mcI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function0<Long> funcSpecialized(JFunction0$mcJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function0<Character> funcSpecialized(JFunction0$mcC$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function0<Float> funcSpecialized(JFunction0$mcF$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function0<Double> funcSpecialized(JFunction0$mcD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function0<Boolean> funcSpecialized(JFunction0$mcZ$sp f) { return f; } public static <T1, R> scala.Function1<T1, R> func(JFunction1<T1, R> f) { return f; } public static <T1> scala.Function1<T1, BoxedUnit> proc(JProcedure1<T1> p) { return p; } + @SuppressWarnings("unchecked") public static scala.Function1<Integer, BoxedUnit> procSpecialized(JFunction1$mcVI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Integer, Boolean> funcSpecialized(JFunction1$mcZI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Integer, Integer> funcSpecialized(JFunction1$mcII$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Integer, Float> funcSpecialized(JFunction1$mcFI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Integer, Long> funcSpecialized(JFunction1$mcJI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Integer, Double> funcSpecialized(JFunction1$mcDI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Long, BoxedUnit> procSpecialized(JFunction1$mcVJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Long, Boolean> funcSpecialized(JFunction1$mcZJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Long, Integer> funcSpecialized(JFunction1$mcIJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Long, Float> funcSpecialized(JFunction1$mcFJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Long, Long> funcSpecialized(JFunction1$mcJJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Long, Double> funcSpecialized(JFunction1$mcDJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Float, BoxedUnit> procSpecialized(JFunction1$mcVF$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Float, Boolean> funcSpecialized(JFunction1$mcZF$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Float, Integer> funcSpecialized(JFunction1$mcIF$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Float, Float> funcSpecialized(JFunction1$mcFF$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Float, Long> funcSpecialized(JFunction1$mcJF$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Float, Double> funcSpecialized(JFunction1$mcDF$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Double, BoxedUnit> procSpecialized(JFunction1$mcVD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Double, Boolean> funcSpecialized(JFunction1$mcZD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Double, Integer> funcSpecialized(JFunction1$mcID$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Double, Float> funcSpecialized(JFunction1$mcFD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Double, Long> funcSpecialized(JFunction1$mcJD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function1<Double, Double> funcSpecialized(JFunction1$mcDD$sp f) { return f; } public static <T1, T2, R> scala.Function2<T1, T2, R> func(JFunction2<T1, T2, R> f) { return f; } public static <T1, T2> scala.Function2<T1, T2, BoxedUnit> proc(JProcedure2<T1, T2> p) { return p; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Integer, BoxedUnit> procSpecialized(JFunction2$mcVII$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Integer, Boolean> funcSpecialized(JFunction2$mcZII$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Integer, Integer> funcSpecialized(JFunction2$mcIII$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Integer, Float> funcSpecialized(JFunction2$mcFII$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Integer, Long> funcSpecialized(JFunction2$mcJII$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Integer, Double> funcSpecialized(JFunction2$mcDII$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Long, BoxedUnit> procSpecialized(JFunction2$mcVIJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Long, Boolean> funcSpecialized(JFunction2$mcZIJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Long, Integer> funcSpecialized(JFunction2$mcIIJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Long, Float> funcSpecialized(JFunction2$mcFIJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Long, Long> funcSpecialized(JFunction2$mcJIJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Long, Double> funcSpecialized(JFunction2$mcDIJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Double, BoxedUnit> procSpecialized(JFunction2$mcVID$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Double, Boolean> funcSpecialized(JFunction2$mcZID$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Double, Integer> funcSpecialized(JFunction2$mcIID$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Double, Float> funcSpecialized(JFunction2$mcFID$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Double, Long> funcSpecialized(JFunction2$mcJID$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Integer, Double, Double> funcSpecialized(JFunction2$mcDID$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Integer, BoxedUnit> procSpecialized(JFunction2$mcVJI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Integer, Boolean> funcSpecialized(JFunction2$mcZJI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Integer, Integer> funcSpecialized(JFunction2$mcIJI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Integer, Float> funcSpecialized(JFunction2$mcFJI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Integer, Long> funcSpecialized(JFunction2$mcJJI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Integer, Double> funcSpecialized(JFunction2$mcDJI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Long, BoxedUnit> procSpecialized(JFunction2$mcVJJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Long, Boolean> funcSpecialized(JFunction2$mcZJJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Long, Integer> funcSpecialized(JFunction2$mcIJJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Long, Float> funcSpecialized(JFunction2$mcFJJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Long, Long> funcSpecialized(JFunction2$mcJJJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Long, Double> funcSpecialized(JFunction2$mcDJJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Double, BoxedUnit> procSpecialized(JFunction2$mcVJD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Double, Boolean> funcSpecialized(JFunction2$mcZJD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Double, Integer> funcSpecialized(JFunction2$mcIJD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Double, Float> funcSpecialized(JFunction2$mcFJD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Double, Long> funcSpecialized(JFunction2$mcJJD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Long, Double, Double> funcSpecialized(JFunction2$mcDJD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Integer, BoxedUnit> procSpecialized(JFunction2$mcVDI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Integer, Boolean> funcSpecialized(JFunction2$mcZDI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Integer, Integer> funcSpecialized(JFunction2$mcIDI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Integer, Float> funcSpecialized(JFunction2$mcFDI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Integer, Long> funcSpecialized(JFunction2$mcJDI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Integer, Double> funcSpecialized(JFunction2$mcDDI$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Long, BoxedUnit> procSpecialized(JFunction2$mcVDJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Long, Boolean> funcSpecialized(JFunction2$mcZDJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Long, Integer> funcSpecialized(JFunction2$mcIDJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Long, Float> funcSpecialized(JFunction2$mcFDJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Long, Long> funcSpecialized(JFunction2$mcJDJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Long, Double> funcSpecialized(JFunction2$mcDDJ$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Double, BoxedUnit> procSpecialized(JFunction2$mcVDD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Double, Boolean> funcSpecialized(JFunction2$mcZDD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Double, Integer> funcSpecialized(JFunction2$mcIDD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Double, Float> funcSpecialized(JFunction2$mcFDD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Double, Long> funcSpecialized(JFunction2$mcJDD$sp f) { return f; } + @SuppressWarnings("unchecked") public static scala.Function2<Double, Double, Double> funcSpecialized(JFunction2$mcDDD$sp f) { return f; } public static <T1, T2, T3, R> scala.Function3<T1, T2, T3, R> func(JFunction3<T1, T2, T3, R> f) { return f; } public static <T1, T2, T3> scala.Function3<T1, T2, T3, BoxedUnit> proc(JProcedure3<T1, T2, T3> p) { return p; } diff --git a/src/scala/compat/java8/JFunction1.java b/src/scala/compat/java8/JFunction1.java index cbd896282..69176cdea 100644 --- a/src/scala/compat/java8/JFunction1.java +++ b/src/scala/compat/java8/JFunction1.java @@ -11,229 +11,303 @@ public interface JFunction1<T1, R> extends scala.Function1<T1, R> { }; @Override + @SuppressWarnings("unchecked") default <A> scala.Function1<T1, A> andThen(scala.Function1<R, A> g) { return scala.Function1$class.andThen(this, g); } @Override + @SuppressWarnings("unchecked") default <A> scala.Function1<A, R> compose(scala.Function1<A, T1> g) { return scala.Function1$class.compose(this, g); } + @SuppressWarnings("unchecked") default void apply$mcVI$sp(int v1) { apply((T1) ((Integer) v1)); } + @SuppressWarnings("unchecked") default boolean apply$mcZI$sp(int v1) { return (Boolean) apply((T1) ((Integer) v1)); } + @SuppressWarnings("unchecked") default int apply$mcII$sp(int v1) { return (Integer) apply((T1) ((Integer) v1)); } + @SuppressWarnings("unchecked") default float apply$mcFI$sp(int v1) { return (Float) apply((T1) ((Integer) v1)); } + @SuppressWarnings("unchecked") default long apply$mcJI$sp(int v1) { return (Long) apply((T1) ((Integer) v1)); } + @SuppressWarnings("unchecked") default double apply$mcDI$sp(int v1) { return (Double) apply((T1) ((Integer) v1)); } + @SuppressWarnings("unchecked") default void apply$mcVJ$sp(long v1) { apply((T1) ((Long) v1)); } + @SuppressWarnings("unchecked") default boolean apply$mcZJ$sp(long v1) { return (Boolean) apply((T1) ((Long) v1)); } + @SuppressWarnings("unchecked") default int apply$mcIJ$sp(long v1) { return (Integer) apply((T1) ((Long) v1)); } + @SuppressWarnings("unchecked") default float apply$mcFJ$sp(long v1) { return (Float) apply((T1) ((Long) v1)); } + @SuppressWarnings("unchecked") default long apply$mcJJ$sp(long v1) { return (Long) apply((T1) ((Long) v1)); } + @SuppressWarnings("unchecked") default double apply$mcDJ$sp(long v1) { return (Double) apply((T1) ((Long) v1)); } + @SuppressWarnings("unchecked") default void apply$mcVF$sp(float v1) { apply((T1) ((Float) v1)); } + @SuppressWarnings("unchecked") default boolean apply$mcZF$sp(float v1) { return (Boolean) apply((T1) ((Float) v1)); } + @SuppressWarnings("unchecked") default int apply$mcIF$sp(float v1) { return (Integer) apply((T1) ((Float) v1)); } + @SuppressWarnings("unchecked") default float apply$mcFF$sp(float v1) { return (Float) apply((T1) ((Float) v1)); } + @SuppressWarnings("unchecked") default long apply$mcJF$sp(float v1) { return (Long) apply((T1) ((Float) v1)); } + @SuppressWarnings("unchecked") default double apply$mcDF$sp(float v1) { return (Double) apply((T1) ((Float) v1)); } + @SuppressWarnings("unchecked") default void apply$mcVD$sp(double v1) { apply((T1) ((Double) v1)); } + @SuppressWarnings("unchecked") default boolean apply$mcZD$sp(double v1) { return (Boolean) apply((T1) ((Double) v1)); } + @SuppressWarnings("unchecked") default int apply$mcID$sp(double v1) { return (Integer) apply((T1) ((Double) v1)); } + @SuppressWarnings("unchecked") default float apply$mcFD$sp(double v1) { return (Float) apply((T1) ((Double) v1)); } + @SuppressWarnings("unchecked") default long apply$mcJD$sp(double v1) { return (Long) apply((T1) ((Double) v1)); } + @SuppressWarnings("unchecked") default double apply$mcDD$sp(double v1) { return (Double) apply((T1) ((Double) v1)); } - + + @SuppressWarnings("unchecked") default scala.Function1 compose$mcVI$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcZI$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcII$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcFI$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcJI$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcDI$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcVJ$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcZJ$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcIJ$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcFJ$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcJJ$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcDJ$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcVF$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcZF$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcIF$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcFF$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcJF$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcDF$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcVD$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcZD$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcID$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcFD$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcJD$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 compose$mcDD$sp(scala.Function1 g) { return compose(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcVI$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcZI$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcII$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcFI$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcJI$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcDI$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcVJ$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcZJ$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcIJ$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcFJ$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcJJ$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcDJ$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcVF$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcZF$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcIF$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcFF$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcJF$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcDF$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcVD$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcZD$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcID$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcFD$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcJD$sp(scala.Function1 g) { return andThen(g); } + @SuppressWarnings("unchecked") default scala.Function1 andThen$mcDD$sp(scala.Function1 g) { return andThen(g); } diff --git a/src/scala/compat/java8/JFunction10.java b/src/scala/compat/java8/JFunction10.java index c4d190760..8519ac223 100644 --- a/src/scala/compat/java8/JFunction10.java +++ b/src/scala/compat/java8/JFunction10.java @@ -10,10 +10,12 @@ public interface JFunction10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R> extends default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, R>>>>>>>>>> curried() { return scala.Function10$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, R> tupled() { return scala.Function10$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction11.java b/src/scala/compat/java8/JFunction11.java index faa352cf7..032ee40af 100644 --- a/src/scala/compat/java8/JFunction11.java +++ b/src/scala/compat/java8/JFunction11.java @@ -10,10 +10,12 @@ public interface JFunction11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R> ex default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, R>>>>>>>>>>> curried() { return scala.Function11$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, R> tupled() { return scala.Function11$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction12.java b/src/scala/compat/java8/JFunction12.java index 1d67e25c9..3f3eff492 100644 --- a/src/scala/compat/java8/JFunction12.java +++ b/src/scala/compat/java8/JFunction12.java @@ -10,10 +10,12 @@ public interface JFunction12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, R>>>>>>>>>>>> curried() { return scala.Function12$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, R> tupled() { return scala.Function12$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction13.java b/src/scala/compat/java8/JFunction13.java index 7872108d1..2bed6ee97 100644 --- a/src/scala/compat/java8/JFunction13.java +++ b/src/scala/compat/java8/JFunction13.java @@ -10,10 +10,12 @@ public interface JFunction13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, R>>>>>>>>>>>>> curried() { return scala.Function13$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, R> tupled() { return scala.Function13$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction14.java b/src/scala/compat/java8/JFunction14.java index 34b45d634..77fac237d 100644 --- a/src/scala/compat/java8/JFunction14.java +++ b/src/scala/compat/java8/JFunction14.java @@ -10,10 +10,12 @@ public interface JFunction14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, scala.Function1<T14, R>>>>>>>>>>>>>> curried() { return scala.Function14$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, R> tupled() { return scala.Function14$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction15.java b/src/scala/compat/java8/JFunction15.java index 55e4607fe..25adc1679 100644 --- a/src/scala/compat/java8/JFunction15.java +++ b/src/scala/compat/java8/JFunction15.java @@ -10,10 +10,12 @@ public interface JFunction15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, scala.Function1<T14, scala.Function1<T15, R>>>>>>>>>>>>>>> curried() { return scala.Function15$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, R> tupled() { return scala.Function15$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction16.java b/src/scala/compat/java8/JFunction16.java index d2795ebf5..fda1ea0c7 100644 --- a/src/scala/compat/java8/JFunction16.java +++ b/src/scala/compat/java8/JFunction16.java @@ -10,10 +10,12 @@ public interface JFunction16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, scala.Function1<T14, scala.Function1<T15, scala.Function1<T16, R>>>>>>>>>>>>>>>> curried() { return scala.Function16$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>, R> tupled() { return scala.Function16$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction17.java b/src/scala/compat/java8/JFunction17.java index 9ab7715d1..89cb1b312 100644 --- a/src/scala/compat/java8/JFunction17.java +++ b/src/scala/compat/java8/JFunction17.java @@ -10,10 +10,12 @@ public interface JFunction17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, scala.Function1<T14, scala.Function1<T15, scala.Function1<T16, scala.Function1<T17, R>>>>>>>>>>>>>>>>> curried() { return scala.Function17$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>, R> tupled() { return scala.Function17$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction18.java b/src/scala/compat/java8/JFunction18.java index fba19eb38..428cee961 100644 --- a/src/scala/compat/java8/JFunction18.java +++ b/src/scala/compat/java8/JFunction18.java @@ -10,10 +10,12 @@ public interface JFunction18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, scala.Function1<T14, scala.Function1<T15, scala.Function1<T16, scala.Function1<T17, scala.Function1<T18, R>>>>>>>>>>>>>>>>>> curried() { return scala.Function18$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>, R> tupled() { return scala.Function18$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction19.java b/src/scala/compat/java8/JFunction19.java index f56551431..95e47df7e 100644 --- a/src/scala/compat/java8/JFunction19.java +++ b/src/scala/compat/java8/JFunction19.java @@ -10,10 +10,12 @@ public interface JFunction19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, scala.Function1<T14, scala.Function1<T15, scala.Function1<T16, scala.Function1<T17, scala.Function1<T18, scala.Function1<T19, R>>>>>>>>>>>>>>>>>>> curried() { return scala.Function19$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>, R> tupled() { return scala.Function19$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction2.java b/src/scala/compat/java8/JFunction2.java index aa023a19f..bad1493bb 100644 --- a/src/scala/compat/java8/JFunction2.java +++ b/src/scala/compat/java8/JFunction2.java @@ -10,499 +10,663 @@ public interface JFunction2<T1, T2, R> extends scala.Function2<T1, T2, R> { default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, R>> curried() { return scala.Function2$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple2<T1, T2>, R> tupled() { return scala.Function2$class.tupled(this); } + @SuppressWarnings("unchecked") default void apply$mcVII$sp(int v1, int v2) { apply((T1) ((Integer) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default boolean apply$mcZII$sp(int v1, int v2) { return (Boolean) apply((T1) ((Integer) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default int apply$mcIII$sp(int v1, int v2) { return (Integer) apply((T1) ((Integer) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default float apply$mcFII$sp(int v1, int v2) { return (Float) apply((T1) ((Integer) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default long apply$mcJII$sp(int v1, int v2) { return (Long) apply((T1) ((Integer) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default double apply$mcDII$sp(int v1, int v2) { return (Double) apply((T1) ((Integer) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default void apply$mcVIJ$sp(int v1, long v2) { apply((T1) ((Integer) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default boolean apply$mcZIJ$sp(int v1, long v2) { return (Boolean) apply((T1) ((Integer) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default int apply$mcIIJ$sp(int v1, long v2) { return (Integer) apply((T1) ((Integer) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default float apply$mcFIJ$sp(int v1, long v2) { return (Float) apply((T1) ((Integer) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default long apply$mcJIJ$sp(int v1, long v2) { return (Long) apply((T1) ((Integer) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default double apply$mcDIJ$sp(int v1, long v2) { return (Double) apply((T1) ((Integer) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default void apply$mcVID$sp(int v1, double v2) { apply((T1) ((Integer) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default boolean apply$mcZID$sp(int v1, double v2) { return (Boolean) apply((T1) ((Integer) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default int apply$mcIID$sp(int v1, double v2) { return (Integer) apply((T1) ((Integer) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default float apply$mcFID$sp(int v1, double v2) { return (Float) apply((T1) ((Integer) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default long apply$mcJID$sp(int v1, double v2) { return (Long) apply((T1) ((Integer) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default double apply$mcDID$sp(int v1, double v2) { return (Double) apply((T1) ((Integer) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default void apply$mcVJI$sp(long v1, int v2) { apply((T1) ((Long) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default boolean apply$mcZJI$sp(long v1, int v2) { return (Boolean) apply((T1) ((Long) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default int apply$mcIJI$sp(long v1, int v2) { return (Integer) apply((T1) ((Long) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default float apply$mcFJI$sp(long v1, int v2) { return (Float) apply((T1) ((Long) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default long apply$mcJJI$sp(long v1, int v2) { return (Long) apply((T1) ((Long) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default double apply$mcDJI$sp(long v1, int v2) { return (Double) apply((T1) ((Long) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default void apply$mcVJJ$sp(long v1, long v2) { apply((T1) ((Long) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default boolean apply$mcZJJ$sp(long v1, long v2) { return (Boolean) apply((T1) ((Long) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default int apply$mcIJJ$sp(long v1, long v2) { return (Integer) apply((T1) ((Long) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default float apply$mcFJJ$sp(long v1, long v2) { return (Float) apply((T1) ((Long) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default long apply$mcJJJ$sp(long v1, long v2) { return (Long) apply((T1) ((Long) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default double apply$mcDJJ$sp(long v1, long v2) { return (Double) apply((T1) ((Long) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default void apply$mcVJD$sp(long v1, double v2) { apply((T1) ((Long) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default boolean apply$mcZJD$sp(long v1, double v2) { return (Boolean) apply((T1) ((Long) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default int apply$mcIJD$sp(long v1, double v2) { return (Integer) apply((T1) ((Long) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default float apply$mcFJD$sp(long v1, double v2) { return (Float) apply((T1) ((Long) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default long apply$mcJJD$sp(long v1, double v2) { return (Long) apply((T1) ((Long) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default double apply$mcDJD$sp(long v1, double v2) { return (Double) apply((T1) ((Long) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default void apply$mcVDI$sp(double v1, int v2) { apply((T1) ((Double) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default boolean apply$mcZDI$sp(double v1, int v2) { return (Boolean) apply((T1) ((Double) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default int apply$mcIDI$sp(double v1, int v2) { return (Integer) apply((T1) ((Double) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default float apply$mcFDI$sp(double v1, int v2) { return (Float) apply((T1) ((Double) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default long apply$mcJDI$sp(double v1, int v2) { return (Long) apply((T1) ((Double) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default double apply$mcDDI$sp(double v1, int v2) { return (Double) apply((T1) ((Double) v1), (T2) ((Integer) v2)); } + @SuppressWarnings("unchecked") default void apply$mcVDJ$sp(double v1, long v2) { apply((T1) ((Double) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default boolean apply$mcZDJ$sp(double v1, long v2) { return (Boolean) apply((T1) ((Double) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default int apply$mcIDJ$sp(double v1, long v2) { return (Integer) apply((T1) ((Double) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default float apply$mcFDJ$sp(double v1, long v2) { return (Float) apply((T1) ((Double) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default long apply$mcJDJ$sp(double v1, long v2) { return (Long) apply((T1) ((Double) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default double apply$mcDDJ$sp(double v1, long v2) { return (Double) apply((T1) ((Double) v1), (T2) ((Long) v2)); } + @SuppressWarnings("unchecked") default void apply$mcVDD$sp(double v1, double v2) { apply((T1) ((Double) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default boolean apply$mcZDD$sp(double v1, double v2) { return (Boolean) apply((T1) ((Double) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default int apply$mcIDD$sp(double v1, double v2) { return (Integer) apply((T1) ((Double) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default float apply$mcFDD$sp(double v1, double v2) { return (Float) apply((T1) ((Double) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default long apply$mcJDD$sp(double v1, double v2) { return (Long) apply((T1) ((Double) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default double apply$mcDDD$sp(double v1, double v2) { return (Double) apply((T1) ((Double) v1), (T2) ((Double) v2)); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcVII$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcZII$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcIII$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcFII$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcJII$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcDII$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcVIJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcZIJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcIIJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcFIJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcJIJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcDIJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcVID$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcZID$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcIID$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcFID$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcJID$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcDID$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcVJI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcZJI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcIJI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcFJI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcJJI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcDJI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcVJJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcZJJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcIJJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcFJJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcJJJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcDJJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcVJD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcZJD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcIJD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcFJD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcJJD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcDJD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcVDI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcZDI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcIDI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcFDI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcJDI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcDDI$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcVDJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcZDJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcIDJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcFDJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcJDJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcDDJ$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcVDD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcZDD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcIDD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcFDD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcJDD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 curried$mcDDD$sp() { return curried(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcVII$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcZII$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcIII$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcFII$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcJII$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcDII$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcVIJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcZIJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcIIJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcFIJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcJIJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcDIJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcVID$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcZID$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcIID$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcFID$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcJID$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcDID$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcVJI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcZJI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcIJI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcFJI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcJJI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcDJI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcVJJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcZJJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcIJJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcFJJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcJJJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcDJJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcVJD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcZJD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcIJD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcFJD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcJJD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcDJD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcVDI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcZDI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcIDI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcFDI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcJDI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcDDI$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcVDJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcZDJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcIDJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcFDJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcJDJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcDDJ$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcVDD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcZDD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcIDD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcFDD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcJDD$sp() { return tupled(); } + @SuppressWarnings("unchecked") default scala.Function1 tupled$mcDDD$sp() { return tupled(); } diff --git a/src/scala/compat/java8/JFunction20.java b/src/scala/compat/java8/JFunction20.java index dd517c349..ed30b41ef 100644 --- a/src/scala/compat/java8/JFunction20.java +++ b/src/scala/compat/java8/JFunction20.java @@ -10,10 +10,12 @@ public interface JFunction20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, scala.Function1<T14, scala.Function1<T15, scala.Function1<T16, scala.Function1<T17, scala.Function1<T18, scala.Function1<T19, scala.Function1<T20, R>>>>>>>>>>>>>>>>>>>> curried() { return scala.Function20$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>, R> tupled() { return scala.Function20$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction21.java b/src/scala/compat/java8/JFunction21.java index c2e19b30a..aa6da8084 100644 --- a/src/scala/compat/java8/JFunction21.java +++ b/src/scala/compat/java8/JFunction21.java @@ -10,10 +10,12 @@ public interface JFunction21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, scala.Function1<T14, scala.Function1<T15, scala.Function1<T16, scala.Function1<T17, scala.Function1<T18, scala.Function1<T19, scala.Function1<T20, scala.Function1<T21, R>>>>>>>>>>>>>>>>>>>>> curried() { return scala.Function21$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>, R> tupled() { return scala.Function21$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction22.java b/src/scala/compat/java8/JFunction22.java index 76aa230ea..532145157 100644 --- a/src/scala/compat/java8/JFunction22.java +++ b/src/scala/compat/java8/JFunction22.java @@ -10,10 +10,12 @@ public interface JFunction22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, scala.Function1<T10, scala.Function1<T11, scala.Function1<T12, scala.Function1<T13, scala.Function1<T14, scala.Function1<T15, scala.Function1<T16, scala.Function1<T17, scala.Function1<T18, scala.Function1<T19, scala.Function1<T20, scala.Function1<T21, scala.Function1<T22, R>>>>>>>>>>>>>>>>>>>>>> curried() { return scala.Function22$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>, R> tupled() { return scala.Function22$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction3.java b/src/scala/compat/java8/JFunction3.java index 938e10a05..731608b2e 100644 --- a/src/scala/compat/java8/JFunction3.java +++ b/src/scala/compat/java8/JFunction3.java @@ -10,10 +10,12 @@ public interface JFunction3<T1, T2, T3, R> extends scala.Function3<T1, T2, T3, R default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, R>>> curried() { return scala.Function3$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple3<T1, T2, T3>, R> tupled() { return scala.Function3$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction4.java b/src/scala/compat/java8/JFunction4.java index 08687fbfd..9bff4c835 100644 --- a/src/scala/compat/java8/JFunction4.java +++ b/src/scala/compat/java8/JFunction4.java @@ -10,10 +10,12 @@ public interface JFunction4<T1, T2, T3, T4, R> extends scala.Function4<T1, T2, T default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, R>>>> curried() { return scala.Function4$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple4<T1, T2, T3, T4>, R> tupled() { return scala.Function4$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction5.java b/src/scala/compat/java8/JFunction5.java index 84b9b97cb..a5566a5ba 100644 --- a/src/scala/compat/java8/JFunction5.java +++ b/src/scala/compat/java8/JFunction5.java @@ -10,10 +10,12 @@ public interface JFunction5<T1, T2, T3, T4, T5, R> extends scala.Function5<T1, T default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, R>>>>> curried() { return scala.Function5$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple5<T1, T2, T3, T4, T5>, R> tupled() { return scala.Function5$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction6.java b/src/scala/compat/java8/JFunction6.java index 957d5470d..b30fb5f47 100644 --- a/src/scala/compat/java8/JFunction6.java +++ b/src/scala/compat/java8/JFunction6.java @@ -10,10 +10,12 @@ public interface JFunction6<T1, T2, T3, T4, T5, T6, R> extends scala.Function6<T default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, R>>>>>> curried() { return scala.Function6$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple6<T1, T2, T3, T4, T5, T6>, R> tupled() { return scala.Function6$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction7.java b/src/scala/compat/java8/JFunction7.java index 51352aba6..4a4a92cba 100644 --- a/src/scala/compat/java8/JFunction7.java +++ b/src/scala/compat/java8/JFunction7.java @@ -10,10 +10,12 @@ public interface JFunction7<T1, T2, T3, T4, T5, T6, T7, R> extends scala.Functio default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, R>>>>>>> curried() { return scala.Function7$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple7<T1, T2, T3, T4, T5, T6, T7>, R> tupled() { return scala.Function7$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction8.java b/src/scala/compat/java8/JFunction8.java index 5e0a776ff..825236e48 100644 --- a/src/scala/compat/java8/JFunction8.java +++ b/src/scala/compat/java8/JFunction8.java @@ -10,10 +10,12 @@ public interface JFunction8<T1, T2, T3, T4, T5, T6, T7, T8, R> extends scala.Fun default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, R>>>>>>>> curried() { return scala.Function8$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, R> tupled() { return scala.Function8$class.tupled(this); } diff --git a/src/scala/compat/java8/JFunction9.java b/src/scala/compat/java8/JFunction9.java index dc9b8e71c..d0e40c316 100644 --- a/src/scala/compat/java8/JFunction9.java +++ b/src/scala/compat/java8/JFunction9.java @@ -10,10 +10,12 @@ public interface JFunction9<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> extends scala default void $init$() { }; + @SuppressWarnings("unchecked") default scala.Function1<T1, scala.Function1<T2, scala.Function1<T3, scala.Function1<T4, scala.Function1<T5, scala.Function1<T6, scala.Function1<T7, scala.Function1<T8, scala.Function1<T9, R>>>>>>>>> curried() { return scala.Function9$class.curried(this); } + @SuppressWarnings("unchecked") default scala.Function1<scala.Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>, R> tupled() { return scala.Function9$class.tupled(this); } diff --git a/test/dotc/build.scala b/test/dotc/build.scala index 2963b8f1e..a805af7e5 100644 --- a/test/dotc/build.scala +++ b/test/dotc/build.scala @@ -26,6 +26,5 @@ object build extends tests { dotty // build output dir val p = Runtime.getRuntime.exec(Array("jar", "cf", "dotty.jar", "-C", "out", ".")) p.waitFor() - p } } diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 31e74fa97..9f95a30c1 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -110,6 +110,7 @@ class tests extends CompilerTest { @Test def rewrites = compileFile(posScala2Dir, "rewrites", "-rewrite" :: scala2mode) @Test def pos_859 = compileFile(posSpecialDir, "i859", scala2mode)(allowDeepSubtypes) + @Test def pos_t8146a = compileFile(posSpecialDir, "t8146a")(allowDeepSubtypes) @Test def pos_t5545 = { // compile by hand in two batches, since junit lacks the infrastructure to diff --git a/tests/pending/hkt/compiler.error b/tests/disabled/not-representable/hkt/compiler.error index b31760891..b31760891 100644 --- a/tests/pending/hkt/compiler.error +++ b/tests/disabled/not-representable/hkt/compiler.error diff --git a/tests/pending/hkt/hkt.scala b/tests/disabled/not-representable/hkt/hkt.scala index 34858cd95..1a9932d73 100644 --- a/tests/pending/hkt/hkt.scala +++ b/tests/disabled/not-representable/hkt/hkt.scala @@ -1,3 +1,6 @@ +// This one is unavoidable. Dotty does not allow several overloaded +// parameterless methods, so it picks the one in the subclass. + import scala.language.higherKinds // Minimal reproduction for: // scala.collection.mutable.ArrayStack.empty[Int] diff --git a/tests/pending/pos/t3999b.scala b/tests/disabled/not-representable/pos/t3999b.scala index 0f3f7d642..0f3f7d642 100644 --- a/tests/pending/pos/t3999b.scala +++ b/tests/disabled/not-representable/pos/t3999b.scala diff --git a/tests/run/t5544/Api_1.scala b/tests/disabled/not-representable/pos/t5544/Api_1.scala index b4c92864d..30994fa07 100644 --- a/tests/run/t5544/Api_1.scala +++ b/tests/disabled/not-representable/pos/t5544/Api_1.scala @@ -1,3 +1,4 @@ +// Uses structural types; therefore not expressible in dotty import scala.annotation.StaticAnnotation class ann(val bar: Any) extends StaticAnnotation diff --git a/tests/run/t5544/Test_2.scala b/tests/disabled/not-representable/pos/t5544/Test_2.scala index ea9232221..ea9232221 100644 --- a/tests/run/t5544/Test_2.scala +++ b/tests/disabled/not-representable/pos/t5544/Test_2.scala diff --git a/tests/pending/pos/t7035.scala b/tests/disabled/not-representable/pos/t7035.scala index f45bd0a87..b1ce66cc6 100644 --- a/tests/pending/pos/t7035.scala +++ b/tests/disabled/not-representable/pos/t7035.scala @@ -1,3 +1,5 @@ +// no longer works because dotty uses name-nased pattern matching for case classes + case class Y(final var x: Int, final private var y: String, final val z1: Boolean, final private val z2: Any) { import Test.{y => someY} diff --git a/tests/pending/pos/t7228.scala b/tests/disabled/not-representable/pos/t7228.scala index 5d936f652..525327857 100644 --- a/tests/pending/pos/t7228.scala +++ b/tests/disabled/not-representable/pos/t7228.scala @@ -1,3 +1,4 @@ +// no longer works because dotty does not have a concept of weak conformance object AdaptWithWeaklyConformantType { implicit class D(d: Double) { def double = d*2 } diff --git a/tests/pending/pos/t8111.scala b/tests/disabled/not-representable/pos/t8111.scala index 3f0e766ce..04a8e20de 100644 --- a/tests/pending/pos/t8111.scala +++ b/tests/disabled/not-representable/pos/t8111.scala @@ -1,3 +1,4 @@ +// structural types, cannot represent trait T { def crashy(ma: Any): Unit = { diff --git a/tests/pending/run/t2337.scala b/tests/disabled/not-representable/t2337.scala index edb574cba..9e3b8c555 100644 --- a/tests/pending/run/t2337.scala +++ b/tests/disabled/not-representable/t2337.scala @@ -1,4 +1,4 @@ - +// Failure of autotupling in the presence of overloaded functions. object Test { def compare(first: Any, second: Any): Any = { diff --git a/tests/pending/pos/t5604b/T_1.scala b/tests/disabled/not-testable/t5604b/T_1.scala index 179dcb10c..179dcb10c 100644 --- a/tests/pending/pos/t5604b/T_1.scala +++ b/tests/disabled/not-testable/t5604b/T_1.scala diff --git a/tests/pending/pos/t5604b/T_2.scala b/tests/disabled/not-testable/t5604b/T_2.scala index 179dcb10c..179dcb10c 100644 --- a/tests/pending/pos/t5604b/T_2.scala +++ b/tests/disabled/not-testable/t5604b/T_2.scala diff --git a/tests/pending/pos/t5604b/Test_1.scala b/tests/disabled/not-testable/t5604b/Test_1.scala index f7c58ebe8..f7c58ebe8 100644 --- a/tests/pending/pos/t5604b/Test_1.scala +++ b/tests/disabled/not-testable/t5604b/Test_1.scala diff --git a/tests/pending/pos/t5604b/Test_2.scala b/tests/disabled/not-testable/t5604b/Test_2.scala index f7c58ebe8..f7c58ebe8 100644 --- a/tests/pending/pos/t5604b/Test_2.scala +++ b/tests/disabled/not-testable/t5604b/Test_2.scala diff --git a/tests/pending/pos/t5604b/pack_1.scala b/tests/disabled/not-testable/t5604b/pack_1.scala index f50d568bf..f50d568bf 100644 --- a/tests/pending/pos/t5604b/pack_1.scala +++ b/tests/disabled/not-testable/t5604b/pack_1.scala diff --git a/tests/pending/pos/t5954a/A_1.scala b/tests/disabled/not-testable/t5954a/A_1.scala index 10ead0b1c..10ead0b1c 100644 --- a/tests/pending/pos/t5954a/A_1.scala +++ b/tests/disabled/not-testable/t5954a/A_1.scala diff --git a/tests/pending/pos/t5954a/B_2.scala b/tests/disabled/not-testable/t5954a/B_2.scala index 10ead0b1c..10ead0b1c 100644 --- a/tests/pending/pos/t5954a/B_2.scala +++ b/tests/disabled/not-testable/t5954a/B_2.scala diff --git a/tests/pending/pos/t5954b/A_1.scala b/tests/disabled/not-testable/t5954b/A_1.scala index 8465e8f8c..8465e8f8c 100644 --- a/tests/pending/pos/t5954b/A_1.scala +++ b/tests/disabled/not-testable/t5954b/A_1.scala diff --git a/tests/pending/pos/t5954b/B_2.scala b/tests/disabled/not-testable/t5954b/B_2.scala index f7e4704b3..f7e4704b3 100644 --- a/tests/pending/pos/t5954b/B_2.scala +++ b/tests/disabled/not-testable/t5954b/B_2.scala diff --git a/tests/pending/pos/t5954c/A_1.scala b/tests/disabled/not-testable/t5954c/A_1.scala index 29ad9547a..29ad9547a 100644 --- a/tests/pending/pos/t5954c/A_1.scala +++ b/tests/disabled/not-testable/t5954c/A_1.scala diff --git a/tests/pending/pos/t5954c/B_2.scala b/tests/disabled/not-testable/t5954c/B_2.scala index 29ad9547a..29ad9547a 100644 --- a/tests/pending/pos/t5954c/B_2.scala +++ b/tests/disabled/not-testable/t5954c/B_2.scala diff --git a/tests/pending/pos/t5954d/A_1.scala b/tests/disabled/not-testable/t5954d/A_1.scala index 8465e8f8c..8465e8f8c 100644 --- a/tests/pending/pos/t5954d/A_1.scala +++ b/tests/disabled/not-testable/t5954d/A_1.scala diff --git a/tests/pending/pos/t5954d/B_2.scala b/tests/disabled/not-testable/t5954d/B_2.scala index a4aa2eb58..a4aa2eb58 100644 --- a/tests/pending/pos/t5954d/B_2.scala +++ b/tests/disabled/not-testable/t5954d/B_2.scala diff --git a/tests/pending/pos/t8134/A_1.scala b/tests/disabled/not-testable/t8134/A_1.scala index 32bce003f..32bce003f 100644 --- a/tests/pending/pos/t8134/A_1.scala +++ b/tests/disabled/not-testable/t8134/A_1.scala diff --git a/tests/pending/pos/t8134/B_2.scala b/tests/disabled/not-testable/t8134/B_2.scala index 32bce003f..32bce003f 100644 --- a/tests/pending/pos/t8134/B_2.scala +++ b/tests/disabled/not-testable/t8134/B_2.scala diff --git a/tests/pending/pos/depmet_implicit_oopsla_zipwith.scala b/tests/disabled/structural-type/pos/depmet_implicit_oopsla_zipwith.scala index 83171f865..83171f865 100644 --- a/tests/pending/pos/depmet_implicit_oopsla_zipwith.scala +++ b/tests/disabled/structural-type/pos/depmet_implicit_oopsla_zipwith.scala diff --git a/tests/pending/pos/t8237b.scala b/tests/disabled/typetags/pos/t8237b.scala index 52bb310e8..52bb310e8 100644 --- a/tests/pending/pos/t8237b.scala +++ b/tests/disabled/typetags/pos/t8237b.scala diff --git a/tests/neg/applydynamic_sip.check b/tests/neg/applydynamic_sip.check new file mode 100644 index 000000000..1bd8304bf --- /dev/null +++ b/tests/neg/applydynamic_sip.check @@ -0,0 +1,52 @@ +tests/neg/applydynamic_sip.scala:8: error: value applyDynamic is not a member of Dynamic(Test.qual) +possible cause: maybe a wrong Dynamic method signature? + qual.sel(a, a2: _*) // error + ^ +tests/neg/applydynamic_sip.scala:9: error: applyDynamicNamed does not support passing a vararg parameter + qual.sel(arg = a, a2: _*) // error + ^ +tests/neg/applydynamic_sip.scala:10: error: applyDynamicNamed does not support passing a vararg parameter + qual.sel(arg, arg2 = "a2", a2: _*) // error + ^ +tests/neg/applydynamic_sip.scala:20: error: type mismatch: + found : String("sel") + required: Int + bad1.sel // error + ^ +tests/neg/applydynamic_sip.scala:21: error: type mismatch: + found : String("sel") + required: Int + bad1.sel(1) // error // error + ^ +tests/neg/applydynamic_sip.scala:21: error: method applyDynamic in class Bad1 does not take more parameters + bad1.sel(1) // error // error + ^ +tests/neg/applydynamic_sip.scala:22: error: type mismatch: + found : String("sel") + required: Int + bad1.sel(a = 1) // error // error + ^ +tests/neg/applydynamic_sip.scala:22: error: method applyDynamicNamed in class Bad1 does not take more parameters + bad1.sel(a = 1) // error // error + ^ +tests/neg/applydynamic_sip.scala:23: error: type mismatch: + found : String("sel") + required: Int + bad1.sel = 1 // error // error + ^ +tests/neg/applydynamic_sip.scala:23: error: method updateDynamic in class Bad1 does not take more parameters + bad1.sel = 1 // error // error + ^ +tests/neg/applydynamic_sip.scala:32: error: method selectDynamic in class Bad2 does not take parameters + bad2.sel // error + ^ +tests/neg/applydynamic_sip.scala:33: error: method applyDynamic in class Bad2 does not take parameters + bad2.sel(1) // error + ^ +tests/neg/applydynamic_sip.scala:34: error: method applyDynamicNamed in class Bad2 does not take parameters + bad2.sel(a = 1) // error + ^ +tests/neg/applydynamic_sip.scala:35: error: method updateDynamic in class Bad2 does not take parameters + bad2.sel = 1 // error + ^ +14 errors found diff --git a/tests/untried/neg/applydynamic_sip.flags b/tests/neg/applydynamic_sip.flags index 1141f9750..1141f9750 100644 --- a/tests/untried/neg/applydynamic_sip.flags +++ b/tests/neg/applydynamic_sip.flags diff --git a/tests/neg/applydynamic_sip.scala b/tests/neg/applydynamic_sip.scala new file mode 100644 index 000000000..7b131e7ff --- /dev/null +++ b/tests/neg/applydynamic_sip.scala @@ -0,0 +1,36 @@ +import scala.language.dynamics +object Test extends App { + val qual: Dynamic = ??? + val expr = "expr" + val a = "a" + val a2 = "a2" + + qual.sel(a, a2: _*) // error + qual.sel(arg = a, a2: _*) // error + qual.sel(arg, arg2 = "a2", a2: _*) // error + + class Bad1 extends Dynamic { + def selectDynamic(n: Int) = n + def applyDynamic(n: Int) = n + def applyDynamicNamed(n: Int) = n + def updateDynamic(n: Int) = n + + } + val bad1 = new Bad1 + bad1.sel // error + bad1.sel(1) // error // error + bad1.sel(a = 1) // error // error + bad1.sel = 1 // error // error + + class Bad2 extends Dynamic { + def selectDynamic = 1 + def applyDynamic = 1 + def applyDynamicNamed = 1 + def updateDynamic = 1 + } + val bad2 = new Bad2 + bad2.sel // error + bad2.sel(1) // error + bad2.sel(a = 1) // error + bad2.sel = 1 // error +} diff --git a/tests/neg/emptyCatch.scala b/tests/neg/emptyCatch.scala new file mode 100644 index 000000000..60951d27a --- /dev/null +++ b/tests/neg/emptyCatch.scala @@ -0,0 +1,3 @@ +object Test { + try {} catch {} // error: `catch` block does not contain a valid expression, try adding a case like - `case e: Exception =>` to the block +} diff --git a/tests/neg/i1503.scala b/tests/neg/i1503.scala new file mode 100644 index 000000000..8e5dc53c6 --- /dev/null +++ b/tests/neg/i1503.scala @@ -0,0 +1,14 @@ +object Test { + + val cond = true + def foo1() = println("hi") + def bar1() = println("there") + + def foo2(x: Int) = println("hi") + def bar2(x: Int) = println("there") + + def main(args: Array[String]) = { + (if (cond) foo1 else bar1)() // error: Unit does not take parameters + (if (cond) foo2 else bar2)(22) // error: missing arguments // error: missing arguments + } +} diff --git a/tests/untried/neg/t6355b.check b/tests/neg/t6355b.check index f827f07e5..fb73b9c42 100644 --- a/tests/untried/neg/t6355b.check +++ b/tests/neg/t6355b.check @@ -1,11 +1,11 @@ t6355b.scala:14: error: value applyDynamic is not a member of A error after rewriting to x.<applyDynamic: error>("bippy") possible cause: maybe a wrong Dynamic method signature? - println(x.bippy(42)) + println(x.bippy(42)) // error ^ t6355b.scala:15: error: value applyDynamic is not a member of A error after rewriting to x.<applyDynamic: error>("bippy") possible cause: maybe a wrong Dynamic method signature? - println(x.bippy("42")) + println(x.bippy("42")) // error ^ two errors found diff --git a/tests/untried/neg/t6355b.scala b/tests/neg/t6355b.scala index 5f3c97cb0..bba3c4fdc 100644 --- a/tests/untried/neg/t6355b.scala +++ b/tests/neg/t6355b.scala @@ -11,7 +11,7 @@ class B(method: String) { object Test { def main(args: Array[String]): Unit = { val x = new A - println(x.bippy(42)) - println(x.bippy("42")) + println(x.bippy(42)) // error + println(x.bippy("42")) // error } } diff --git a/tests/untried/neg/t6663.check b/tests/neg/t6663.check index aa4faa4a4..aa4faa4a4 100644 --- a/tests/untried/neg/t6663.check +++ b/tests/neg/t6663.check diff --git a/tests/untried/neg/t6663.scala b/tests/neg/t6663.scala index 4a358dfbc..aa4ab08ed 100644 --- a/tests/untried/neg/t6663.scala +++ b/tests/neg/t6663.scala @@ -13,7 +13,7 @@ object Test extends App { // but, before fixing SI-6663, became // C(42).selectDynamic("foo").get, ignoring // the [String] type parameter - var v = new C(42).foo[String].get :Int + var v = new C(42).foo[String].get :Int // error println(v) } diff --git a/tests/untried/neg/t6920.check b/tests/neg/t6920.check index ee4eafb83..8bfd16a5f 100644 --- a/tests/untried/neg/t6920.check +++ b/tests/neg/t6920.check @@ -1,6 +1,6 @@ t6920.scala:9: error: too many arguments for method applyDynamicNamed: (values: Seq[(String, Any)])String error after rewriting to CompilerError.this.test.applyDynamicNamed("crushTheCompiler")(scala.Tuple2("a", 1), scala.Tuple2("b", 2)) possible cause: maybe a wrong Dynamic method signature? - test.crushTheCompiler(a = 1, b = 2) + test.crushTheCompiler(a = 1, b = 2) // error ^ one error found diff --git a/tests/untried/neg/t6920.scala b/tests/neg/t6920.scala index 25dc7b3b6..9601ed8d2 100644 --- a/tests/untried/neg/t6920.scala +++ b/tests/neg/t6920.scala @@ -6,5 +6,5 @@ class DynTest extends Dynamic { class CompilerError { val test = new DynTest - test.crushTheCompiler(a = 1, b = 2) + test.crushTheCompiler(a = 1, b = 2) // error } diff --git a/tests/pending/pos/t7239.scala b/tests/neg/t7239.scala index 16e9d00f1..f3a379b4e 100644 --- a/tests/pending/pos/t7239.scala +++ b/tests/neg/t7239.scala @@ -1,3 +1,5 @@ +// Dotty rewrites only withFilter calls occurring in for expressions to filter calls. +// So this test does not compile. object Test { def BrokenMethod(): HasFilter[(Int, String)] = ??? @@ -15,12 +17,12 @@ object Test { (implicit F0: NoImplicit): HasWithFilter = ??? } - BrokenMethod().withFilter(_ => true) // okay - BrokenMethod().filter(_ => true) // okay + BrokenMethod().withFilter(_ => true) // error + BrokenMethod().filter(_ => true) // ok locally { import addWithFilter._ - BrokenMethod().withFilter((_: (Int, String)) => true) // okay + BrokenMethod().withFilter((_: (Int, String)) => true) // error } locally { @@ -33,6 +35,6 @@ object Test { // `(B => Boolean)`. Only later during pickling does the // defensive check for erroneous types in the tree pick up // the problem. - BrokenMethod().withFilter(x => true) // erroneous or inaccessible type. + BrokenMethod().withFilter(x => true) // error } } diff --git a/tests/pending/pos/t8002-nested-scope.scala b/tests/neg/t8002-nested-scope.scala index a2088bce7..78a03ce66 100644 --- a/tests/pending/pos/t8002-nested-scope.scala +++ b/tests/neg/t8002-nested-scope.scala @@ -13,7 +13,7 @@ class C { { val a = 0 object C { - new C().x + new C().x // error: cannot be accessed } } } diff --git a/tests/untried/neg/t8006.check b/tests/neg/t8006.check index fbac26e3a..98207ba30 100644 --- a/tests/untried/neg/t8006.check +++ b/tests/neg/t8006.check @@ -1,6 +1,6 @@ t8006.scala:3: error: too many arguments for method applyDynamicNamed: (value: (String, Any))String error after rewriting to X.this.d.applyDynamicNamed("meth")(scala.Tuple2("value1", 10), scala.Tuple2("value2", 100)) possible cause: maybe a wrong Dynamic method signature? - d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed + d.meth(value1 = 10, value2 = 100) // error: two arguments here, but only one is allowed ^ one error found diff --git a/tests/untried/neg/t8006.scala b/tests/neg/t8006.scala index 8dc60697d..34946a659 100644 --- a/tests/untried/neg/t8006.scala +++ b/tests/neg/t8006.scala @@ -1,6 +1,6 @@ object X { val d = new D - d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed + d.meth(value1 = 10, value2 = 100) // error: two arguments here, but only one is allowed } import language.dynamics class D extends Dynamic { diff --git a/tests/pending/import-rewrite/compiler.error b/tests/pending/import-rewrite/compiler.error deleted file mode 100644 index 0832d33bb..000000000 --- a/tests/pending/import-rewrite/compiler.error +++ /dev/null @@ -1,6 +0,0 @@ -$ scalac tests/pending/import-rewrite/*.scala -$ ./bin/dotc tests/pending/import-rewrite/*.scala -tests/pending/import-rewrite/rewrite.scala:5: error: value apply is not a member of java.io.File.type - Seq("").map(File.apply) - ^ -one error found diff --git a/tests/pending/neg/i533/Compat.scala b/tests/pending/neg/i533/Compat.scala new file mode 100644 index 000000000..16613cf5b --- /dev/null +++ b/tests/pending/neg/i533/Compat.scala @@ -0,0 +1,7 @@ +object Compat { + def main(args: Array[String]): Unit = { + val x = new Array[Int](1) + x(0) = 10 + println(JA.get(x)) + } +} diff --git a/tests/pending/neg/i533/JA.java b/tests/pending/neg/i533/JA.java new file mode 100644 index 000000000..92421e5b1 --- /dev/null +++ b/tests/pending/neg/i533/JA.java @@ -0,0 +1,5 @@ +class JA { + public static <T> T get(T[] arr) { + return arr[0]; + } +}
\ No newline at end of file diff --git a/tests/pending/pos/contraImplicits.scala b/tests/pending/pos/contraImplicits.scala deleted file mode 100644 index c4d659615..000000000 --- a/tests/pending/pos/contraImplicits.scala +++ /dev/null @@ -1,18 +0,0 @@ -import scala.reflect._ -// this needs to be fleshed out further -class Contra[-T] - -object Test { - def getParam[T](c: Contra[T])(implicit ct: ClassTag[T]): Unit = { - println(ct) - ct - } - def f[T](x: Contra[T]): Contra[T] = x - - def main(args: Array[String]): Unit = { - val x = f(new Contra[Int]) - val y: Contra[Int] = x - getParam(new Contra[Int]) - } -} - diff --git a/tests/pending/pos/depmet_implicit_norm_ret.scala b/tests/pending/pos/depmet_implicit_norm_ret.scala index 85be750b4..42bfb9fe1 100644 --- a/tests/pending/pos/depmet_implicit_norm_ret.scala +++ b/tests/pending/pos/depmet_implicit_norm_ret.scala @@ -17,6 +17,8 @@ object Test{ } } + import ZipWith._ + trait ZipWith[S] { type T def zipWith : S => T = sys.error("") @@ -24,6 +26,9 @@ object Test{ // bug: inferred return type = (Stream[A]) => java.lang.Object with Test.ZipWith[B]{type T = Stream[B]}#T // this seems incompatible with vvvvvvvvvvvvvvvvvvvvvv -- #3731 - def map[A,B](f : A => B) /* : Stream[A] => Stream[B]*/ = ZipWith(f) - val tst: Stream[Int] = map{x: String => x.length}(Stream("a")) + def map1[A,B](f : A => B) = ZipWith(f)(SuccZipWith) // this typechecks but fails in -Ycheck:first + val tst1: Stream[Int] = map1[String, Int]{x: String => x.length}.apply(Stream("a")) + + def map2[A,B](f : A => B) = ZipWith(f) // this finds ZeroZipWith where scalac finds SuccZipWith and fails typechecking in the next line. + val tst2: Stream[Int] = map2{x: String => x.length}.apply(Stream("a")) } diff --git a/tests/pending/pos/depsel.scala b/tests/pending/pos/depsel.scala deleted file mode 100644 index 2cec4349e..000000000 --- a/tests/pending/pos/depsel.scala +++ /dev/null @@ -1,14 +0,0 @@ -// demonstrates selection on non-path types. Needs to be fleshed out to -// become a real test. -object Test { - - class C { - type T - val f: T => T = ??? - } - - var x = new C - val y = x.f - - -} diff --git a/tests/pending/pos/exponential-spec.scala b/tests/pending/pos/exponential-spec.scala index 54515c1d2..26c9ab85e 100644 --- a/tests/pending/pos/exponential-spec.scala +++ b/tests/pending/pos/exponential-spec.scala @@ -23,7 +23,7 @@ object Test { compose f[T] // 8s compose f[T] // 11s compose f[T] // 17s - compose f[T] // 29s +/* compose f[T] // 29s compose f[T] // 54s compose f[T] compose f[T] @@ -42,6 +42,6 @@ object Test { compose f[T] compose f[T] compose f[T] - compose f[T] + compose f[T]*/ )(exp) } diff --git a/tests/pending/pos/generic-sigs.flags b/tests/pending/pos/generic-sigs.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/generic-sigs.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/infersingle.flags b/tests/pending/pos/infersingle.flags deleted file mode 100644 index e1b37447c..000000000 --- a/tests/pending/pos/infersingle.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental
\ No newline at end of file diff --git a/tests/pending/pos/isApplicableSafe.scala b/tests/pending/pos/isApplicableSafe.scala deleted file mode 100644 index b4cacbf28..000000000 --- a/tests/pending/pos/isApplicableSafe.scala +++ /dev/null @@ -1,8 +0,0 @@ -class A { - // Any of Array[List[Symbol]], List[Array[Symbol]], or List[List[Symbol]] compile. - var xs: Array[Array[Symbol]] = _ - var ys: Array[Map[Symbol, Set[Symbol]]] = _ - - xs = Array(Array()) - ys = Array(Map(), Map()) -} diff --git a/tests/pending/pos/setter-not-implicit.scala b/tests/pending/pos/setter-not-implicit.scala deleted file mode 100644 index 9bfffc2ce..000000000 --- a/tests/pending/pos/setter-not-implicit.scala +++ /dev/null @@ -1,3 +0,0 @@ -object O { - implicit var x: Int = 0 -} diff --git a/tests/pending/pos/stable.scala b/tests/pending/pos/stable.scala deleted file mode 100644 index 267a36fe5..000000000 --- a/tests/pending/pos/stable.scala +++ /dev/null @@ -1,11 +0,0 @@ -trait Base { - val x: Int; - val y: Int; - var z: Int; -} - -class Sub() extends Base { - val x: Int = 1; - val y: Int = 2; - var z: Int = 3; -} diff --git a/tests/pending/pos/t3631.scala b/tests/pending/pos/t3631.scala index e72374130..207e28cd7 100644 --- a/tests/pending/pos/t3631.scala +++ b/tests/pending/pos/t3631.scala @@ -1,3 +1,4 @@ +// fails Ycheck case class X22(x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int) { } case class X23(x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int, x23: Int) { } diff --git a/tests/pending/pos/t3960.flags b/tests/pending/pos/t3960.flags deleted file mode 100644 index 4449dbbdf..000000000 --- a/tests/pending/pos/t3960.flags +++ /dev/null @@ -1 +0,0 @@ --Ycheck:typer
\ No newline at end of file diff --git a/tests/pending/pos/t4188.scala b/tests/pending/pos/t4188.scala index 40e7d4924..104473fc5 100644 --- a/tests/pending/pos/t4188.scala +++ b/tests/pending/pos/t4188.scala @@ -1,3 +1,4 @@ +// Fails Ycheck class A { object Ding class B { diff --git a/tests/pending/pos/t4579.flags b/tests/pending/pos/t4579.flags deleted file mode 100644 index 1182725e8..000000000 --- a/tests/pending/pos/t4579.flags +++ /dev/null @@ -1 +0,0 @@ --optimize
\ No newline at end of file diff --git a/tests/pending/pos/t4911.flags b/tests/pending/pos/t4911.flags deleted file mode 100644 index 779916d58..000000000 --- a/tests/pending/pos/t4911.flags +++ /dev/null @@ -1 +0,0 @@ --unchecked -Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t5029.flags b/tests/pending/pos/t5029.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t5029.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t5899.flags b/tests/pending/pos/t5899.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t5899.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t5932.flags b/tests/pending/pos/t5932.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t5932.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t6123-explaintypes-implicits.flags b/tests/pending/pos/t6123-explaintypes-implicits.flags deleted file mode 100644 index b36707c7c..000000000 --- a/tests/pending/pos/t6123-explaintypes-implicits.flags +++ /dev/null @@ -1 +0,0 @@ --explaintypes diff --git a/tests/pending/pos/t6994.flags b/tests/pending/pos/t6994.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t6994.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t7011.flags b/tests/pending/pos/t7011.flags deleted file mode 100644 index a4c161553..000000000 --- a/tests/pending/pos/t7011.flags +++ /dev/null @@ -1 +0,0 @@ --Ydebug -Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t7285a.flags b/tests/pending/pos/t7285a.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t7285a.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t7296.scala b/tests/pending/pos/t7296.scala index 0c078d365..fcba17c08 100644 --- a/tests/pending/pos/t7296.scala +++ b/tests/pending/pos/t7296.scala @@ -1,3 +1,4 @@ +// Fails Ycheck object Test { type A = Int // Emits the implementation restriction but then proceeds to crash diff --git a/tests/pending/pos/t762.scala b/tests/pending/pos/t762.scala deleted file mode 100644 index 76860272e..000000000 --- a/tests/pending/pos/t762.scala +++ /dev/null @@ -1,2 +0,0 @@ -trait Foo { type T } -trait Bar extends Foo { val x : Foo { type T <: Bar.this.T } = this : this.type } diff --git a/tests/pending/pos/t8187.check b/tests/pending/pos/t8187.check deleted file mode 100644 index e69de29bb..000000000 --- a/tests/pending/pos/t8187.check +++ /dev/null diff --git a/tests/pending/pos/t8364.check b/tests/pending/pos/t8364.check deleted file mode 100644 index e69de29bb..000000000 --- a/tests/pending/pos/t8364.check +++ /dev/null diff --git a/tests/pending/pos/t8369a.check b/tests/pending/pos/t8369a.check deleted file mode 100644 index e69de29bb..000000000 --- a/tests/pending/pos/t8369a.check +++ /dev/null diff --git a/tests/pending/pos/trait-force-info.flags b/tests/pending/pos/trait-force-info.flags deleted file mode 100644 index eb4d19bcb..000000000 --- a/tests/pending/pos/trait-force-info.flags +++ /dev/null @@ -1 +0,0 @@ --optimise
\ No newline at end of file diff --git a/tests/pending/pos/virtpatmat_alts_subst.flags b/tests/pending/pos/virtpatmat_alts_subst.flags deleted file mode 100644 index 3f5a3100e..000000000 --- a/tests/pending/pos/virtpatmat_alts_subst.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/tests/pending/pos/virtpatmat_exist1.flags b/tests/pending/pos/virtpatmat_exist1.flags deleted file mode 100644 index 3f5a3100e..000000000 --- a/tests/pending/pos/virtpatmat_exist1.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/tests/pending/pos/virtpatmat_exist3.flags b/tests/pending/pos/virtpatmat_exist3.flags deleted file mode 100644 index 3f5a3100e..000000000 --- a/tests/pending/pos/virtpatmat_exist3.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/tests/pending/run/t2337.check b/tests/pending/run/t2337.check deleted file mode 100644 index 18f1f66fc..000000000 --- a/tests/pending/run/t2337.check +++ /dev/null @@ -1,4 +0,0 @@ -(Both Int,-1,-1) -(Both Float,1,1) -(Float then Int,0,0) -(Int then Float,0,0) diff --git a/tests/pending/run/t3150.scala b/tests/pending/run/t3150.scala index 034703b5f..dc95af373 100644 --- a/tests/pending/run/t3150.scala +++ b/tests/pending/run/t3150.scala @@ -1,10 +1,26 @@ -object Test { - case object Bob { override def equals(other: Any) = true } - def f(x: Any) = x match { case Bob => Bob } - - def main(args: Array[String]): Unit = { - assert(f(Bob) eq Bob) - assert(f(0) eq Bob) - assert(f(Nil) eq Bob) - } -} + object Test { + case object Bob { override def equals(other: Any) = true } + + class Bob2 { + override def equals(other: Any) = true + } + val Bob2 = new Bob2 + + def f0(x: Any) = x match { case Bob2 => Bob2 } // class cast exception at runtime, dotc only + def f1(x: Any) = x match { case Bob => Bob } // class cast exception at runtime, dotc only + def f2(x: Any): Bob.type = x match { case x @ Bob => x } // class cast exception at runtime, dotc and javac. + + def main(args: Array[String]): Unit = { + assert(f0(Bob2) eq Bob2) + assert(f0(0) eq Bob2) // only dotty fails here + assert(f0(Nil) eq Bob2) + + assert(f1(Bob) eq Bob) + assert(f1(0) eq Bob) // only dotty fails here + assert(f1(Nil) eq Bob) + + assert(f2(Bob) eq Bob) + assert(f2(0) eq Bob) // both dotty and scalac fail here + assert(f2(Nil) eq Bob) + } + } diff --git a/tests/pending/run/unapply.check b/tests/pending/run/unapply.check deleted file mode 100644 index 847e3b381..000000000 --- a/tests/pending/run/unapply.check +++ /dev/null @@ -1,3 +0,0 @@ -unapply.scala:57: warning: comparing values of types Null and Null using `==' will always yield true - assert(doMatch2(b) == null) - ^ diff --git a/tests/pos-scala2/naming-resolution/callsite.scala b/tests/pos-scala2/naming-resolution/callsite.scala new file mode 100644 index 000000000..036803a26 --- /dev/null +++ b/tests/pos-scala2/naming-resolution/callsite.scala @@ -0,0 +1,10 @@ +// This one should be rejected according to spec. The import takes precedence +// over the type in the same package because the typeis declared in a +// different compilation unit. scalac does not conform to spec here. +package naming.resolution + +import java.nio.file._ // Imports `Files` + +object Resolution { + def gimmeFiles: Files = Files.list(Paths.get(".")) +} diff --git a/tests/pos-scala2/naming-resolution/package.scala b/tests/pos-scala2/naming-resolution/package.scala new file mode 100644 index 000000000..f0e26ee95 --- /dev/null +++ b/tests/pos-scala2/naming-resolution/package.scala @@ -0,0 +1,5 @@ +package naming + +package object resolution { + type Files = java.util.stream.Stream[java.nio.file.Path] +} diff --git a/tests/pending/run/t3050.scala b/tests/pos-scala2/t3050.scala index 160f8b664..160f8b664 100644 --- a/tests/pending/run/t3050.scala +++ b/tests/pos-scala2/t3050.scala diff --git a/tests/pending/pos/t7688.scala b/tests/pos-scala2/t7688.scala index 5a846b97e..5a846b97e 100644 --- a/tests/pending/pos/t7688.scala +++ b/tests/pos-scala2/t7688.scala diff --git a/tests/pending/pos/t8146a.scala b/tests/pos-special/t8146a.scala index e4eb8d3fd..e4eb8d3fd 100644 --- a/tests/pending/pos/t8146a.scala +++ b/tests/pos-special/t8146a.scala diff --git a/tests/pending/pos/apply-equiv.scala b/tests/pos/apply-equiv.scala index f53b8b5ab..f53b8b5ab 100644 --- a/tests/pending/pos/apply-equiv.scala +++ b/tests/pos/apply-equiv.scala diff --git a/tests/pos/dependent-implicits.scala b/tests/pos/dependent-implicits.scala new file mode 100644 index 000000000..17a323112 --- /dev/null +++ b/tests/pos/dependent-implicits.scala @@ -0,0 +1,7 @@ +object Test { + trait T { type X; val x: X } + implicit def f(x: T): x.X = x.x + val t = new T { type X = String; val x = "" } + val x: String = t + val uy: String = f(t) +} diff --git a/tests/pending/pos/extractor-types.scala b/tests/pos/extractor-types.scala index 200279be6..200279be6 100644 --- a/tests/pending/pos/extractor-types.scala +++ b/tests/pos/extractor-types.scala diff --git a/tests/pos/for-filter.scala b/tests/pos/for-filter.scala new file mode 100644 index 000000000..3baac4f0c --- /dev/null +++ b/tests/pos/for-filter.scala @@ -0,0 +1,12 @@ +object Test { + + case class C[T](xs: List[T]) { + def filter(p: T => Boolean) = new C(xs.filter(p)) + def map[U](f: T => U) = new C(xs.map(f)) + } + + def main(args: Array[String]): Unit = + println(for (x <- C(List(1, 2, 3)) if x % 2 == 0) yield x) + // println(C(List(1, 2, 3)).withFilter(_ % 2 == 0)) // error + +} diff --git a/tests/pending/pos/gadts2.scala b/tests/pos/gadts2.scala index b67bafb32..bdf1c8e8a 100644 --- a/tests/pending/pos/gadts2.scala +++ b/tests/pos/gadts2.scala @@ -8,7 +8,7 @@ object Test { case class Cell[a](var x: a) extends Term[a] final case class NumTerm(val n: Number) extends Term[Number] - def f[a](t: Term[a], c: Cell[a]): Unit = { + def f[A](t: Term[A], c: Cell[A]): Unit = { t match { case NumTerm(n) => c.x = MyDouble(1.0) } diff --git a/tests/pending/pos/hk-infer.scala b/tests/pos/hk-infer.scala index c23a9d151..c23a9d151 100644 --- a/tests/pending/pos/hk-infer.scala +++ b/tests/pos/hk-infer.scala diff --git a/tests/pending/pos/i743.scala b/tests/pos/i743.scala index 8fe522cee..8fe522cee 100644 --- a/tests/pending/pos/i743.scala +++ b/tests/pos/i743.scala diff --git a/tests/pending/import-rewrite/file.scala b/tests/pos/import-rewrite/file.scala index e52581e81..e52581e81 100644 --- a/tests/pending/import-rewrite/file.scala +++ b/tests/pos/import-rewrite/file.scala diff --git a/tests/pending/import-rewrite/rewrite.scala b/tests/pos/import-rewrite/rewrite.scala index 0bda02c5e..0bda02c5e 100644 --- a/tests/pending/import-rewrite/rewrite.scala +++ b/tests/pos/import-rewrite/rewrite.scala diff --git a/tests/pending/pos/infersingle.scala b/tests/pos/infersingle.scala index 60f4ff07e..60f4ff07e 100644 --- a/tests/pending/pos/infersingle.scala +++ b/tests/pos/infersingle.scala diff --git a/tests/pos/isApplicableSafe.scala b/tests/pos/isApplicableSafe.scala new file mode 100644 index 000000000..c54df1f22 --- /dev/null +++ b/tests/pos/isApplicableSafe.scala @@ -0,0 +1,54 @@ +import reflect.ClassTag + +// The same problems arise in real arrays. +class A { + + class Array[T] + object Array { + def apply[T: ClassTag](xs: T*): Array[T] = ??? + def apply(x: Int, xs: Int*): Array[Int] = ??? + } + + // Any of Array[List[Symbol]], List[Array[Symbol]], or List[List[Symbol]] compile. + var xs: Array[Array[Symbol]] = _ + var ys: Array[Map[Symbol, Set[Symbol]]] = _ + + //xs = Array(Array()) + // gives: + // + // isApplicableSafe.scala:15: error: type mismatch: + // found : A.this.Array[Nothing] + // required: A.this.Array[Symbol] + // xs = Array(Array()) + // + // Here's the sequence of events that leads to this problem: + // + // 1. the outer Array.apply is overloaded, so we need to typecheck the inner one + // without an expected prototype + // + // 2. The inner Array.apply needs a ClassTag, so we need to instantiate + // its type variable, and the best instantiation is Nothing. + // + // To prevent this, we'd need to do several things: + // + // 1. Pass argument types lazily into the isApplicable call in resolveOverloaded, + // so that we can call constrainResult before any arguments are evaluated. + // + // 2. This is still not enough because the result type is initially an IgnoredProto. + // (because an implicit might have to be inserted around the call, so we cannot + // automatically assume that the call result is a subtype of the expected type). + // Hence, we need to somehow create a closure in constrainResult that does the + // comparison with the real expected result type "on demand". + // + // 3. When instantiating a type variable we need to categorize that some instantiations + // are suspicous (e.g. scalac avoids instantiating to Nothing). In these + // circumstances we should try to excute the delayed constrainResult closures + // in order to get a better instance type. + // + // Quite a lot of work. It's looking really complicated to fix this. + + + ys = Array(Map(), Map()) + + val zs = Array(Map()) +} diff --git a/tests/pending/pos/lazyvals.scala b/tests/pos/lazyvals.scala index 93a82cd0c..93a82cd0c 100644 --- a/tests/pending/pos/lazyvals.scala +++ b/tests/pos/lazyvals.scala diff --git a/tests/pending/pos/matthias4.scala b/tests/pos/matthias4.scala index 18599ae71..18599ae71 100644 --- a/tests/pending/pos/matthias4.scala +++ b/tests/pos/matthias4.scala diff --git a/tests/pending/pos/mixins.scala b/tests/pos/mixins.scala index 846d6a41b..846d6a41b 100644 --- a/tests/pending/pos/mixins.scala +++ b/tests/pos/mixins.scala diff --git a/tests/pending/pos/return_thistype.scala b/tests/pos/return_thistype.scala index c0736c0ad..c0736c0ad 100644 --- a/tests/pending/pos/return_thistype.scala +++ b/tests/pos/return_thistype.scala diff --git a/tests/pos/t1500a.scala b/tests/pos/t1500a.scala new file mode 100644 index 000000000..adf46329a --- /dev/null +++ b/tests/pos/t1500a.scala @@ -0,0 +1,28 @@ +trait Step0 +trait Step1 +trait Step2 +trait Step3 +trait Step4 +trait Step5 +trait Step6 + +object Steps { + implicit val Step0: Step0 = new Step0 {} + implicit def Step1(implicit p: Step0): Step1 = new Step1 {} + implicit def Step2(implicit p: Step1): Step2 = new Step2 {} + implicit def Step3(implicit p: Step2): Step3 = new Step3 {} + implicit def Step4(implicit p: Step3): Step4 = new Step4 {} + implicit def Step5(implicit p: Step4): Step5 = new Step5 {} + implicit def Step6(implicit p: Step5): Step6 = new Step6 {} +} + +object StepsTest { + import Steps._ + + implicitly[Step0] + implicitly[Step1] + implicitly[Step2] + implicitly[Step3] + implicitly[Step4] + implicitly[Step6] +} diff --git a/tests/pos/t1513a.scala b/tests/pos/t1513a.scala new file mode 100644 index 000000000..3c4c02376 --- /dev/null +++ b/tests/pos/t1513a.scala @@ -0,0 +1,36 @@ +object Test { + // Heterogeneous lists and natural numbers as defined in shapeless. + + sealed trait HList + sealed trait ::[H, T <: HList] extends HList + sealed trait HNil extends HList + + sealed trait Nat + sealed trait Succ[P <: Nat] extends Nat + sealed trait Zero extends Nat + + // Accessor type class to compute the N'th element of an HList L. + + trait Accessor[L <: HList, N <: Nat] { type Out } + object Accessor { + type Aux[L <: HList, N <: Nat, O] = Accessor[L, N] { type Out = O } + + // (H :: T).At[Zero] = H + implicit def caseZero[H, T <: HList]: Aux[H :: T, Zero, H] = ??? + + // T.At[N] = O => (H :: T).At[Succ[N]] = O + implicit def caseN[H, T <: HList, N <: Nat, O] + (implicit a: Aux[T, N, O]): Aux[H :: T, Succ[N], O] = ??? + } + + case class Proxy[T]() + + def at1[NN <: Nat, OO] (implicit e: Accessor.Aux[String :: HNil, NN, OO]): OO = ??? + def at2[NN <: Nat, OO](p: Proxy[NN])(implicit e: Accessor.Aux[String :: HNil, NN, OO]): OO = ??? + + // N is fixed by a value + at2(Proxy[Zero]): String + + // N is fixed as a type parameter (by name) + at1[NN = Zero]: String +} diff --git a/tests/pos/t1513b.scala b/tests/pos/t1513b.scala new file mode 100644 index 000000000..546649383 --- /dev/null +++ b/tests/pos/t1513b.scala @@ -0,0 +1,25 @@ +object Test { + def f[ + T1 <: String, + T2 <: Int, + T3 <: Boolean + ](a1: T1, a2: T2, a3: T3) = () + + f ("", 1, true) + f[T1 = String] ("", 1, true) + f[T2 = Int] ("", 1, true) + f[T3 = Boolean] ("", 1, true) + f[T1 = String, T2 = Int] ("", 1, true) + f[T1 = String, T3 = Boolean] ("", 1, true) + f[T2 = Int, T1 = String] ("", 1, true) + f[T2 = Int, T3 = Boolean] ("", 1, true) + f[T3 = Boolean, T2 = Int] ("", 1, true) + f[T3 = Boolean, T1 = String] ("", 1, true) + f[T1 = String, T2 = Int, T3 = Boolean]("", 1, true) + f[T1 = String, T3 = Boolean, T2 = Int] ("", 1, true) + f[T2 = Int, T1 = String, T3 = Boolean]("", 1, true) + f[T2 = Int, T3 = Boolean, T1 = String] ("", 1, true) + f[T3 = Boolean, T1 = String, T2 = Int] ("", 1, true) + f[T3 = Boolean, T2 = Int, T1 = String] ("", 1, true) + f[String, Int, Boolean] ("", 1, true) +} diff --git a/tests/pending/pos/t3494.scala b/tests/pos/t3494.scala index dd54b0f82..dd54b0f82 100644 --- a/tests/pending/pos/t3494.scala +++ b/tests/pos/t3494.scala diff --git a/tests/pending/pos/t3800.scala b/tests/pos/t3800.scala index 096502174..096502174 100644 --- a/tests/pending/pos/t3800.scala +++ b/tests/pos/t3800.scala diff --git a/tests/pending/pos/t3862.scala b/tests/pos/t3862.scala index 0d978caa4..0d978caa4 100644 --- a/tests/pending/pos/t3862.scala +++ b/tests/pos/t3862.scala diff --git a/tests/pending/pos/t3880.scala b/tests/pos/t3880.scala index f778eb71a..f778eb71a 100644 --- a/tests/pending/pos/t3880.scala +++ b/tests/pos/t3880.scala diff --git a/tests/pending/pos/t3999/a_1.scala b/tests/pos/t3999/a_1.scala index be9cc371e..7ef67bba4 100644 --- a/tests/pending/pos/t3999/a_1.scala +++ b/tests/pos/t3999/a_1.scala @@ -4,6 +4,6 @@ class Outside package object bar { class Val(b: Boolean) - implicit def boolean2Val(b: Boolean): foo.bar.package.Val = new Val(b) + implicit def boolean2Val(b: Boolean): foo.bar.`package`.Val = new Val(b) implicit def boolean2Outside(b: Boolean): foo.Outside = new Outside } diff --git a/tests/pending/pos/t3999/b_2.scala b/tests/pos/t3999/b_2.scala index 775b839d9..775b839d9 100644 --- a/tests/pending/pos/t3999/b_2.scala +++ b/tests/pos/t3999/b_2.scala diff --git a/tests/pending/pos/t4269.scala b/tests/pos/t4269.scala index fe0c20103..fe0c20103 100644 --- a/tests/pending/pos/t4269.scala +++ b/tests/pos/t4269.scala diff --git a/tests/pos/t5070.scala b/tests/pos/t5070.scala new file mode 100644 index 000000000..410afba14 --- /dev/null +++ b/tests/pos/t5070.scala @@ -0,0 +1,15 @@ +trait A { + type T +} + +object O { + implicit def b(implicit x: A): x.T = error("") +} + +class Test { + import O._ + implicit val a: A = new A {} + implicitly[a.T] // works + + implicitly[a.T](b(a)) // works +} diff --git a/tests/pending/pos/t5330.scala b/tests/pos/t5330.scala index 24aab7733..24aab7733 100644 --- a/tests/pending/pos/t5330.scala +++ b/tests/pos/t5330.scala diff --git a/tests/pending/pos/t5604/ReplConfig.scala b/tests/pos/t5604/ReplConfig.scala index 8c589eba6..8c589eba6 100644 --- a/tests/pending/pos/t5604/ReplConfig.scala +++ b/tests/pos/t5604/ReplConfig.scala diff --git a/tests/pending/pos/t5604/ReplReporter.scala b/tests/pos/t5604/ReplReporter.scala index 9423efd8a..9423efd8a 100644 --- a/tests/pending/pos/t5604/ReplReporter.scala +++ b/tests/pos/t5604/ReplReporter.scala diff --git a/tests/pending/pos/t5726.scala b/tests/pos/t5726.scala index 1ef14ac79..1ef14ac79 100644 --- a/tests/pending/pos/t5726.scala +++ b/tests/pos/t5726.scala diff --git a/tests/pending/pos/t5769.scala b/tests/pos/t5769.scala index d7ec23a56..d7ec23a56 100644 --- a/tests/pending/pos/t5769.scala +++ b/tests/pos/t5769.scala diff --git a/tests/pending/pos/t578.scala b/tests/pos/t578.scala index 6f95dd8ce..6f95dd8ce 100644 --- a/tests/pending/pos/t578.scala +++ b/tests/pos/t578.scala diff --git a/tests/pending/pos/t5899.scala b/tests/pos/t5899.scala index 852b4e3e7..852b4e3e7 100644 --- a/tests/pending/pos/t5899.scala +++ b/tests/pos/t5899.scala diff --git a/tests/pending/pos/t6084.scala b/tests/pos/t6084.scala index 1aa1fed39..1aa1fed39 100644 --- a/tests/pending/pos/t6084.scala +++ b/tests/pos/t6084.scala diff --git a/tests/pending/pos/t6722.scala b/tests/pos/t6722.scala index 576746c91..576746c91 100644 --- a/tests/pending/pos/t6722.scala +++ b/tests/pos/t6722.scala diff --git a/tests/pending/pos/t6815_import.scala b/tests/pos/t6815_import.scala index 56f4358d5..56f4358d5 100644 --- a/tests/pending/pos/t6815_import.scala +++ b/tests/pos/t6815_import.scala diff --git a/tests/pending/pos/t6948.scala b/tests/pos/t6948.scala index 12a1d7eaf..12a1d7eaf 100644 --- a/tests/pending/pos/t6948.scala +++ b/tests/pos/t6948.scala diff --git a/tests/pending/pos/t7294.scala b/tests/pos/t7294.scala index ccac2b140..ccac2b140 100644 --- a/tests/pending/pos/t7294.scala +++ b/tests/pos/t7294.scala diff --git a/tests/pending/pos/t7426.scala b/tests/pos/t7426.scala index 8e42ad181..8e42ad181 100644 --- a/tests/pending/pos/t7426.scala +++ b/tests/pos/t7426.scala diff --git a/tests/pending/pos/t7517.scala b/tests/pos/t7517.scala index d0462c48d..d0462c48d 100644 --- a/tests/pending/pos/t7517.scala +++ b/tests/pos/t7517.scala diff --git a/tests/pos/t762.scala b/tests/pos/t762.scala new file mode 100644 index 000000000..c5bf39b0c --- /dev/null +++ b/tests/pos/t762.scala @@ -0,0 +1,4 @@ +trait Foo { type T } +trait Bar1 extends Foo { val x : Foo { type T <: Bar1.this.T } = this } +trait Bar2 extends Foo { val x : Foo { type T = Bar2.this.T } = this } +trait Bar3 extends Foo { val x : Foo { type T >: Bar3.this.T } = this } diff --git a/tests/pending/pos/t7668.scala b/tests/pos/t7668.scala index 222a13d03..6657ffab6 100644 --- a/tests/pending/pos/t7668.scala +++ b/tests/pos/t7668.scala @@ -8,5 +8,5 @@ trait Extractor { } class Sub extends Extractor { - def extract(s: Space) = s.x + def extract(ss: Space) = ss.x } diff --git a/tests/pending/pos/t7902.scala b/tests/pos/t7902.scala index 7793d3723..7793d3723 100644 --- a/tests/pending/pos/t7902.scala +++ b/tests/pos/t7902.scala diff --git a/tests/pending/pos/t8046c.scala b/tests/pos/t8046c.scala index f05b4c15b..f05b4c15b 100644 --- a/tests/pending/pos/t8046c.scala +++ b/tests/pos/t8046c.scala diff --git a/tests/pending/pos/t807.scala b/tests/pos/t807.scala index 0eeb92ea2..0eeb92ea2 100644 --- a/tests/pending/pos/t807.scala +++ b/tests/pos/t807.scala diff --git a/tests/pending/pos/t8300-patmat-a.scala b/tests/pos/t8300-patmat-a.scala index ab3a3c960..ab3a3c960 100644 --- a/tests/pending/pos/t8300-patmat-a.scala +++ b/tests/pos/t8300-patmat-a.scala diff --git a/tests/pending/pos/t8300-patmat-b.scala b/tests/pos/t8300-patmat-b.scala index 0acad4406..0acad4406 100644 --- a/tests/pending/pos/t8300-patmat-b.scala +++ b/tests/pos/t8300-patmat-b.scala diff --git a/tests/pending/pos/t8301b.scala b/tests/pos/t8301b.scala index 4dd39139d..4dd39139d 100644 --- a/tests/pending/pos/t8301b.scala +++ b/tests/pos/t8301b.scala diff --git a/tests/pending/pos/t8364.scala b/tests/pos/t8364.scala index 7a7ea1ff1..7a7ea1ff1 100644 --- a/tests/pending/pos/t8364.scala +++ b/tests/pos/t8364.scala diff --git a/tests/pending/pos/trait-force-info.scala b/tests/pos/trait-force-info.scala index c2b33869c..c2b33869c 100644 --- a/tests/pending/pos/trait-force-info.scala +++ b/tests/pos/trait-force-info.scala diff --git a/tests/pos/tryWithoutHandler.scala b/tests/pos/tryWithoutHandler.scala new file mode 100644 index 000000000..ffe334984 --- /dev/null +++ b/tests/pos/tryWithoutHandler.scala @@ -0,0 +1,7 @@ +object Test { + def main(args: Array[String]): Unit = { + try { + println("hello") + } + } +} diff --git a/tests/pending/run/applydynamic_sip.check b/tests/run/applydynamic_sip.check index 6d04dc452..6d04dc452 100644 --- a/tests/pending/run/applydynamic_sip.check +++ b/tests/run/applydynamic_sip.check diff --git a/tests/pending/run/applydynamic_sip.flags b/tests/run/applydynamic_sip.flags index ba6d37305..ba6d37305 100644 --- a/tests/pending/run/applydynamic_sip.flags +++ b/tests/run/applydynamic_sip.flags diff --git a/tests/pending/run/applydynamic_sip.scala b/tests/run/applydynamic_sip.scala index a163ab960..7f81a644a 100644 --- a/tests/pending/run/applydynamic_sip.scala +++ b/tests/run/applydynamic_sip.scala @@ -1,3 +1,4 @@ +import scala.language.dynamics object Test extends dotty.runtime.LegacyApp { object stubUpdate { def update(as: Any*) = println(".update"+as.toList.mkString("(",", ", ")")) diff --git a/tests/pending/run/dynamic-anyval.check b/tests/run/dynamic-anyval.check index dee7bef8e..dee7bef8e 100644 --- a/tests/pending/run/dynamic-anyval.check +++ b/tests/run/dynamic-anyval.check diff --git a/tests/pending/run/dynamic-anyval.scala b/tests/run/dynamic-anyval.scala index 605503d37..605503d37 100644 --- a/tests/pending/run/dynamic-anyval.scala +++ b/tests/run/dynamic-anyval.scala diff --git a/tests/run/dynamicDynamicTests.scala b/tests/run/dynamicDynamicTests.scala index 3f8da8298..05b878f1c 100644 --- a/tests/run/dynamicDynamicTests.scala +++ b/tests/run/dynamicDynamicTests.scala @@ -23,7 +23,16 @@ class Baz extends scala.Dynamic { def updateDynamic(name: String)(value: String): String = "updateDynamic(" + name + ")(" + value + ")" } +class Qux extends scala.Dynamic { + def selectDynamic[T](name: String): String = "selectDynamic(" + name + ")" + def applyDynamic[T](name: String)(args: String*): String = "applyDynamic(" + name + ")" + args.mkString("(", ", ", ")") + def applyDynamicNamed[T](name: String)(args: (String, Any)*): String = "applyDynamicNamed(" + name + ")" + args.mkString("(", ", ", ")") + def updateDynamic[T](name: String)(value: T): String = "updateDynamic(" + name + ")(" + value + ")" +} + object Test { + val qux = new Qux + implicit class StringUpdater(str: String) { def update(name: String, v: String) = s"$str.update(" + name + ", " + v + ")" } @@ -42,6 +51,7 @@ object Test { runFooTests2() runBarTests() runBazTests() + runQuxTests() assert(!failed) } @@ -161,4 +171,35 @@ object Test { assertEquals("selectDynamic(bazSelectUpdate).update(7, value)", baz.bazSelectUpdate(7) = "value") assertEquals("selectDynamic(bazSelectUpdate).update(7, 10)", baz.bazSelectUpdate(7) = 10) } + + /** Test correct lifting of type parameters */ + def runQuxTests() = { + implicit def intToString(n: Int): String = n.toString + + val qux = new Qux + + assertEquals("selectDynamic(quxSelect)", qux.quxSelect) + assertEquals("selectDynamic(quxSelect)", qux.quxSelect[Int]) + + assertEquals("applyDynamic(quxApply)()", qux.quxApply()) + assertEquals("applyDynamic(quxApply)()", qux.quxApply[Int]()) + assertEquals("applyDynamic(quxApply)(1)", qux.quxApply(1)) + assertEquals("applyDynamic(quxApply)(1)", qux.quxApply[Int](1)) + assertEquals("applyDynamic(quxApply)(1, 2, 3)", qux.quxApply(1, 2, 3)) + assertEquals("applyDynamic(quxApply)(1, 2, 3)", qux.quxApply[Int](1, 2, 3)) + assertEquals("applyDynamic(quxApply)(1, 2, a)", qux.quxApply(1, 2, "a")) + assertEquals("applyDynamic(quxApply)(1, 2, a)", qux.quxApply[Int](1, 2, "a")) + + assertEquals("applyDynamicNamed(quxApplyNamed)((a,1))", qux.quxApplyNamed(a = 1)) + assertEquals("applyDynamicNamed(quxApplyNamed)((a,1))", qux.quxApplyNamed[Int](a = 1)) + assertEquals("applyDynamicNamed(quxApplyNamed)((a,1), (b,2))", qux.quxApplyNamed(a = 1, b = "2")) + assertEquals("applyDynamicNamed(quxApplyNamed)((a,1), (b,2))", qux.quxApplyNamed[Int](a = 1, b = "2")) + assertEquals("applyDynamicNamed(quxApplyNamed)((a,1), (,abc))", qux.quxApplyNamed(a = 1, "abc")) + assertEquals("applyDynamicNamed(quxApplyNamed)((a,1), (,abc))", qux.quxApplyNamed[Int](a = 1, "abc")) + + assertEquals("updateDynamic(quxUpdate)(abc)", qux.quxUpdate = "abc") + + assertEquals("selectDynamic(quxSelectUpdate).update(key, value)", qux.quxSelectUpdate("key") = "value") + assertEquals("selectDynamic(quxSelectUpdate).update(key, value)", qux.quxSelectUpdate[Int]("key") = "value") + } } diff --git a/tests/run/i1490.check b/tests/run/i1490.check new file mode 100644 index 000000000..9e8a46acf --- /dev/null +++ b/tests/run/i1490.check @@ -0,0 +1,3 @@ +true +true +false diff --git a/tests/run/i1490.scala b/tests/run/i1490.scala new file mode 100644 index 000000000..554bc3940 --- /dev/null +++ b/tests/run/i1490.scala @@ -0,0 +1,13 @@ +class Base { + type T = Int | Boolean + def test(x: Object) = x.isInstanceOf[T] +} + +object Test { + def main(args: Array[String]) = { + val b = new Base + println(b.test(Int.box(3))) + println(b.test(Boolean.box(false))) + println(b.test(Double.box(3.4))) + } +}
\ No newline at end of file diff --git a/tests/run/i1503.check b/tests/run/i1503.check new file mode 100644 index 000000000..8cc0be027 --- /dev/null +++ b/tests/run/i1503.check @@ -0,0 +1,5 @@ +hello +hi +33 +hi +hi diff --git a/tests/run/i1503.scala b/tests/run/i1503.scala new file mode 100644 index 000000000..56bb9af0c --- /dev/null +++ b/tests/run/i1503.scala @@ -0,0 +1,38 @@ +object Test { + + def test1() = + (new Function0[Unit] { + def apply() = println("hello") + })() + + val cond = true + val foo = () => println("hi") + val bar = () => println("there") + + val baz = (x: Int) => println(x) + + def test2() = + (if (cond) foo else bar)() + + def test2a() = + (if (cond) baz else baz)(33) + + def test3() = + (try foo + catch { case ex: Exception => bar } + finally ())() + + def test4() = + (cond match { + case true => foo + case false => bar + })() + + def main(args: Array[String]) = { + test1() + test2() + test2a() + test3() + test4() + } +} diff --git a/tests/run/t1335.scala b/tests/run/t1335.scala new file mode 100644 index 000000000..047f7b566 --- /dev/null +++ b/tests/run/t1335.scala @@ -0,0 +1,11 @@ +case class MyTuple(a: Int, b: Int) + +object Test { + def main(args: Array[String]): Unit = + try { + val mt: MyTuple = null + val MyTuple(a, b) = mt + } catch { + case e: MatchError => () + } +} diff --git a/tests/run/t1500b.scala b/tests/run/t1500b.scala new file mode 100644 index 000000000..8b52731a5 --- /dev/null +++ b/tests/run/t1500b.scala @@ -0,0 +1,21 @@ +sealed trait Nat +sealed trait Succ[Prev <: Nat] extends Nat +sealed trait Zero extends Nat + +case class ToInt[N <: Nat](value: Int) + +object ToInt { + implicit val caseZero: ToInt[Zero] = ToInt(0) + implicit def caseSucc[Prev <: Nat](implicit e: ToInt[Prev]): ToInt[Succ[Prev]] = ToInt(e.value + 1) +} + +object Test { + def main(args: Array[String]): Unit = { + assert(implicitly[ToInt[Zero]].value == 0) + assert(implicitly[ToInt[Succ[Zero]]].value == 1) + assert(implicitly[ToInt[Succ[Succ[Zero]]]].value == 2) + assert(implicitly[ToInt[Succ[Succ[Succ[Zero]]]]].value == 3) + assert(implicitly[ToInt[Succ[Succ[Succ[Succ[Zero]]]]]].value == 4) + assert(implicitly[ToInt[Succ[Succ[Succ[Succ[Succ[Zero]]]]]]].value == 5) + } +} diff --git a/tests/run/t1500c.scala b/tests/run/t1500c.scala new file mode 100644 index 000000000..5c33b7a2f --- /dev/null +++ b/tests/run/t1500c.scala @@ -0,0 +1,19 @@ +sealed trait HList +sealed trait HNil extends HList +sealed trait ::[H, T <: HList] extends HList + +case class Size[L <: HList](value: Int) + +object Size { + implicit val caseHNil: Size[HNil] = Size(0) + implicit def caseHCons[H, T <: HList](implicit e: Size[T]): Size[H :: T] = Size(e.value + 1) +} + +object Test { + def main(args: Array[String]): Unit = { + assert(implicitly[Size[HNil]].value == 0) + assert(implicitly[Size[Int :: HNil]].value == 1) + assert(implicitly[Size[Int :: Int :: HNil]].value == 2) + assert(implicitly[Size[Int :: Int :: Int :: HNil]].value == 3) + } +} diff --git a/tests/pending/run/t298.check b/tests/run/t298.check index 1cd1d2266..1cd1d2266 100644 --- a/tests/pending/run/t298.check +++ b/tests/run/t298.check diff --git a/tests/pending/run/t298.scala b/tests/run/t298.scala index 5728bb6c9..5728bb6c9 100644 --- a/tests/pending/run/t298.scala +++ b/tests/run/t298.scala diff --git a/tests/pending/run/t3026.check b/tests/run/t3026.check index 8c29b615f..8c29b615f 100644 --- a/tests/pending/run/t3026.check +++ b/tests/run/t3026.check diff --git a/tests/pending/run/t3026.scala b/tests/run/t3026.scala index 22dde9cc0..22dde9cc0 100755 --- a/tests/pending/run/t3026.scala +++ b/tests/run/t3026.scala diff --git a/tests/pending/run/t3353.check b/tests/run/t3353.check index 8b4ae1fe6..8b4ae1fe6 100644 --- a/tests/pending/run/t3353.check +++ b/tests/run/t3353.check diff --git a/tests/pending/run/t3353.scala b/tests/run/t3353.scala index 472723b3c..472723b3c 100644 --- a/tests/pending/run/t3353.scala +++ b/tests/run/t3353.scala diff --git a/tests/pending/run/t4536.check b/tests/run/t4536.check index 0c5a72ada..0c5a72ada 100644 --- a/tests/pending/run/t4536.check +++ b/tests/run/t4536.check diff --git a/tests/pending/run/t4536.flags b/tests/run/t4536.flags index 1141f9750..1141f9750 100644 --- a/tests/pending/run/t4536.flags +++ b/tests/run/t4536.flags diff --git a/tests/pending/run/t4536.scala b/tests/run/t4536.scala index 6661eae6a..89a93a5e0 100644 --- a/tests/pending/run/t4536.scala +++ b/tests/run/t4536.scala @@ -1,8 +1,4 @@ - - - - - +import scala.language.dynamics object dynamicObject extends Dynamic { def applyDynamic(m: String)() = println("obj: " + m); @@ -38,7 +34,7 @@ object dynamicMixin extends dynamicAbstractClass with dynamicTrait { object Test { - def main(args: Array[String]) { + def main(args: Array[String]) = { val cls = new dynamicClass dynamicMixin } diff --git a/tests/pending/run/t5040.check b/tests/run/t5040.check index 3f7b5908a..3f7b5908a 100644 --- a/tests/pending/run/t5040.check +++ b/tests/run/t5040.check diff --git a/tests/pending/run/t5040.flags b/tests/run/t5040.flags index 1141f9750..1141f9750 100644 --- a/tests/pending/run/t5040.flags +++ b/tests/run/t5040.flags diff --git a/tests/pending/run/t5040.scala b/tests/run/t5040.scala index 6813c1b27..58d054412 100644 --- a/tests/pending/run/t5040.scala +++ b/tests/run/t5040.scala @@ -1,3 +1,4 @@ +import scala.language.dynamics // originaly used the flag -language:dynamics in t5040.flags, .flags are currently ignored abstract class Prova2 extends Dynamic { def applyDynamic(m: String)(): Unit private def privateMethod() = println("private method") diff --git a/tests/pending/run/t5733.check b/tests/run/t5733.check index e697046a9..e697046a9 100644 --- a/tests/pending/run/t5733.check +++ b/tests/run/t5733.check diff --git a/tests/pending/run/t5733.scala b/tests/run/t5733.scala index a9e58d77e..a9e58d77e 100644 --- a/tests/pending/run/t5733.scala +++ b/tests/run/t5733.scala diff --git a/tests/pending/run/t6353.check b/tests/run/t6353.check index 5676bed24..5676bed24 100644 --- a/tests/pending/run/t6353.check +++ b/tests/run/t6353.check diff --git a/tests/pending/run/t6353.scala b/tests/run/t6353.scala index 7077eaeda..7077eaeda 100644 --- a/tests/pending/run/t6353.scala +++ b/tests/run/t6353.scala diff --git a/tests/pending/run/t6355.check b/tests/run/t6355.check index ce74ab38a..ce74ab38a 100644 --- a/tests/pending/run/t6355.check +++ b/tests/run/t6355.check diff --git a/tests/pending/run/t6355.scala b/tests/run/t6355.scala index f1921391a..f1921391a 100644 --- a/tests/pending/run/t6355.scala +++ b/tests/run/t6355.scala diff --git a/tests/pending/run/t6663.check b/tests/run/t6663.check index d81cc0710..d81cc0710 100644 --- a/tests/pending/run/t6663.check +++ b/tests/run/t6663.check diff --git a/tests/pending/run/t6663.flags b/tests/run/t6663.flags index ea7fc37e1..ea7fc37e1 100644 --- a/tests/pending/run/t6663.flags +++ b/tests/run/t6663.flags diff --git a/tests/pending/run/t6663.scala b/tests/run/t6663.scala index bfe464ad6..bfe464ad6 100644 --- a/tests/pending/run/t6663.scala +++ b/tests/run/t6663.scala diff --git a/tests/pending/run/unapply.scala b/tests/run/unapply.scala index 43f02b9f3..7b10030ba 100644 --- a/tests/pending/run/unapply.scala +++ b/tests/run/unapply.scala @@ -87,8 +87,8 @@ object Mas { object LisSeqArr { def run(): Unit = { - assert((1,2) == ((List(1,2,3): Any) match { case List(x,y,_*) => (x,y)})) - assert((1,2) == ((List(1,2,3): Any) match { case Seq(x,y,_*) => (x,y)})) + assert((1,2) == ((List(1,2,3): Any) match { case List(x,y,_: _*) => (x,y)})) + assert((1,2) == ((List(1,2,3): Any) match { case Seq(x,y,_: _*) => (x,y)})) } } diff --git a/tests/untried/neg/applydynamic_sip.check b/tests/untried/neg/applydynamic_sip.check deleted file mode 100644 index 2cb2e7f09..000000000 --- a/tests/untried/neg/applydynamic_sip.check +++ /dev/null @@ -1,73 +0,0 @@ -applydynamic_sip.scala:7: error: applyDynamic does not support passing a vararg parameter - qual.sel(a, a2: _*) - ^ -applydynamic_sip.scala:8: error: applyDynamicNamed does not support passing a vararg parameter - qual.sel(arg = a, a2: _*) - ^ -applydynamic_sip.scala:8: error: not found: value arg - qual.sel(arg = a, a2: _*) - ^ -applydynamic_sip.scala:9: error: applyDynamicNamed does not support passing a vararg parameter - qual.sel(arg, arg2 = "a2", a2: _*) - ^ -applydynamic_sip.scala:9: error: not found: value arg - qual.sel(arg, arg2 = "a2", a2: _*) - ^ -applydynamic_sip.scala:9: error: not found: value arg2 - qual.sel(arg, arg2 = "a2", a2: _*) - ^ -applydynamic_sip.scala:18: error: type mismatch; - found : String("sel") - required: Int -error after rewriting to Test.this.bad1.selectDynamic("sel") -possible cause: maybe a wrong Dynamic method signature? - bad1.sel - ^ -applydynamic_sip.scala:19: error: type mismatch; - found : String("sel") - required: Int -error after rewriting to Test.this.bad1.applyDynamic("sel") -possible cause: maybe a wrong Dynamic method signature? - bad1.sel(1) - ^ -applydynamic_sip.scala:20: error: type mismatch; - found : String("sel") - required: Int -error after rewriting to Test.this.bad1.applyDynamicNamed("sel") -possible cause: maybe a wrong Dynamic method signature? - bad1.sel(a = 1) - ^ -applydynamic_sip.scala:20: error: reassignment to val - bad1.sel(a = 1) - ^ -applydynamic_sip.scala:21: error: type mismatch; - found : String("sel") - required: Int -error after rewriting to Test.this.bad1.updateDynamic("sel") -possible cause: maybe a wrong Dynamic method signature? - bad1.sel = 1 - ^ -applydynamic_sip.scala:29: error: Int does not take parameters -error after rewriting to Test.this.bad2.selectDynamic("sel") -possible cause: maybe a wrong Dynamic method signature? - bad2.sel - ^ -applydynamic_sip.scala:30: error: Int does not take parameters -error after rewriting to Test.this.bad2.applyDynamic("sel") -possible cause: maybe a wrong Dynamic method signature? - bad2.sel(1) - ^ -applydynamic_sip.scala:31: error: Int does not take parameters -error after rewriting to Test.this.bad2.applyDynamicNamed("sel") -possible cause: maybe a wrong Dynamic method signature? - bad2.sel(a = 1) - ^ -applydynamic_sip.scala:31: error: reassignment to val - bad2.sel(a = 1) - ^ -applydynamic_sip.scala:32: error: Int does not take parameters -error after rewriting to Test.this.bad2.updateDynamic("sel") -possible cause: maybe a wrong Dynamic method signature? - bad2.sel = 1 - ^ -16 errors found diff --git a/tests/untried/neg/applydynamic_sip.scala b/tests/untried/neg/applydynamic_sip.scala deleted file mode 100644 index ee4432ebe..000000000 --- a/tests/untried/neg/applydynamic_sip.scala +++ /dev/null @@ -1,33 +0,0 @@ -object Test extends App { - val qual: Dynamic = ??? - val expr = "expr" - val a = "a" - val a2 = "a2" - - qual.sel(a, a2: _*) - qual.sel(arg = a, a2: _*) - qual.sel(arg, arg2 = "a2", a2: _*) - - val bad1 = new Dynamic { - def selectDynamic(n: Int) = n - def applyDynamic(n: Int) = n - def applyDynamicNamed(n: Int) = n - def updateDynamic(n: Int) = n - - } - bad1.sel - bad1.sel(1) - bad1.sel(a = 1) - bad1.sel = 1 - - val bad2 = new Dynamic { - def selectDynamic = 1 - def applyDynamic = 1 - def applyDynamicNamed = 1 - def updateDynamic = 1 - } - bad2.sel - bad2.sel(1) - bad2.sel(a = 1) - bad2.sel = 1 -} |