diff options
author | Dmitry Petrashko <dark@d-d.me> | 2014-05-20 16:04:39 +0200 |
---|---|---|
committer | Dmitry Petrashko <dark@d-d.me> | 2014-05-20 16:04:39 +0200 |
commit | deea15e9b0c56b7f55f5e40665d5e00baef4f028 (patch) | |
tree | bfb268ddfb648c4e3bba5081494f6bc0f506fe20 | |
parent | 8a4186ff782efefb98686aa35bf7f5dd1418210d (diff) | |
parent | 6b090d1204b5ee553cf9f04b83e48904dcd88183 (diff) | |
download | dotty-deea15e9b0c56b7f55f5e40665d5e00baef4f028.tar.gz dotty-deea15e9b0c56b7f55f5e40665d5e00baef4f028.tar.bz2 dotty-deea15e9b0c56b7f55f5e40665d5e00baef4f028.zip |
Merge pull request #133 from dotty-staging/more-tests
More tests
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/CheckTrees.scala | 1 | ||||
-rw-r--r-- | src/dotty/tools/dotc/config/Printers.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TyperState.scala | 54 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 21 | ||||
-rw-r--r-- | src/dotty/tools/dotc/printing/PlainPrinter.scala | 7 | ||||
-rw-r--r-- | src/dotty/tools/dotc/printing/RefinedPrinter.scala | 23 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/ConsoleReporter.scala | 15 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/Reporter.scala | 166 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/StoreReporter.scala | 15 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/ThrowingReporter.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/UniqueMessagePositions.scala | 10 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/Erasure.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 46 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/ErrorReporting.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Implicits.scala | 14 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 12 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/ProtoTypes.scala | 54 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/TypeAssigner.scala | 12 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 100 | ||||
-rw-r--r-- | test/dotc/tests.scala | 9 | ||||
-rw-r--r-- | test/test/CompilerTest.scala | 2 | ||||
-rw-r--r-- | test/test/ContextEscapeDetection.java | 4 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1409/AbstractImpl.java (renamed from tests/untried/pos/t1409/AbstractImpl.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1409/ConcreteImpl.scala (renamed from tests/untried/pos/t1409/ConcreteImpl.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1409/OuterInterface.java (renamed from tests/untried/pos/t1409/OuterInterface.java) | 0 | ||||
-rwxr-xr-x | tests/disabled/java-interop/pos/t1459/AbstractBase.java (renamed from tests/untried/pos/t1459/AbstractBase.java) | 0 | ||||
-rwxr-xr-x | tests/disabled/java-interop/pos/t1459/App.scala (renamed from tests/untried/pos/t1459/App.scala) | 0 | ||||
-rwxr-xr-x | tests/disabled/java-interop/pos/t1459/Caller.java (renamed from tests/untried/pos/t1459/Caller.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1642/JavaCallingScalaHashMap.java (renamed from tests/untried/pos/t1642/JavaCallingScalaHashMap.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1711/Seq.scala (renamed from tests/untried/pos/t1711/Seq.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1711/Test.java (renamed from tests/untried/pos/t1711/Test.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1745/J.java (renamed from tests/untried/pos/t1745/J.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1745/S.scala (renamed from tests/untried/pos/t1745/S.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1751/A1_2.scala (renamed from tests/untried/pos/t1751/A1_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1751/A2_1.scala (renamed from tests/untried/pos/t1751/A2_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1751/SuiteClasses.java (renamed from tests/untried/pos/t1751/SuiteClasses.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1782/Ann.java (renamed from tests/untried/pos/t1782/Ann.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1782/Days.java (renamed from tests/untried/pos/t1782/Days.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1782/ImplementedBy.java (renamed from tests/untried/pos/t1782/ImplementedBy.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1782/Test_1.scala (renamed from tests/untried/pos/t1782/Test_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1836/J.java (renamed from tests/untried/pos/t1836/J.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1836/S.scala (renamed from tests/untried/pos/t1836/S.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1840/J.java (renamed from tests/untried/pos/t1840/J.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1840/S.scala (renamed from tests/untried/pos/t1840/S.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t1937/NumberGenerator.java (renamed from tests/untried/pos/t1937/NumberGenerator.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t2377/Q.java (renamed from tests/untried/pos/t2377/Q.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t2377/a.scala (renamed from tests/untried/pos/t2377/a.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t2409/J.java (renamed from tests/untried/pos/t2409/J.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t2409/t2409.scala (renamed from tests/untried/pos/t2409/t2409.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t2413/TestJava.java (renamed from tests/untried/pos/t2413/TestJava.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t2413/TestScalac.scala (renamed from tests/untried/pos/t2413/TestScalac.scala) | 0 | ||||
-rwxr-xr-x | tests/disabled/java-interop/pos/t2433/A.java (renamed from tests/untried/pos/t2433/A.java) | 0 | ||||
-rwxr-xr-x | tests/disabled/java-interop/pos/t2433/B.java (renamed from tests/untried/pos/t2433/B.java) | 0 | ||||
-rwxr-xr-x | tests/disabled/java-interop/pos/t2433/Test.scala (renamed from tests/untried/pos/t2433/Test.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t2464/JavaOne.java (renamed from tests/untried/pos/t2464/JavaOne.java) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t2464/ScalaOne_1.scala (renamed from tests/untried/pos/t2464/ScalaOne_1.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/java-interop/pos/t2464/t2464_2.scala (renamed from tests/untried/pos/t2464/t2464_2.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t1357.scala (renamed from tests/untried/pos/t1357.scala) | 4 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t1381-new.scala (renamed from tests/untried/pos/t1381-new.scala) | 6 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t1803.flags (renamed from tests/untried/pos/t1803.flags) | 0 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t1803.scala (renamed from tests/untried/pos/t1803.scala) | 1 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t2066-2.10-compat.scala (renamed from tests/untried/pos/t2066-2.10-compat.scala) | 1 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t2066.scala (renamed from tests/untried/pos/t2066.scala) | 0 | ||||
-rw-r--r-- | tests/neg/blockescapesNeg.scala | 5 | ||||
-rw-r--r-- | tests/neg/t1843.scala (renamed from tests/untried/pos/t1843.scala) | 0 | ||||
-rw-r--r-- | tests/new/t2405.scala (renamed from tests/untried/pos/t2405.scala) | 0 | ||||
-rw-r--r-- | tests/new/t2421.scala (renamed from tests/untried/pos/t2421.scala) | 0 | ||||
-rw-r--r-- | tests/new/t2421_delitedsl.scala (renamed from tests/untried/pos/t2421_delitedsl.scala) | 4 | ||||
-rw-r--r-- | tests/new/t2421b_pos.scala (renamed from tests/untried/pos/t2421b_pos.scala) | 0 | ||||
-rw-r--r-- | tests/new/t2421c.scala (renamed from tests/untried/pos/t2421c.scala) | 0 | ||||
-rwxr-xr-x | tests/new/t2425.scala (renamed from tests/untried/pos/t2425.scala) | 0 | ||||
-rw-r--r-- | tests/new/t2435.scala (renamed from tests/untried/pos/t2435.scala) | 0 | ||||
-rw-r--r-- | tests/new/t2441pos.scala (renamed from tests/untried/pos/t2441pos.scala) | 0 | ||||
-rw-r--r-- | tests/new/t2444.scala (renamed from tests/untried/pos/t2444.scala) | 0 | ||||
-rw-r--r-- | tests/new/t245.scala (renamed from tests/untried/pos/t245.scala) | 0 | ||||
-rw-r--r-- | tests/new/t247.scala (renamed from tests/untried/pos/t247.scala) | 0 | ||||
-rwxr-xr-x | tests/new/t2484.scala (renamed from tests/untried/pos/t2484.scala) | 0 | ||||
-rw-r--r-- | tests/new/t2486.scala (renamed from tests/untried/pos/t2486.scala) | 0 | ||||
-rw-r--r-- | tests/pending/pos/boundspropagation.scala | 26 | ||||
-rwxr-xr-x | tests/pending/pos/t1756.scala (renamed from tests/untried/pos/t1756.scala) | 0 | ||||
-rw-r--r-- | tests/pending/pos/t2454.scala (renamed from tests/untried/pos/t2454.scala) | 0 | ||||
-rw-r--r-- | tests/pos/bigint.scala | 7 | ||||
-rw-r--r-- | tests/pos/t1164.scala (renamed from tests/pending/pos/t1164.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1318.scala (renamed from tests/untried/pos/t1318.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1385.scala (renamed from tests/untried/pos/t1385.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1391.scala (renamed from tests/untried/pos/t1391.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1422_pos.scala (renamed from tests/untried/pos/t1422_pos.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1438.scala (renamed from tests/untried/pos/t1438.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1439.scala (renamed from tests/untried/pos/t1439.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1480.scala (renamed from tests/untried/pos/t1480.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t151.scala (renamed from tests/untried/pos/t151.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1560.scala (renamed from tests/untried/pos/t1560.scala) | 2 | ||||
-rw-r--r-- | tests/pos/t1565.scala | 19 | ||||
-rw-r--r-- | tests/pos/t1569.scala (renamed from tests/untried/pos/t1569.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t159.scala (renamed from tests/untried/pos/t159.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1591_pos.scala (renamed from tests/untried/pos/t1591_pos.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t160.scala (renamed from tests/untried/pos/t160.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1642b.scala (renamed from tests/untried/pos/t1642b.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1659.scala (renamed from tests/untried/pos/t1659.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1675.scala (renamed from tests/untried/pos/t1675.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1693.scala (renamed from tests/untried/pos/t1693.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1722-A.scala (renamed from tests/untried/pos/t1722-A.scala) | 0 | ||||
-rwxr-xr-x | tests/pos/t1722/Test.scala (renamed from tests/untried/pos/t1722/Test.scala) | 0 | ||||
-rwxr-xr-x | tests/pos/t1722/Top.scala (renamed from tests/untried/pos/t1722/Top.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t175.scala (renamed from tests/untried/pos/t175.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t177.scala (renamed from tests/untried/pos/t177.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1785.scala (renamed from tests/untried/pos/t1785.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1786-counter.scala (renamed from tests/untried/pos/t1786-counter.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1786-cycle.scala (renamed from tests/untried/pos/t1786-cycle.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1789.scala (renamed from tests/untried/pos/t1789.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1798.scala (renamed from tests/untried/pos/t1798.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t183.scala (renamed from tests/untried/pos/t183.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1832.scala | 10 | ||||
-rw-r--r-- | tests/pos/t1843.scala | 25 | ||||
-rw-r--r-- | tests/pos/t1858.scala (renamed from tests/untried/pos/t1858.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1896/D0.scala (renamed from tests/untried/pos/t1896/D0.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1896/D1.scala (renamed from tests/untried/pos/t1896/D1.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1942/A_1.scala (renamed from tests/untried/pos/t1942/A_1.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1942/Test_2.scala (renamed from tests/untried/pos/t1942/Test_2.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1957.scala (renamed from tests/untried/pos/t1957.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1974.scala (renamed from tests/untried/pos/t1974.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1987a.scala (renamed from tests/untried/pos/t1987a.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1987b/a.scala (renamed from tests/untried/pos/t1987b/a.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1987b/b.scala (renamed from tests/untried/pos/t1987b/b.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t1996.scala (renamed from tests/untried/pos/t1996.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t201.scala (renamed from tests/untried/pos/t201.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2018.scala (renamed from tests/untried/pos/t2018.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2023.scala (renamed from tests/untried/pos/t2023.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2038.scala (renamed from tests/untried/pos/t2038.scala) | 0 | ||||
-rwxr-xr-x | tests/pos/t2060.scala (renamed from tests/untried/pos/t2060.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2081.scala (renamed from tests/untried/pos/t2081.scala) | 0 | ||||
-rwxr-xr-x | tests/pos/t2082.scala (renamed from tests/untried/pos/t2082.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2094.scala (renamed from tests/untried/pos/t2094.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t210.scala (renamed from tests/untried/pos/t210.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t211.scala (renamed from tests/untried/pos/t211.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2119.scala (renamed from tests/untried/pos/t2119.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2127.scala (renamed from tests/untried/pos/t2127.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2130-1.scala (renamed from tests/untried/pos/t2130-1.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2130-2.scala (renamed from tests/untried/pos/t2130-2.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2133.scala (renamed from tests/untried/pos/t2133.scala) | 2 | ||||
-rw-r--r-- | tests/pos/t2168.scala (renamed from tests/untried/pos/t2168.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2171.flags (renamed from tests/untried/pos/t2171.flags) | 0 | ||||
-rw-r--r-- | tests/pos/t2171.scala (renamed from tests/untried/pos/t2171.scala) | 0 | ||||
-rwxr-xr-x | tests/pos/t2179.scala (renamed from tests/untried/pos/t2179.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2183.scala (renamed from tests/untried/pos/t2183.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2187-2.scala (renamed from tests/untried/pos/t2187-2.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2187.scala (renamed from tests/untried/pos/t2187.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2194.scala (renamed from tests/untried/pos/t2194.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2208_pos.scala (renamed from tests/untried/pos/t2208_pos.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2234.scala (renamed from tests/untried/pos/t2234.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2260.scala (renamed from tests/untried/pos/t2260.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2261.scala (renamed from tests/untried/pos/t2261.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t229.scala (renamed from tests/untried/pos/t229.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2293.scala (renamed from tests/untried/pos/t2293.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2305.scala (renamed from tests/untried/pos/t2305.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2310.scala (renamed from tests/untried/pos/t2310.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2331.scala (renamed from tests/untried/pos/t2331.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t2399.scala (renamed from tests/untried/pos/t2399.scala) | 0 | ||||
-rwxr-xr-x | tests/pos/t2429.scala (renamed from tests/untried/pos/t2429.scala) | 0 | ||||
-rw-r--r-- | tests/pos/typeinferNull.scala | 9 | ||||
-rw-r--r-- | tests/untried/pos/t0002.scala | 6 | ||||
-rw-r--r-- | tests/untried/pos/t0017.scala | 21 | ||||
-rw-r--r-- | tests/untried/pos/t0020.scala | 8 | ||||
-rw-r--r-- | tests/untried/pos/t0029.scala | 3 | ||||
-rw-r--r-- | tests/untried/pos/t0030.scala | 9 | ||||
-rw-r--r-- | tests/untried/pos/t0031.scala | 29 | ||||
-rw-r--r-- | tests/untried/pos/t0032.scala | 17 | ||||
-rw-r--r-- | tests/untried/pos/t0036.scala | 8 | ||||
-rw-r--r-- | tests/untried/pos/t0039.scala | 6 | ||||
-rw-r--r-- | tests/untried/pos/t0049.scala | 3 | ||||
-rw-r--r-- | tests/untried/pos/t0053.scala | 7 | ||||
-rw-r--r-- | tests/untried/pos/t0054.scala | 4 | ||||
-rw-r--r-- | tests/untried/pos/t0055.scala | 6 | ||||
-rw-r--r-- | tests/untried/pos/t0061.scala | 10 | ||||
-rw-r--r-- | tests/untried/pos/t0064.scala | 6 | ||||
-rw-r--r-- | tests/untried/pos/t0066.scala | 7 | ||||
-rw-r--r-- | tests/untried/pos/t0068.scala | 6 | ||||
-rw-r--r-- | tests/untried/pos/t0069.scala | 10 | ||||
-rw-r--r-- | tests/untried/pos/t0076.scala | 9 | ||||
-rw-r--r-- | tests/untried/pos/t0081.scala | 4 | ||||
-rw-r--r-- | tests/untried/pos/t0082.scala | 18 | ||||
-rw-r--r-- | tests/untried/pos/t0085.scala | 8 | ||||
-rw-r--r-- | tests/untried/pos/t0091.scala | 6 | ||||
-rw-r--r-- | tests/untried/pos/t0093.scala | 4 | ||||
-rw-r--r-- | tests/untried/pos/t0095.scala | 15 | ||||
-rw-r--r-- | tests/untried/pos/t1381-old.scala | 31 | ||||
-rw-r--r-- | tests/untried/pos/t1439.flags | 1 | ||||
-rw-r--r-- | tests/untried/pos/t1565.scala | 18 | ||||
-rw-r--r-- | tests/untried/pos/t1591b.scala | 13 | ||||
-rw-r--r-- | tests/untried/pos/t1614/bar.scala | 2 | ||||
-rw-r--r-- | tests/untried/pos/t1614/foo.scala | 2 | ||||
-rw-r--r-- | tests/untried/pos/t1832.scala | 8 | ||||
-rw-r--r-- | tests/untried/pos/t2066-2.10-compat.flags | 1 |
196 files changed, 474 insertions, 542 deletions
diff --git a/.gitignore b/.gitignore index 90009066c..cbaf7ae60 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ project/local-plugins.sbt .classpath .project .settings -bin/ +classes/ # idea .idea diff --git a/src/dotty/tools/dotc/ast/CheckTrees.scala b/src/dotty/tools/dotc/ast/CheckTrees.scala index 832544706..254f002c1 100644 --- a/src/dotty/tools/dotc/ast/CheckTrees.scala +++ b/src/dotty/tools/dotc/ast/CheckTrees.scala @@ -34,6 +34,7 @@ object CheckTrees { tp namedPartsWith (tp => isLocal(tp.symbol)) def typeLeaks(tp: Type): Boolean = leakingTypes(tp).nonEmpty def classLeaks(sym: ClassSymbol): Boolean = + (ctx.owner is Method) || // can't hoist classes out of method bodies (sym.info.parents exists typeLeaks) || (sym.decls.toList exists (t => typeLeaks(t.info))) leakingTypes(block.tpe) diff --git a/src/dotty/tools/dotc/config/Printers.scala b/src/dotty/tools/dotc/config/Printers.scala index 680dee7ab..5bfe1d0b6 100644 --- a/src/dotty/tools/dotc/config/Printers.scala +++ b/src/dotty/tools/dotc/config/Printers.scala @@ -25,5 +25,5 @@ object Printers { val hk = noPrinter val incremental = noPrinter val config = noPrinter - val transforms = new Printer + val transforms = noPrinter }
\ No newline at end of file diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index c7e7dc50d..498f912f9 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -418,7 +418,7 @@ object SymDenotations { /** Is this symbol a class that does not extend `AnyVal`? */ final def isNonValueClass(implicit ctx: Context): Boolean = - isClass && !derivesFrom(defn.AnyValClass) + isClass && !derivesFrom(defn.AnyValClass) && (symbol ne defn.NothingClass) /** Is this symbol a class references to which that are supertypes of null? */ final def isNullableClass(implicit ctx: Context): Boolean = diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala index 59c934e0d..6a3ac4467 100644 --- a/src/dotty/tools/dotc/core/TyperState.scala +++ b/src/dotty/tools/dotc/core/TyperState.scala @@ -11,7 +11,10 @@ import printing.{Showable, Printer} import printing.Texts._ import collection.mutable -class TyperState(val reporter: Reporter) extends DotClass with Showable { +class TyperState(r: Reporter) extends DotClass with Showable { + + /** The current reporter */ + def reporter = r /** The current constraint set */ def constraint: Constraint = new Constraint(SimpleMap.Empty, SimpleMap.Empty) @@ -56,11 +59,17 @@ class TyperState(val reporter: Reporter) extends DotClass with Showable { /** Can this state be transitively committed until the top-level? */ def isGlobalCommittable: Boolean = false + def tryWithFallback[T](op: => T)(fallback: => T)(implicit ctx: Context): T = unsupported("tryWithFallBack") + override def toText(printer: Printer): Text = "ImmutableTyperState" } -class MutableTyperState(previous: TyperState, reporter: Reporter, override val isCommittable: Boolean) -extends TyperState(reporter) { +class MutableTyperState(previous: TyperState, r: Reporter, override val isCommittable: Boolean) +extends TyperState(r) { + + private var myReporter = r + + override def reporter = myReporter private var myConstraint: Constraint = previous.constraint @@ -112,5 +121,44 @@ extends TyperState(reporter) { constraint = constraint.remove(poly) } + /** Try operation `op`; if it produces errors, execute `fallback` with constraint and + * reporter as they were before `op` was executed. This is similar to `typer/tryEither`, + * but with one important difference: Any type variable instantiations produced by `op` + * are persisted even if `op` fails. This is normally not what one wants and therefore + * it is recommended to use + * + * tryEither { implicit ctx => op } { (_, _) => fallBack } + * + * instead of + * + * ctx.tryWithFallback(op)(fallBack) + * + * `tryWithFallback` is only used when an implicit parameter search fails + * and the whole expression is subsequently retype-checked with a Wildcard + * expected type (so as to allow an implicit conversion on the result and + * avoid over-constraining the implicit parameter search). In this case, + * the only type variables that might be falsely instantiated by `op` but + * not by `fallBack` are type variables in the typed expression itself, and + * these will be thrown away and new ones will be created on re-typing. + * So `tryWithFallback` is safe. It is also necessary because without it + * we do not propagate enough instantiation information into the implicit search + * and this might lead to a missing parameter type error. This is exhibited + * at several places in the test suite (for instance in `pos_typers`). + * Overall, this is rather ugly, but despite trying for 2 days I have not + * found a better solution. + */ + override def tryWithFallback[T](op: => T)(fallback: => T)(implicit ctx: Context): T = { + val savedReporter = myReporter + val savedConstraint = myConstraint + myReporter = new StoreReporter + val result = op + if (!reporter.hasErrors) result + else { + myReporter = savedReporter + myConstraint = savedConstraint + fallback + } + } + override def toText(printer: Printer): Text = constraint.toText(printer) } diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 088a2e3af..89facfee5 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -756,6 +756,11 @@ object Types { def typeParamNamed(name: TypeName)(implicit ctx: Context): Symbol = classSymbol.decls.lookup(name) orElse member(name).symbol + /** If this is a prototype with some ignored component, reveal one more + * layer of it. Otherwise the type itself. + */ + def deepenProto(implicit ctx: Context): Type = this + // ----- Substitutions ----------------------------------------------------- /** Substitute all types that refer in their symbol attribute to @@ -1057,12 +1062,13 @@ object Types { if (owner.isTerm) d else d.asSeenFrom(prefix) } - private def checkSymAssign(sym: Symbol) = + private def checkSymAssign(sym: Symbol)(implicit ctx: Context) = assert( (lastSymbol eq sym) || (lastSymbol eq null) || (lastSymbol.defRunId != sym.defRunId) || - (lastSymbol.defRunId == NoRunId), + (lastSymbol.defRunId == NoRunId) || + (lastSymbol.infoOrCompleter == ErrorType), s"data race? overwriting symbol of $this / ${this.getClass} / ${lastSymbol.id} / ${sym.id}") protected def sig: Signature = Signature.NotAMethod @@ -1996,12 +2002,23 @@ object Types { // cached because baseType needs parents private var parentsCache: List[TypeRef] = null + /** The parent type refs as seen from the given prefix */ override def parents(implicit ctx: Context): List[TypeRef] = { if (parentsCache == null) parentsCache = cls.classParents.mapConserve(rebase(_).asInstanceOf[TypeRef]) parentsCache } + /** The parent types with all type arguments */ + def instantiatedParents(implicit ctx: Context): List[Type] = + parents mapConserve { pref => + ((pref: Type) /: pref.classSymbol.typeParams) { (parent, tparam) => + val targSym = decls.lookup(tparam.name) + if (targSym.exists) RefinedType(parent, targSym.name, targSym.info) + else parent + } + } + def derivedClassInfo(prefix: Type)(implicit ctx: Context) = if (prefix eq this.prefix) this else ClassInfo(prefix, cls, classParents, decls, selfInfo) diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala index 308470885..3a322648a 100644 --- a/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -251,22 +251,21 @@ class PlainPrinter(_ctx: Context) extends Printer { case sym: Symbol if !sym.isCompleted => "this: ? =>" case _ => "this: " ~ atPrec(InfixPrec) { toText(tp.selfType) } ~ " =>" } - val parentsText = Text(cparents.map(p => - toTextLocal(reconstituteParent(cls, p))), " with ") val trueDecls = otherDecls.filterNot(treatAsTypeArg) val declsText = if (trueDecls.isEmpty || !ctx.settings.debug.value) Text() else dclsText(trueDecls) - tparamsText ~ " extends " ~ parentsText ~ "{" ~ selfText ~ declsText ~ + tparamsText ~ " extends " ~ toTextParents(tp.parents) ~ "{" ~ selfText ~ declsText ~ "} at " ~ preText case _ => ": " ~ toTextGlobal(tp) } } + protected def toTextParents(parents: List[Type]): Text = Text(parents.map(toTextLocal), " with ") + protected def treatAsTypeParam(sym: Symbol): Boolean = false protected def treatAsTypeArg(sym: Symbol): Boolean = false - protected def reconstituteParent(cls: ClassSymbol, parent: Type): Type = parent /** String representation of symbol's kind. */ def kindString(sym: Symbol): String = { diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala index dd8f04d92..d0a681f90 100644 --- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -7,7 +7,7 @@ import Contexts.Context, Scopes.Scope, Denotations._, Annotations.Annotation import StdNames.nme import ast.{Trees, untpd} import typer.Namer -import typer.ProtoTypes.{SelectionProto, ViewProto, FunProto} +import typer.ProtoTypes.{SelectionProto, ViewProto, FunProto, IgnoredProto} import Trees._ import scala.annotation.switch @@ -108,10 +108,6 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { } return (toTextLocal(tycon) ~ "[" ~ Text(args map argText, ", ") ~ "]").close } - case tp: SelectionProto => - return toText(RefinedType(WildcardType, tp.name, tp.memberProto)) - case tp: ViewProto => - return toText(tp.argType) ~ " ?=>? " ~ toText(tp.resultType) case tp: TypeRef => if ((tp.symbol is TypeParam | TypeArgument) && !ctx.phase.erasedTypes) { return tp.info match { @@ -119,10 +115,20 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { case _ => nameString(tp.symbol) } } + else if (tp.symbol.isAnonymousClass) + return toText(tp.info) case ExprType(result) => return "=> " ~ toText(result) + case tp: ClassInfo => + return toTextParents(tp.instantiatedParents) ~ "{...}" + case tp: SelectionProto => + return toText(RefinedType(WildcardType, tp.name, tp.memberProto)) + case tp: ViewProto => + return toText(tp.argType) ~ " ?=>? " ~ toText(tp.resultType) case FunProto(args, resultType, _) => return "funproto(" ~ toTextGlobal(args, ", ") ~ "):" ~ toText(resultType) + case tp: IgnoredProto => + return "?" case _ => } super.toText(tp) @@ -435,13 +441,6 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { sym.isType && (sym is ProtectedLocal) && (sym.allOverriddenSymbols exists (_ is TypeParam)) - override protected def reconstituteParent(cls: ClassSymbol, parent: Type): Type = - (parent /: parent.classSymbol.typeParams) { (parent, tparam) => - val targSym = cls.decls.lookup(tparam.name) - if (targSym.exists) RefinedType(parent, targSym.name, targSym.info) - else parent - } - override def toText(sym: Symbol): Text = { if (sym.name == nme.IMPORT) { def importString(tree: untpd.Tree) = s"import ${tree.show}" diff --git a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala index 1bad29e23..6991cdbb6 100644 --- a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala +++ b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala @@ -40,11 +40,16 @@ class ConsoleReporter( } } - override def doReport(d: Diagnostic)(implicit ctx: Context): Unit = - if (d.severity != ERROR || count(d.severity.level) <= ErrorLimit && !d.isSuppressed) { - printMessageAndPos(label(d.severity) + d.msg, d.pos) - if (d.severity == ERROR && ctx.settings.prompt.value) displayPrompt() - } + override def doReport(d: Diagnostic)(implicit ctx: Context): Unit = d match { + case d: Error => + printMessageAndPos(s"error: ${d.msg}", d.pos) + if (ctx.settings.prompt.value) displayPrompt() + case d: ConditionalWarning if !d.enablingOption.value => + case d: Warning => + printMessageAndPos(s"warning: ${d.msg}", d.pos) + case _ => + printMessageAndPos(d.msg, d.pos) + } def displayPrompt(): Unit = { writer.print("\na)bort, s)tack, r)esume: ") diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala index b0404c6b3..82b0a1158 100644 --- a/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/src/dotty/tools/dotc/reporting/Reporter.scala @@ -14,10 +14,17 @@ import typer.ErrorReporting.DiagnosticString object Reporter { - class Diagnostic(msgFn: => String, val pos: SourcePosition, val severity: Severity) extends Exception { + private val ERROR = 2 + private val WARNING = 1 + private val INFO = 0 + + class Diagnostic(msgFn: => String, val pos: SourcePosition, val level: Int) extends Exception { import DiagnosticString._ + private var myMsg: String = null private var myIsNonSensical: Boolean = false + + /** The message to report */ def msg: String = { if (myMsg == null) { myMsg = msgFn @@ -29,48 +36,32 @@ object Reporter { } myMsg } + + /** Report in current reporter */ + def report(implicit ctx: Context) = ctx.reporter.report(this) + def isNonSensical = { msg; myIsNonSensical } def isSuppressed(implicit ctx: Context): Boolean = !ctx.settings.YshowSuppressedErrors.value && isNonSensical - override def toString = s"$severity at $pos: $msg" - override def getMessage() = msg - - def promotedSeverity(implicit ctx: Context): Severity = - if (isConditionalWarning(severity) && enablingOption(severity).value) WARNING - else severity - } - def Diagnostic(msgFn: => String, pos: SourcePosition, severity: Severity) = - new Diagnostic(msgFn, pos, severity) - - class Severity(val level: Int) extends AnyVal { - override def toString = this match { - case VerboseINFO => "VerboseINFO" - case INFO => "INFO" - case DeprecationWARNING => "DeprecationWARNING" - case UncheckedWARNING => "UncheckedWARNING" - case FeatureWARNING => "FeatureWARNING" - case WARNING => "WARNING" - case ERROR => "ERROR" - } + override def toString = s"$getClass at $pos: $msg" + override def getMessage() = msg } - final val VerboseINFO = new Severity(0) - final val INFO = new Severity(1) - final val DeprecationWARNING = new Severity(2) - final val UncheckedWARNING = new Severity(3) - final val FeatureWARNING = new Severity(4) - final val WARNING = new Severity(5) - final val ERROR = new Severity(6) - - def isConditionalWarning(s: Severity) = - DeprecationWARNING.level <= s.level && s.level <= FeatureWARNING.level + class Error(msgFn: => String, pos: SourcePosition) extends Diagnostic(msgFn, pos, ERROR) + class Warning(msgFn: => String, pos: SourcePosition) extends Diagnostic(msgFn, pos, WARNING) + class Info(msgFn: => String, pos: SourcePosition) extends Diagnostic(msgFn, pos, INFO) - val conditionalWarnings = List(DeprecationWARNING, UncheckedWARNING, FeatureWARNING) - - private def enablingOption(warning: Severity)(implicit ctx: Context) = warning match { - case DeprecationWARNING => ctx.settings.deprecation - case UncheckedWARNING => ctx.settings.unchecked - case FeatureWARNING => ctx.settings.feature + abstract class ConditionalWarning(msgFn: => String, pos: SourcePosition) extends Warning(msgFn, pos) { + def enablingOption(implicit ctx: Context): Setting[Boolean] + } + class FeatureWarning(msgFn: => String, pos: SourcePosition) extends ConditionalWarning(msgFn, pos) { + def enablingOption(implicit ctx: Context) = ctx.settings.feature + } + class UncheckedWarning(msgFn: => String, pos: SourcePosition) extends ConditionalWarning(msgFn, pos) { + def enablingOption(implicit ctx: Context) = ctx.settings.unchecked + } + class DeprecationWarning(msgFn: => String, pos: SourcePosition) extends ConditionalWarning(msgFn, pos) { + def enablingOption(implicit ctx: Context) = ctx.settings.deprecation } } @@ -80,30 +71,30 @@ trait Reporting { this: Context => /** For sending messages that are printed only if -verbose is set */ def inform(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = - reporter.report(Diagnostic(msg, pos, VerboseINFO)) + if (this.settings.verbose.value) echo(msg, pos) def echo(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = - reporter.report(Diagnostic(msg, pos, INFO)) + reporter.report(new Info(msg, pos)) def deprecationWarning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = - reporter.report(Diagnostic(msg, pos, DeprecationWARNING)) + reporter.report(new DeprecationWarning(msg, pos)) def uncheckedWarning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = - reporter.report(Diagnostic(msg, pos, UncheckedWARNING)) + reporter.report(new UncheckedWarning(msg, pos)) def featureWarning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = - reporter.report(Diagnostic(msg, pos, FeatureWARNING)) + reporter.report(new FeatureWarning(msg, pos)) def warning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = - reporter.report(Diagnostic(msg, pos, WARNING)) + reporter.report(new Warning(msg, pos)) def error(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = { // println("*** ERROR: " + msg) // !!! DEBUG - reporter.report(Diagnostic(msg, pos, ERROR)) + reporter.report(new Error(msg, pos)) } def incompleteInputError(msg: String, pos: SourcePosition = NoSourcePosition)(implicit ctx: Context): Unit = - reporter.incomplete(Diagnostic(msg, pos, ERROR))(ctx) + reporter.incomplete(new Error(msg, pos))(ctx) /** Log msg if current phase or its precedessor is mentioned in * settings.log. @@ -209,71 +200,54 @@ abstract class Reporter { finally incompleteHandler = saved } - protected def isHidden(d: Diagnostic)(implicit ctx: Context) = d.promotedSeverity match { - case VerboseINFO => !ctx.settings.verbose.value - case DeprecationWARNING | UncheckedWARNING | FeatureWARNING => true - case _ => false - } + var errorCount = 0 + var warningCount = 0 + def hasErrors = errorCount > 0 + def hasWarnings = warningCount > 0 - val count = new Array[Int](ERROR.level + 1) + val unreportedWarnings = new mutable.HashMap[String, Int] { + override def default(key: String) = 0 + } - def report(d: Diagnostic)(implicit ctx: Context): Unit = - if (!isHidden(d)) { - doReport(d) - if (!d.isSuppressed) count(d.promotedSeverity.level) += 1 + def report(d: Diagnostic)(implicit ctx: Context): Unit = if (!isHidden(d)) { + doReport(d) + if (!d.isSuppressed) d match { + case d: ConditionalWarning if !d.enablingOption.value => unreportedWarnings(d.enablingOption.name) += 1 + case d: Warning => warningCount += 1 + case d: Error => errorCount += 1 + case d: Info => // nothing to do here + // match error if d is something else } + } def incomplete(d: Diagnostic)(implicit ctx: Context): Unit = incompleteHandler(d)(ctx) - def hasErrors = count(ERROR.level) > 0 - def hasWarnings = count(WARNING.level) > 0 - def errorCounts: Any = count.clone - - def wasSilent[T](counts: Any): Boolean = { - val prevCount = counts.asInstanceOf[Array[Int]] - var i = 0 - while (i < count.length) { - if (prevCount(i) != count(i)) return false - i += 1 - } - true + /** Print a summary */ + def printSummary(implicit ctx: Context): Unit = { + if (warningCount > 0) ctx.echo(countString(warningCount, "warning") + " found") + if (errorCount > 0) ctx.echo(countString(errorCount, "error") + " found") + for ((settingName, count) <- unreportedWarnings) + ctx.echo(s"there were $count ${settingName.tail} warning(s); re-run with $settingName for details") } /** Returns a string meaning "n elements". */ - private def countElementsAsString(n: Int, elements: String): String = - n match { - case 0 => "no " + elements + "s" - case 1 => "one " + elements - case 2 => "two " + elements + "s" - case 3 => "three " + elements + "s" - case 4 => "four " + elements + "s" - case _ => n + " " + elements + "s" - } - - protected def label(severity: Severity): String = severity match { - case ERROR => "error: " - case WARNING => "warning: " - case _ => "" + private def countString(n: Int, elements: String): String = n match { + case 0 => "no " + elements + "s" + case 1 => "one " + elements + case 2 => "two " + elements + "s" + case 3 => "three " + elements + "s" + case 4 => "four " + elements + "s" + case _ => n + " " + elements + "s" } - protected def countString(severity: Severity) = { - assert(severity.level >= WARNING.level) - countElementsAsString(count(severity.level), label(severity).dropRight(2)) - } + /** Should this diagnostic not be reported at all? */ + def isHidden(d: Diagnostic)(implicit ctx: Context): Boolean = false - def printSummary(implicit ctx: Context): Unit = { - if (count(WARNING.level) > 0) ctx.echo(countString(WARNING) + " found") - if ( count(ERROR.level) > 0) ctx.echo(countString(ERROR ) + " found") - for (cwarning <- conditionalWarnings) { - val unreported = count(cwarning.level) - if (unreported > 0) { - val what = enablingOption(cwarning).name.tail - ctx.warning(s"there were $unreported $what warning(s); re-run with -$what for details") - } - } - } + /** Does this reporter contain not yet reported errors or warnings? */ + def hasPending: Boolean = false + /** Issue all error messages in this reporter to next outer one, or make sure they are written. */ def flush()(implicit ctx: Context): Unit = {} } diff --git a/src/dotty/tools/dotc/reporting/StoreReporter.scala b/src/dotty/tools/dotc/reporting/StoreReporter.scala index 67b90eec0..2864c01f8 100644 --- a/src/dotty/tools/dotc/reporting/StoreReporter.scala +++ b/src/dotty/tools/dotc/reporting/StoreReporter.scala @@ -4,7 +4,7 @@ package reporting import core.Contexts.Context import collection.mutable -import Reporter.Diagnostic +import Reporter.{Diagnostic, Error, Warning} import config.Printers._ /** @@ -20,6 +20,17 @@ class StoreReporter extends Reporter { infos += d } + override def hasPending: Boolean = infos != null && { + infos exists { + case d: Error => true + case d: Warning => true + case _ => false + } + } + override def flush()(implicit ctx: Context) = - if (infos != null) infos foreach ctx.reporter.report + if (infos != null) { + infos foreach ctx.reporter.report + infos = null + } } diff --git a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala index d44a08fb6..eb854d513 100644 --- a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala +++ b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala @@ -10,6 +10,8 @@ import Reporter._ * This class implements a Reporter that stores all messages */ class ThrowingReporter(reportInfo: Reporter) extends Reporter { - protected def doReport(d: Diagnostic)(implicit ctx: Context): Unit = - if (d.severity == ERROR) throw d else reportInfo.report(d) + protected def doReport(d: Diagnostic)(implicit ctx: Context): Unit = d match { + case _: Error => throw d + case _ => reportInfo.report(d) + } } diff --git a/src/dotty/tools/dotc/reporting/UniqueMessagePositions.scala b/src/dotty/tools/dotc/reporting/UniqueMessagePositions.scala index 93e24b27f..c1f240a23 100644 --- a/src/dotty/tools/dotc/reporting/UniqueMessagePositions.scala +++ b/src/dotty/tools/dotc/reporting/UniqueMessagePositions.scala @@ -4,16 +4,16 @@ package reporting import scala.collection.mutable import util.{SourcePosition, SourceFile} -import Reporter.{Severity, Diagnostic} +import Reporter.Diagnostic import core.Contexts.Context /** - * This trait implements `isHidden` do that multiple messages per position + * This trait implements `isHidden` so that multiple messages per position * are suppressed, unless they are of increasing severity. */ trait UniqueMessagePositions extends Reporter { - private val positions = new mutable.HashMap[(SourceFile, Int), Severity] + private val positions = new mutable.HashMap[(SourceFile, Int), Int] /** Logs a position and returns true if it was already logged. * @note Two positions are considered identical for logging if they have the same point. @@ -22,8 +22,8 @@ trait UniqueMessagePositions extends Reporter { super.isHidden(d) || { d.pos.exists && { positions get (ctx.source, d.pos.point) match { - case Some(s) if s.level >= d.severity.level => true - case _ => positions((ctx.source, d.pos.point)) = d.severity; false + case Some(level) if level >= d.level => true + case _ => positions((ctx.source, d.pos.point)) = d.level; false } } } diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index e6d012d68..e56132057 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -349,7 +349,7 @@ object Erasure { tpd.DefDef(bridge, { paramss: List[List[tpd.Tree]] => val rhs = paramss.foldLeft(sel)((fun, vparams) => fun.tpe.widen match { - case MethodType(names, types) => Apply(fun, (vparams, types).zipped.map(adapt)) + case MethodType(names, types) => Apply(fun, (vparams, types).zipped.map(adapt(_, _, untpd.EmptyTree))) case a => error(s"can not resolve apply type $a") }) @@ -357,7 +357,7 @@ object Erasure { }) } - override def adapt(tree: Tree, pt: Type)(implicit ctx: Context): Tree = + override def adapt(tree: Tree, pt: Type, original: untpd.Tree)(implicit ctx: Context): Tree = ctx.traceIndented(i"adapting ${tree.showSummary}: ${tree.tpe} to $pt", show = true) { assert(ctx.phase == ctx.erasurePhase.next, ctx.phase) if (tree.isEmpty) tree else adaptToType(tree, pt) diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 0f47336fc..a4c26080d 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -346,7 +346,7 @@ trait Applications extends Compatibility { self: Typer => init() def addArg(arg: Tree, formal: Type): Unit = - typedArgBuf += adaptInterpolated(arg, formal.widenExpr) + typedArgBuf += adaptInterpolated(arg, formal.widenExpr, EmptyTree) def makeVarArg(n: Int, elemFormal: Type): Unit = { val args = typedArgBuf.takeRight(n).toList @@ -434,7 +434,7 @@ trait Applications extends Compatibility { self: Typer => def typedApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = { def realApply(implicit ctx: Context): Tree = track("realApply") { - var proto = new FunProto(tree.args, pt, this) + var proto = new FunProto(tree.args, ignoreIfProto(pt), this) val fun1 = typedExpr(tree.fun, proto) // Warning: The following line is dirty and fragile. We record that auto-tupling was demanded as @@ -453,30 +453,13 @@ trait Applications extends Compatibility { self: Typer => else new ApplyToUntyped(tree, fun1, funRef, proto, pt) val result = app.result ConstFold(result) - } { (failedVal, failedState) => fun1 match { - case Select(qual, name) => - // try with prototype `[].name(args)`, this might succeed by inserting an - // implicit conversion around []. (an example is Int + BigInt). - tryEither { implicit ctx => - val simpleFunProto = new FunProto(tree.args, WildcardType, this) // drop result type, because views are disabled - val selProto = SelectionProto(name, simpleFunProto, NoViewsAllowed) - val qual1 = adaptInterpolated(qual, selProto) - if (qual eq qual1) ctx.error("no progress") - if (ctx.reporter.hasErrors) qual1 - else - typedApply( - cpy.Apply(tree, - cpy.Select(fun1, untpd.TypedSplice(qual1), name), - proto.typedArgs map untpd.TypedSplice), - pt) - } { (_, _) => - failedState.commit() - failedVal - } - case _ => - failedState.commit() - failedVal - } + } { (failedVal, failedState) => + val fun2 = tryInsertImplicit(fun1, proto) + if (fun1 eq fun2) { + failedState.commit() + failedVal + } else typedApply( + cpy.Apply(tree, untpd.TypedSplice(fun2), proto.typedArgs map untpd.TypedSplice), pt) } case _ => fun1.tpe match { @@ -771,7 +754,7 @@ trait Applications extends Compatibility { self: Typer => def isAsSpecific(alt1: TermRef, tp1: Type, alt2: TermRef, tp2: Type): Boolean = ctx.traceIndented(i"isAsSpecific $tp1 $tp2", overload) { tp1 match { case tp1: PolyType => def bounds(tparamRefs: List[TypeRef]) = tp1.paramBounds map (_.substParams(tp1, tparamRefs)) - val tparams = ctx.newTypeParams(alt1.symbol.owner, tp1.paramNames, EmptyFlags, bounds) + val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags, bounds) isAsSpecific(alt1, tp1.instantiate(tparams map (_.typeRef)), alt2, tp2) case tp1: MethodType => def repeatedToSingle(tp: Type) = if (tp.isRepeatedParam) tp.argTypesHi.head else tp @@ -927,7 +910,14 @@ trait Applications extends Compatibility { self: Typer => alts filter (normalizedCompatible(_, pt)) } if (isDetermined(candidates)) candidates - else narrowMostSpecific(candidates) + else narrowMostSpecific(candidates) match { + case result @ (alt1 :: alt2 :: _) => + val deepPt = pt.deepenProto + if (deepPt ne pt) resolveOverloaded(alts, deepPt, targs) + else result + case result => + result + } } } diff --git a/src/dotty/tools/dotc/typer/ErrorReporting.scala b/src/dotty/tools/dotc/typer/ErrorReporting.scala index 8f9b01fe6..0b016769b 100644 --- a/src/dotty/tools/dotc/typer/ErrorReporting.scala +++ b/src/dotty/tools/dotc/typer/ErrorReporting.scala @@ -28,7 +28,11 @@ object ErrorReporting { def errorMsg(msg: String, cx: Context): String = if (cx.mode is Mode.InferringReturnType) { cx.tree match { - case tree: Trees.ValOrDefDef[_] => + case tree: untpd.ValOrDefDef => + // Dotty deviation: Was Trees.ValOrDefDef[_], but this gives ValOrDefDef[Nothing] instead of + // ValOrDefDel[Null]. Scala handles it, but it looks accidental because bounds propagation + // fails if the parameter is invariant or cotravariant. + // See test pending/pos/boundspropagation.scala val treeSym = ctx.symOfContextTree(tree) if (treeSym.exists && treeSym.name == cycleSym.name && treeSym.owner == cycleSym.owner) { val result = if (cycleSym.isSourceMethod) " result" else "" diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index a32f552ed..d2a94e287 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -368,7 +368,10 @@ trait Implicits { self: Typer => return defn.isValueSubClass(from.symbol, to.symbol) case _ => } + case from: ValueType => + ; case _ => + return false } inferView(dummyTreeOfType(from), to)(ctx.fresh.setExploreTyperState).isInstanceOf[SearchSuccess] } @@ -410,12 +413,15 @@ trait Implicits { self: Typer => else new ImplicitSearch(pt, argument, pos) val result = isearch.bestImplicit result match { - case success: SearchSuccess => - // println(s"committing to ${success.tstate.show}") - success.tstate.commit() + case result: SearchSuccess => + result.tstate.commit() + result + case result: AmbiguousImplicits => + val deepPt = pt.deepenProto + if (deepPt ne pt) inferImplicit(deepPt, argument, pos) else result case _ => + result } - result } } diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index bd44ccac5..9e34d549a 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -58,7 +58,7 @@ trait Inferencing { this: Checking => } private var toMaximize: Boolean = false def apply(x: Boolean, tp: Type): Boolean = tp.dealias match { - case _: WildcardType => + case _: WildcardType | _: ProtoType => false case tvar: TypeVar if !tvar.isInstantiated => if (force == ForceDegree.none) false diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index c3f1dcc81..e9195a072 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -404,8 +404,18 @@ class Namer { typer: Typer => } } - final override def complete(denot: SymDenotation)(implicit ctx: Context) = + final override def complete(denot: SymDenotation)(implicit ctx: Context) = { + if (completions != noPrinter && ctx.typerState != this.ctx.typerState) { + completions.println(completions.getClass.toString) + def levels(c: Context): Int = + if (c.typerState eq this.ctx.typerState) 0 + else if (c.typerState == null) -1 + else if (c.outer.typerState == c.typerState) levels(c.outer) + else levels(c.outer) + 1 + completions.println(s"!!!completing ${denot.symbol.showLocated} in buried typerState, gap = ${levels(ctx)}") + } completeInCreationContext(denot) + } def completeInCreationContext(denot: SymDenotation): Unit = denot.info = typeSig(denot.symbol) diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala index 4aba4fb59..a72e98418 100644 --- a/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -71,6 +71,23 @@ object ProtoTypes { override def viewExists(tp: Type, pt: Type)(implicit ctx: Context): Boolean = false } + /** A trait for prototypes that match all types */ + trait MatchAlways extends ProtoType { + def isMatchedBy(tp1: Type)(implicit ctx: Context) = true + def map(tm: TypeMap)(implicit ctx: Context): ProtoType = this + def fold[T](x: T, ta: TypeAccumulator[T])(implicit ctx: Context): T = x + } + + /** A class marking ignored prototypes that can be reviealed by `deepenProto` */ + case class IgnoredProto(proto: ProtoType) extends UncachedGroundType with MatchAlways { + override def deepenProto(implicit ctx: Context): Type = proto + } + + def ignoreIfProto(tp: Type): Type = tp match { + case proto: ProtoType => IgnoredProto(proto) + case _ => tp + } + /** A prototype for expressions [] that are part of a selection operation: * * [ ].name: proto @@ -107,6 +124,8 @@ object ProtoTypes { def map(tm: TypeMap)(implicit ctx: Context) = derivedSelectionProto(name, tm(memberProto), compat) def fold[T](x: T, ta: TypeAccumulator[T])(implicit ctx: Context) = ta(x, memberProto) + override def deepenProto(implicit ctx: Context) = derivedSelectionProto(name, memberProto.deepenProto, compat) + override def computeHash = addDelta(doHash(name, memberProto), if (compat eq NoViewsAllowed) 1 else 0) } @@ -126,8 +145,7 @@ object ProtoTypes { if (name.isConstructorName) WildcardType else tp match { case tp: UnapplyFunProto => new UnapplySelectionProto(name) - case tp: ProtoType => SelectionProto(name, WildcardType, typer) - case _ => SelectionProto(name, tp, typer) + case tp => SelectionProto(name, ignoreIfProto(tp), typer) } /** A prototype for expressions [] that are in some unspecified selection operation @@ -183,12 +201,10 @@ object ProtoTypes { def typedArg(arg: untpd.Tree, formal: Type)(implicit ctx: Context): Tree = { var targ = myTypedArg(arg) if (targ == null) { - val counts = ctx.reporter.errorCounts targ = typer.typedUnadapted(arg, formal) - if (ctx.reporter.wasSilent(counts)) - myTypedArg = myTypedArg.updated(arg, targ) + if (!ctx.reporter.hasPending) myTypedArg = myTypedArg.updated(arg, targ) } - typer.adapt(targ, formal) + typer.adapt(targ, formal, arg) } private var myTupled: Type = NoType @@ -210,14 +226,17 @@ object ProtoTypes { def map(tm: TypeMap)(implicit ctx: Context): FunProto = derivedFunProto(args, tm(resultType), typer) - def fold[T](x: T, ta: TypeAccumulator[T])(implicit ctx: Context): T = ta(x, resultType) + def fold[T](x: T, ta: TypeAccumulator[T])(implicit ctx: Context): T = + ta(ta.foldOver(x, typedArgs.tpes), resultType) + + override def deepenProto(implicit ctx: Context) = derivedFunProto(args, resultType.deepenProto, typer) } /** A prototype for implicitly inferred views: * * []: argType => resultType */ - abstract case class ViewProto(argType: Type, override val resultType: Type)(implicit ctx: Context) + abstract case class ViewProto(argType: Type, override val resultType: Type) extends CachedGroundType with ApplyingProto { def isMatchedBy(tp: Type)(implicit ctx: Context): Boolean = ctx.typer.isApplicable(tp, argType :: Nil, resultType) @@ -228,13 +247,13 @@ object ProtoTypes { def map(tm: TypeMap)(implicit ctx: Context): ViewProto = derivedViewProto(tm(argType), tm(resultType)) - def fold[T](x: T, ta: TypeAccumulator[T])(implicit ctx: Context): T = ta(ta(x, argType), resultType) + def fold[T](x: T, ta: TypeAccumulator[T])(implicit ctx: Context): T = + ta(ta(x, argType), resultType) - override def namedPartsWith(p: NamedType => Boolean)(implicit ctx: Context): collection.Set[NamedType] = - AndType.unchecked(argType, resultType).namedPartsWith(p) // this is more efficient than oring two namedParts sets + override def deepenProto(implicit ctx: Context) = derivedViewProto(argType, resultType.deepenProto) } - class CachedViewProto(argType: Type, resultType: Type)(implicit ctx: Context) extends ViewProto(argType, resultType) { + class CachedViewProto(argType: Type, resultType: Type) extends ViewProto(argType, resultType) { override def computeHash = doHash(argType, resultType) } @@ -268,17 +287,15 @@ object ProtoTypes { def fold[T](x: T, ta: TypeAccumulator[T])(implicit ctx: Context): T = ta(ta.foldOver(x, targs), resultType) + + override def deepenProto(implicit ctx: Context) = derivedPolyProto(targs, resultType.deepenProto) } /** A prototype for expressions [] that are known to be functions: * * [] _ */ - object AnyFunctionProto extends UncachedGroundType with ProtoType { - def isMatchedBy(tp: Type)(implicit ctx: Context) = true - def map(tm: TypeMap)(implicit ctx: Context) = this - def fold[T](x: T, ta: TypeAccumulator[T])(implicit ctx: Context) = x - } + object AnyFunctionProto extends UncachedGroundType with MatchAlways /** Add all parameters in given polytype `pt` to the constraint's domain. * If the constraint contains already some of these parameters in its domain, @@ -356,7 +373,8 @@ object ProtoTypes { case tp @ PolyParam(poly, pnum) => ctx.typerState.constraint.at(tp) match { case bounds: TypeBounds => wildApprox(WildcardType(bounds)) - case _ => WildcardType(wildApprox(poly.paramBounds(pnum)).bounds) + case NoType => WildcardType(wildApprox(poly.paramBounds(pnum)).bounds) + case inst => wildApprox(inst) } case MethodParam(mt, pnum) => WildcardType(TypeBounds.upper(wildApprox(mt.paramTypes(pnum)))) diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index 13f65d424..48c263085 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -52,10 +52,14 @@ trait TypeAssigner { def apply(tp: Type) = tp match { case tp: TermRef if toAvoid(tp) && variance > 0 => apply(tp.info) - case tp: TypeRef if toAvoid(tp.prefix) => + case tp: TypeRef if (forbidden contains tp.symbol) || toAvoid(tp.prefix) => tp.info match { - case TypeAlias(ref) => apply(ref) - case _ => mapOver(tp) + case TypeAlias(ref) => + apply(ref) + case info: ClassInfo => + mapOver(info.instantiatedParents.reduceLeft(AndType(_, _))) + case _ => + mapOver(tp) } case tp: RefinedType => val tp1 @ RefinedType(parent1, _) = mapOver(tp) @@ -247,7 +251,7 @@ trait TypeAssigner { tree.withType(defn.UnitType) def assignType(tree: untpd.Block, stats: List[Tree], expr: Tree)(implicit ctx: Context) = - tree.withType(avoid(expr.tpe, localSyms(stats))) + tree.withType(avoid(expr.tpe, localSyms(stats) filter (_.isTerm))) def assignType(tree: untpd.If, thenp: Tree, elsep: Tree)(implicit ctx: Context) = tree.withType(thenp.tpe | elsep.tpe) diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index f4b52ce09..050fcbc76 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -70,6 +70,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit * (3) Change pattern Idents id (but not wildcards) to id @ _ */ def typedIdent(tree: untpd.Ident, pt: Type)(implicit ctx: Context): Tree = track("typedIdent") { + val refctx = ctx val name = tree.name /** Method is necessary because error messages need to bind to @@ -179,7 +180,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if (imp.isWildcardImport) { val pre = imp.site if (!isDisabled(imp, pre) && !(imp.excluded contains name.toTermName)) { - val denot = pre.member(name) + val denot = pre.member(name).accessibleFrom(pre)(refctx) if (reallyExists(denot)) return pre.select(name, denot) } } @@ -953,7 +954,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = /*>|>*/ ctx.traceIndented (i"typing $tree", typr, show = true) /*<|<*/ { if (!tree.isEmpty && ctx.typerState.isGlobalCommittable) assert(tree.pos.exists, i"position not set for $tree") - try adapt(typedUnadapted(tree, pt), pt) + try adapt(typedUnadapted(tree, pt), pt, tree) catch { case ex: CyclicReference => errorTree(tree, cyclicErrorMsg(ex)) case ex: FatalTypeError => errorTree(tree, ex.getMessage) @@ -1008,20 +1009,46 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } } - def tryInsertApply(tree: Tree, pt: Type)(fallBack: (Tree, TyperState) => Tree)(implicit ctx: Context): Tree = - tryEither { - implicit ctx => - val sel = typedSelect(untpd.Select(untpd.TypedSplice(tree), nme.apply), pt) - if (sel.tpe.isError) sel else adapt(sel, pt) - } { - fallBack + /** Try to insert `.apply` so that the result conforms to prototype `pt`. + * If that fails try to insert an implicit conversion around the qualifier + * part of `tree`. If either result conforms to `pt`, adapt it, else + * continue with `fallBack`. + */ + def tryInsertApplyOrImplicit(tree: Tree, pt: ProtoType)(fallBack: (Tree, TyperState) => Tree)(implicit ctx: Context): Tree = + tryEither { implicit ctx => + val sel = typedSelect(untpd.Select(untpd.TypedSplice(tree), nme.apply), pt) + if (sel.tpe.isError) sel else adapt(sel, pt) + } { (failedTree, failedState) => + val tree1 = tryInsertImplicit(tree, pt) + if (tree1 eq tree) fallBack(failedTree, failedState) + else adapt(tree1, pt) } - def adapt(tree: Tree, pt: Type)(implicit ctx: Context) = /*>|>*/ track("adapt") /*<|<*/ { + /** 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. + */ + def tryInsertImplicit(tree: Tree, pt: ProtoType)(implicit ctx: Context): Tree = ctx.traceIndented(i"try ins impl $tree $pt") { tree match { + case Select(qual, name) => + val normalizedProto = pt match { + case pt: FunProto => pt.derivedFunProto(pt.args, WildcardType, pt.typer) // drop result type, because views are disabled + case _ => pt + } + val qualProto = SelectionProto(name, normalizedProto, NoViewsAllowed) + tryEither { implicit ctx => + val qual1 = adaptInterpolated(qual, qualProto, EmptyTree) + if ((qual eq qual1) || ctx.reporter.hasErrors) tree + else typedSelect(cpy.Select(tree, untpd.TypedSplice(qual1), name), pt) + } { (_, _) => tree + } + case _ => tree + }} + + def adapt(tree: Tree, pt: Type, original: untpd.Tree = untpd.EmptyTree)(implicit ctx: Context) = /*>|>*/ track("adapt") /*<|<*/ { /*>|>*/ ctx.traceIndented(i"adapting $tree of type ${tree.tpe} to $pt", typr, show = true) /*<|<*/ { interpolateUndetVars(tree) tree overwriteType tree.tpe.simplified - adaptInterpolated(tree, pt) + adaptInterpolated(tree, pt, original) } } @@ -1063,7 +1090,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit * (14) When in mode EXPRmode, apply a view * If all this fails, error */ - def adaptInterpolated(tree: Tree, pt: Type)(implicit ctx: Context): Tree = { + def adaptInterpolated(tree: Tree, pt: Type, original: untpd.Tree)(implicit ctx: Context): Tree = { assert(pt.exists) @@ -1077,7 +1104,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def expectedStr = err.expectedTypeStr(pt) resolveOverloaded(alts, pt) match { case alt :: Nil => - adapt(tree.withType(alt), pt) + adapt(tree.withType(alt), pt, original) case Nil => def noMatches = errorTree(tree, @@ -1086,7 +1113,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def hasEmptyParams(denot: SingleDenotation) = denot.info.paramTypess == ListOfNil pt match { case pt: FunProto => - tryInsertApply(tree, pt)((_, _) => noMatches) + tryInsertApplyOrImplicit(tree, pt)((_, _) => noMatches) case _ => if (altDenots exists (_.info.paramTypess == ListOfNil)) typed(untpd.Apply(untpd.TypedSplice(tree), Nil), pt) @@ -1112,7 +1139,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit adaptToArgs(wtp, pt.tupled) else tree - case _ => tryInsertApply(tree, pt) { + case _ => tryInsertApplyOrImplicit(tree, pt) { val more = tree match { case Apply(_, _) => " more" case _ => "" @@ -1123,24 +1150,31 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def adaptNoArgs(wtp: Type): Tree = wtp match { case wtp: ExprType => - adaptInterpolated(tree.withType(wtp.resultType), pt) + adaptInterpolated(tree.withType(wtp.resultType), pt, original) case wtp: ImplicitMethodType if constrainResult(wtp, pt) => - def implicitArgError(msg: => String): Tree = { - ctx.error(msg, tree.pos.endPos) - EmptyTree - } - val args = (wtp.paramNames, wtp.paramTypes).zipped map { (pname, formal) => - def where = d"parameter $pname of $methodStr" - inferImplicit(formal, EmptyTree, tree.pos.endPos) match { - case SearchSuccess(arg, _, _) => - adapt(arg, formal) - case ambi: AmbiguousImplicits => - implicitArgError(s"ambiguous implicits: ${ambi.explanation} of $where") - case failure: SearchFailure => - implicitArgError(d"no implicit argument of type $formal found for $where" + failure.postscript) + def addImplicitArgs = { + def implicitArgError(msg: => String): Tree = { + ctx.error(msg, tree.pos.endPos) + EmptyTree + } + val args = (wtp.paramNames, wtp.paramTypes).zipped map { (pname, formal) => + def where = d"parameter $pname of $methodStr" + inferImplicit(formal, EmptyTree, tree.pos.endPos) match { + case SearchSuccess(arg, _, _) => + adapt(arg, formal) + case ambi: AmbiguousImplicits => + implicitArgError(s"ambiguous implicits: ${ambi.explanation} of $where") + case failure: SearchFailure => + implicitArgError(d"no implicit argument of type $formal found for $where" + failure.postscript) + } } + adapt(tpd.Apply(tree, args), pt) } - adapt(tpd.Apply(tree, args), pt) + if ((pt eq WildcardType) || original.isEmpty) addImplicitArgs + else + ctx.typerState.tryWithFallback(addImplicitArgs) { + adapt(typed(original, WildcardType), pt, EmptyTree) + } case wtp: MethodType if !pt.isInstanceOf[SingletonType] => val arity = if (defn.isFunctionType(pt)) defn.functionArity(pt) @@ -1149,7 +1183,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if (arity >= 0 && !tree.symbol.isConstructor) typed(etaExpand(tree, wtp, arity), pt) else if (wtp.paramTypes.isEmpty) - adaptInterpolated(tpd.Apply(tree, Nil), pt) + adaptInterpolated(tpd.Apply(tree, Nil), pt, EmptyTree) else errorTree(tree, d"""missing arguments for $methodStr @@ -1208,14 +1242,14 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if (pt.isInstanceOf[PolyProto]) tree else { val (_, tvars) = constrained(poly, tree) - adaptInterpolated(tree appliedToTypes tvars, pt) + adaptInterpolated(tree appliedToTypes tvars, pt, original) } case wtp => pt match { case pt: FunProto => adaptToArgs(wtp, pt) case pt: PolyProto => - tryInsertApply(tree, pt) { + tryInsertApplyOrImplicit(tree, pt) { (_, _) => tree // error will be reported in typedTypeApply } case _ => diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 31ab15b57..b102c5e80 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -64,8 +64,8 @@ class tests extends CompilerTest { @Test def neg_privates() = compileFile(negDir, "privates", xerrors = 2) @Test def neg_rootImports = compileFile(negDir, "rootImplicits", xerrors = 2) @Test def neg_templateParents() = compileFile(negDir, "templateParents", xerrors = 3) - @Test def neg_autoTupling = compileFile(posDir, "autoTuplingTest", "-language:noAutoTupling" :: Nil, xerrors = 3) - @Test def neg_autoTupling2 = compileFile(negDir, "autoTuplingTest", xerrors = 3) + @Test def neg_autoTupling = compileFile(posDir, "autoTuplingTest", "-language:noAutoTupling" :: Nil, xerrors = 4) + @Test def neg_autoTupling2 = compileFile(negDir, "autoTuplingTest", xerrors = 4) @Test def neg_companions = compileFile(negDir, "companions", xerrors = 1) @Test def neg_i39 = compileFile(negDir, "i39", xerrors = 1) @Test def neg_i50_volatile = compileFile(negDir, "i50-volatile", xerrors = 4) @@ -83,6 +83,7 @@ class tests extends CompilerTest { @Test def neg_tailcall = compileFile(negDir, "tailcall/tailrec", xerrors = 7) @Test def neg_tailcall2 = compileFile(negDir, "tailcall/tailrec-2", xerrors = 2) @Test def neg_tailcall3 = compileFile(negDir, "tailcall/tailrec-3", xerrors = 2) + @Test def neg_t1843 = compileFile(negDir, "t1843", xerrors = 1) @Test def dotc = compileDir(dotcDir + "tools/dotc", twice) @Test def dotc_ast = compileDir(dotcDir + "tools/dotc/ast", twice) @@ -103,14 +104,14 @@ class tests extends CompilerTest { dotcDir + "tools/dotc/CompilationUnit.scala", dotcDir + "tools/dotc/core/Types.scala", dotcDir + "tools/dotc/ast/Trees.scala", - "-Ylog:frontend", + //"-Ylog:frontend", "-Xprompt", "#runs", "2")) @Test def testIssue_34 = compileArgs(Array( dotcDir + "tools/dotc/config/Properties.scala", dotcDir + "tools/dotc/config/PathResolver.scala", - "-Ylog:frontend", + //"-Ylog:frontend", "-Xprompt", "#runs", "2")) diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala index 1bf138d54..3a24e0421 100644 --- a/test/test/CompilerTest.scala +++ b/test/test/CompilerTest.scala @@ -11,7 +11,7 @@ class CompilerTest extends DottyTest { def compileArgs(args: Array[String], xerrors: Int = 0)(implicit defaultOptions: List[String]): Unit = { val allArgs = args ++ defaultOptions val processor = if (allArgs.exists(_.startsWith("#"))) Bench else Main - val nerrors = processor.process(allArgs, ctx).count(Reporter.ERROR.level) + val nerrors = processor.process(allArgs, ctx).errorCount assert(nerrors == xerrors, s"Wrong # of errors. Expected: $xerrors, found: $nerrors") } diff --git a/test/test/ContextEscapeDetection.java b/test/test/ContextEscapeDetection.java index 233630eb2..8852c9fe9 100644 --- a/test/test/ContextEscapeDetection.java +++ b/test/test/ContextEscapeDetection.java @@ -19,7 +19,7 @@ public abstract class ContextEscapeDetection { public final String testName; } - public static final List<TestContext> contexts = new LinkedList<>(); + public static final List<TestContext> contexts = new LinkedList<TestContext>(); public abstract Contexts.Context getCtx(); @@ -27,7 +27,7 @@ public abstract class ContextEscapeDetection { @Before public synchronized void stealContext() { - contexts.add(new TestContext(new WeakReference<>(this.getCtx()), this.getClass().getName())); + contexts.add(new TestContext(new WeakReference<Contexts.Context>(this.getCtx()), this.getClass().getName())); } @After diff --git a/tests/untried/pos/t1409/AbstractImpl.java b/tests/disabled/java-interop/pos/t1409/AbstractImpl.java index b22a94fa1..b22a94fa1 100644 --- a/tests/untried/pos/t1409/AbstractImpl.java +++ b/tests/disabled/java-interop/pos/t1409/AbstractImpl.java diff --git a/tests/untried/pos/t1409/ConcreteImpl.scala b/tests/disabled/java-interop/pos/t1409/ConcreteImpl.scala index d427e957e..d427e957e 100644 --- a/tests/untried/pos/t1409/ConcreteImpl.scala +++ b/tests/disabled/java-interop/pos/t1409/ConcreteImpl.scala diff --git a/tests/untried/pos/t1409/OuterInterface.java b/tests/disabled/java-interop/pos/t1409/OuterInterface.java index dd288ceea..dd288ceea 100644 --- a/tests/untried/pos/t1409/OuterInterface.java +++ b/tests/disabled/java-interop/pos/t1409/OuterInterface.java diff --git a/tests/untried/pos/t1459/AbstractBase.java b/tests/disabled/java-interop/pos/t1459/AbstractBase.java index 492419416..492419416 100755 --- a/tests/untried/pos/t1459/AbstractBase.java +++ b/tests/disabled/java-interop/pos/t1459/AbstractBase.java diff --git a/tests/untried/pos/t1459/App.scala b/tests/disabled/java-interop/pos/t1459/App.scala index 36e5022e9..36e5022e9 100755 --- a/tests/untried/pos/t1459/App.scala +++ b/tests/disabled/java-interop/pos/t1459/App.scala diff --git a/tests/untried/pos/t1459/Caller.java b/tests/disabled/java-interop/pos/t1459/Caller.java index 4ae51d8c5..4ae51d8c5 100755 --- a/tests/untried/pos/t1459/Caller.java +++ b/tests/disabled/java-interop/pos/t1459/Caller.java diff --git a/tests/untried/pos/t1642/JavaCallingScalaHashMap.java b/tests/disabled/java-interop/pos/t1642/JavaCallingScalaHashMap.java index 976e465ff..976e465ff 100644 --- a/tests/untried/pos/t1642/JavaCallingScalaHashMap.java +++ b/tests/disabled/java-interop/pos/t1642/JavaCallingScalaHashMap.java diff --git a/tests/untried/pos/t1711/Seq.scala b/tests/disabled/java-interop/pos/t1711/Seq.scala index c18f05cd7..c18f05cd7 100644 --- a/tests/untried/pos/t1711/Seq.scala +++ b/tests/disabled/java-interop/pos/t1711/Seq.scala diff --git a/tests/untried/pos/t1711/Test.java b/tests/disabled/java-interop/pos/t1711/Test.java index 5ec0f2297..5ec0f2297 100644 --- a/tests/untried/pos/t1711/Test.java +++ b/tests/disabled/java-interop/pos/t1711/Test.java diff --git a/tests/untried/pos/t1745/J.java b/tests/disabled/java-interop/pos/t1745/J.java index 8444eabb2..8444eabb2 100644 --- a/tests/untried/pos/t1745/J.java +++ b/tests/disabled/java-interop/pos/t1745/J.java diff --git a/tests/untried/pos/t1745/S.scala b/tests/disabled/java-interop/pos/t1745/S.scala index 84c437133..84c437133 100644 --- a/tests/untried/pos/t1745/S.scala +++ b/tests/disabled/java-interop/pos/t1745/S.scala diff --git a/tests/untried/pos/t1751/A1_2.scala b/tests/disabled/java-interop/pos/t1751/A1_2.scala index 354d5eecd..354d5eecd 100644 --- a/tests/untried/pos/t1751/A1_2.scala +++ b/tests/disabled/java-interop/pos/t1751/A1_2.scala diff --git a/tests/untried/pos/t1751/A2_1.scala b/tests/disabled/java-interop/pos/t1751/A2_1.scala index c768062e4..c768062e4 100644 --- a/tests/untried/pos/t1751/A2_1.scala +++ b/tests/disabled/java-interop/pos/t1751/A2_1.scala diff --git a/tests/untried/pos/t1751/SuiteClasses.java b/tests/disabled/java-interop/pos/t1751/SuiteClasses.java index a415e4f57..a415e4f57 100644 --- a/tests/untried/pos/t1751/SuiteClasses.java +++ b/tests/disabled/java-interop/pos/t1751/SuiteClasses.java diff --git a/tests/untried/pos/t1782/Ann.java b/tests/disabled/java-interop/pos/t1782/Ann.java index 0dcfbd2ed..0dcfbd2ed 100644 --- a/tests/untried/pos/t1782/Ann.java +++ b/tests/disabled/java-interop/pos/t1782/Ann.java diff --git a/tests/untried/pos/t1782/Days.java b/tests/disabled/java-interop/pos/t1782/Days.java index 203a87b1c..203a87b1c 100644 --- a/tests/untried/pos/t1782/Days.java +++ b/tests/disabled/java-interop/pos/t1782/Days.java diff --git a/tests/untried/pos/t1782/ImplementedBy.java b/tests/disabled/java-interop/pos/t1782/ImplementedBy.java index 6aa8b4fa9..6aa8b4fa9 100644 --- a/tests/untried/pos/t1782/ImplementedBy.java +++ b/tests/disabled/java-interop/pos/t1782/ImplementedBy.java diff --git a/tests/untried/pos/t1782/Test_1.scala b/tests/disabled/java-interop/pos/t1782/Test_1.scala index 6467a74c2..6467a74c2 100644 --- a/tests/untried/pos/t1782/Test_1.scala +++ b/tests/disabled/java-interop/pos/t1782/Test_1.scala diff --git a/tests/untried/pos/t1836/J.java b/tests/disabled/java-interop/pos/t1836/J.java index a009a59e2..a009a59e2 100644 --- a/tests/untried/pos/t1836/J.java +++ b/tests/disabled/java-interop/pos/t1836/J.java diff --git a/tests/untried/pos/t1836/S.scala b/tests/disabled/java-interop/pos/t1836/S.scala index 88ce1063e..88ce1063e 100644 --- a/tests/untried/pos/t1836/S.scala +++ b/tests/disabled/java-interop/pos/t1836/S.scala diff --git a/tests/untried/pos/t1840/J.java b/tests/disabled/java-interop/pos/t1840/J.java index fd98b6c4a..fd98b6c4a 100644 --- a/tests/untried/pos/t1840/J.java +++ b/tests/disabled/java-interop/pos/t1840/J.java diff --git a/tests/untried/pos/t1840/S.scala b/tests/disabled/java-interop/pos/t1840/S.scala index ff513d2c1..ff513d2c1 100644 --- a/tests/untried/pos/t1840/S.scala +++ b/tests/disabled/java-interop/pos/t1840/S.scala diff --git a/tests/untried/pos/t1937/NumberGenerator.java b/tests/disabled/java-interop/pos/t1937/NumberGenerator.java index 59d604733..59d604733 100644 --- a/tests/untried/pos/t1937/NumberGenerator.java +++ b/tests/disabled/java-interop/pos/t1937/NumberGenerator.java diff --git a/tests/untried/pos/t2377/Q.java b/tests/disabled/java-interop/pos/t2377/Q.java index e3d11c70e..e3d11c70e 100644 --- a/tests/untried/pos/t2377/Q.java +++ b/tests/disabled/java-interop/pos/t2377/Q.java diff --git a/tests/untried/pos/t2377/a.scala b/tests/disabled/java-interop/pos/t2377/a.scala index bda59ce0d..bda59ce0d 100644 --- a/tests/untried/pos/t2377/a.scala +++ b/tests/disabled/java-interop/pos/t2377/a.scala diff --git a/tests/untried/pos/t2409/J.java b/tests/disabled/java-interop/pos/t2409/J.java index 6b7c45ff6..6b7c45ff6 100644 --- a/tests/untried/pos/t2409/J.java +++ b/tests/disabled/java-interop/pos/t2409/J.java diff --git a/tests/untried/pos/t2409/t2409.scala b/tests/disabled/java-interop/pos/t2409/t2409.scala index 0412f7d82..0412f7d82 100644 --- a/tests/untried/pos/t2409/t2409.scala +++ b/tests/disabled/java-interop/pos/t2409/t2409.scala diff --git a/tests/untried/pos/t2413/TestJava.java b/tests/disabled/java-interop/pos/t2413/TestJava.java index 252c01fbc..252c01fbc 100644 --- a/tests/untried/pos/t2413/TestJava.java +++ b/tests/disabled/java-interop/pos/t2413/TestJava.java diff --git a/tests/untried/pos/t2413/TestScalac.scala b/tests/disabled/java-interop/pos/t2413/TestScalac.scala index 098e852dd..098e852dd 100644 --- a/tests/untried/pos/t2413/TestScalac.scala +++ b/tests/disabled/java-interop/pos/t2413/TestScalac.scala diff --git a/tests/untried/pos/t2433/A.java b/tests/disabled/java-interop/pos/t2433/A.java index 340690c40..340690c40 100755 --- a/tests/untried/pos/t2433/A.java +++ b/tests/disabled/java-interop/pos/t2433/A.java diff --git a/tests/untried/pos/t2433/B.java b/tests/disabled/java-interop/pos/t2433/B.java index 151dd71ca..151dd71ca 100755 --- a/tests/untried/pos/t2433/B.java +++ b/tests/disabled/java-interop/pos/t2433/B.java diff --git a/tests/untried/pos/t2433/Test.scala b/tests/disabled/java-interop/pos/t2433/Test.scala index 02fd89b64..02fd89b64 100755 --- a/tests/untried/pos/t2433/Test.scala +++ b/tests/disabled/java-interop/pos/t2433/Test.scala diff --git a/tests/untried/pos/t2464/JavaOne.java b/tests/disabled/java-interop/pos/t2464/JavaOne.java index ff36868a0..ff36868a0 100644 --- a/tests/untried/pos/t2464/JavaOne.java +++ b/tests/disabled/java-interop/pos/t2464/JavaOne.java diff --git a/tests/untried/pos/t2464/ScalaOne_1.scala b/tests/disabled/java-interop/pos/t2464/ScalaOne_1.scala index 1caf8ecae..1caf8ecae 100644 --- a/tests/untried/pos/t2464/ScalaOne_1.scala +++ b/tests/disabled/java-interop/pos/t2464/ScalaOne_1.scala diff --git a/tests/untried/pos/t2464/t2464_2.scala b/tests/disabled/java-interop/pos/t2464/t2464_2.scala index 13a52c952..13a52c952 100644 --- a/tests/untried/pos/t2464/t2464_2.scala +++ b/tests/disabled/java-interop/pos/t2464/t2464_2.scala diff --git a/tests/untried/pos/t1357.scala b/tests/disabled/not-representable/pos/t1357.scala index 05f8d20ed..4095168d2 100644 --- a/tests/untried/pos/t1357.scala +++ b/tests/disabled/not-representable/pos/t1357.scala @@ -1,3 +1,7 @@ +// Existential quantification cannot be expressed, and cannot be eliminated +// because it's F-bounded. Trying to paramerize BinaryTree with T instead also fails +// because the type alias cannot be represented + object NonEmptyCons { def unapply[H, T](c: (H, T)): Option[(H, T)] = Some(c) } diff --git a/tests/untried/pos/t1381-new.scala b/tests/disabled/not-representable/pos/t1381-new.scala index b0b300c6f..2944b1deb 100644 --- a/tests/untried/pos/t1381-new.scala +++ b/tests/disabled/not-representable/pos/t1381-new.scala @@ -1,3 +1,9 @@ +/* Gives + + t1381-new.scala:6: error: V is not a valid prefix for '#' + type E = V#ValueType + ^ + */ import scala.reflect.runtime.universe._ class D[V <: Variable] diff --git a/tests/untried/pos/t1803.flags b/tests/disabled/not-representable/pos/t1803.flags index d1a824416..d1a824416 100644 --- a/tests/untried/pos/t1803.flags +++ b/tests/disabled/not-representable/pos/t1803.flags diff --git a/tests/untried/pos/t1803.scala b/tests/disabled/not-representable/pos/t1803.scala index 42f4e784a..94b59a480 100644 --- a/tests/untried/pos/t1803.scala +++ b/tests/disabled/not-representable/pos/t1803.scala @@ -1,2 +1,3 @@ +// No parameter type inference in Dotty class A { def foo[A](a: A) = a } class B extends A { override def foo[A](b) = b } diff --git a/tests/untried/pos/t2066-2.10-compat.scala b/tests/disabled/not-representable/pos/t2066-2.10-compat.scala index fb8103e4a..9cbf0092a 100644 --- a/tests/untried/pos/t2066-2.10-compat.scala +++ b/tests/disabled/not-representable/pos/t2066-2.10-compat.scala @@ -33,6 +33,7 @@ trait B3 extends A3 { override def f[T[_]] = () // okay } +// These nested higher-kinded types are not parsable in Dotty= trait C3 extends A3 { override def f[T[-_]] = () } diff --git a/tests/untried/pos/t2066.scala b/tests/disabled/not-representable/pos/t2066.scala index 30cb99d45..30cb99d45 100644 --- a/tests/untried/pos/t2066.scala +++ b/tests/disabled/not-representable/pos/t2066.scala diff --git a/tests/neg/blockescapesNeg.scala b/tests/neg/blockescapesNeg.scala index 028ef5162..7b448ad23 100644 --- a/tests/neg/blockescapesNeg.scala +++ b/tests/neg/blockescapesNeg.scala @@ -1,5 +1,6 @@ object blockescapesNeg { - def m0 = { object Foo { class Bar } ; new Foo.Bar } + def m0 = { object Foo { class Bar { val field = 2 }} ; new Foo.Bar } + m0.field class A[T] def m1 = { val x = 1; new A[x.type]} -}
\ No newline at end of file +} diff --git a/tests/untried/pos/t1843.scala b/tests/neg/t1843.scala index 8504bf342..8504bf342 100644 --- a/tests/untried/pos/t1843.scala +++ b/tests/neg/t1843.scala diff --git a/tests/untried/pos/t2405.scala b/tests/new/t2405.scala index 224b2ce83..224b2ce83 100644 --- a/tests/untried/pos/t2405.scala +++ b/tests/new/t2405.scala diff --git a/tests/untried/pos/t2421.scala b/tests/new/t2421.scala index 2544a1cb3..2544a1cb3 100644 --- a/tests/untried/pos/t2421.scala +++ b/tests/new/t2421.scala diff --git a/tests/untried/pos/t2421_delitedsl.scala b/tests/new/t2421_delitedsl.scala index 2580592d9..554702a03 100644 --- a/tests/untried/pos/t2421_delitedsl.scala +++ b/tests/new/t2421_delitedsl.scala @@ -8,7 +8,9 @@ trait DeliteDSL { } case class DeliteInt(x: Int) extends Forcible[Int] - implicit val forcibleInt: DeliteDSL.this.<~<[Int,DeliteDSL.this.Forcible[Int]] = Forcible.factory(DeliteInt(_: Int)) + + implicit val forcibleInt: DeliteDSL.this.<~<[Int,DeliteDSL.this.Forcible[Int]] = + Forcible.factory((x: Int) => DeliteInt(x)) import scala.collection.Traversable class DeliteCollection[T](val xs: Traversable[T]) { diff --git a/tests/untried/pos/t2421b_pos.scala b/tests/new/t2421b_pos.scala index 679b8a8d6..679b8a8d6 100644 --- a/tests/untried/pos/t2421b_pos.scala +++ b/tests/new/t2421b_pos.scala diff --git a/tests/untried/pos/t2421c.scala b/tests/new/t2421c.scala index bd24cacd7..bd24cacd7 100644 --- a/tests/untried/pos/t2421c.scala +++ b/tests/new/t2421c.scala diff --git a/tests/untried/pos/t2425.scala b/tests/new/t2425.scala index 477d5467a..477d5467a 100755 --- a/tests/untried/pos/t2425.scala +++ b/tests/new/t2425.scala diff --git a/tests/untried/pos/t2435.scala b/tests/new/t2435.scala index 697e9e1f2..697e9e1f2 100644 --- a/tests/untried/pos/t2435.scala +++ b/tests/new/t2435.scala diff --git a/tests/untried/pos/t2441pos.scala b/tests/new/t2441pos.scala index 25eb2232c..25eb2232c 100644 --- a/tests/untried/pos/t2441pos.scala +++ b/tests/new/t2441pos.scala diff --git a/tests/untried/pos/t2444.scala b/tests/new/t2444.scala index fac1e95d0..fac1e95d0 100644 --- a/tests/untried/pos/t2444.scala +++ b/tests/new/t2444.scala diff --git a/tests/untried/pos/t245.scala b/tests/new/t245.scala index 570ac4178..570ac4178 100644 --- a/tests/untried/pos/t245.scala +++ b/tests/new/t245.scala diff --git a/tests/untried/pos/t247.scala b/tests/new/t247.scala index fdcafeb2c..fdcafeb2c 100644 --- a/tests/untried/pos/t247.scala +++ b/tests/new/t247.scala diff --git a/tests/untried/pos/t2484.scala b/tests/new/t2484.scala index 15165c247..15165c247 100755 --- a/tests/untried/pos/t2484.scala +++ b/tests/new/t2484.scala diff --git a/tests/untried/pos/t2486.scala b/tests/new/t2486.scala index 69fe4c127..69fe4c127 100644 --- a/tests/untried/pos/t2486.scala +++ b/tests/new/t2486.scala diff --git a/tests/pending/pos/boundspropagation.scala b/tests/pending/pos/boundspropagation.scala new file mode 100644 index 000000000..560d5416c --- /dev/null +++ b/tests/pending/pos/boundspropagation.scala @@ -0,0 +1,26 @@ +// scalac fails for test2/3 +// dotc fails for all three +object test1 { + class Tree[-T >: Null] + + + def f(x: Any): Tree[Null] = x match { + case y: Tree[_] => y + } +} +object test2 { + class Tree[T >: Null] + + + def f(x: Any): Tree[Null] = x match { + case y: Tree[_] => y + } +} +object test3 { + class Tree[+T >: Null] + + + def f(x: Any): Tree[Null] = x match { + case y: Tree[_] => y + } +} diff --git a/tests/untried/pos/t1756.scala b/tests/pending/pos/t1756.scala index 1d067c3b0..1d067c3b0 100755 --- a/tests/untried/pos/t1756.scala +++ b/tests/pending/pos/t1756.scala diff --git a/tests/untried/pos/t2454.scala b/tests/pending/pos/t2454.scala index 00f2e6f67..00f2e6f67 100644 --- a/tests/untried/pos/t2454.scala +++ b/tests/pending/pos/t2454.scala diff --git a/tests/pos/bigint.scala b/tests/pos/bigint.scala new file mode 100644 index 000000000..e1aaaf96e --- /dev/null +++ b/tests/pos/bigint.scala @@ -0,0 +1,7 @@ +import scala.math.BigInt +//import BigInt._ +object test { + + 1 * BigInt(0) + +} diff --git a/tests/pending/pos/t1164.scala b/tests/pos/t1164.scala index ab58c1d6b..ab58c1d6b 100644 --- a/tests/pending/pos/t1164.scala +++ b/tests/pos/t1164.scala diff --git a/tests/untried/pos/t1318.scala b/tests/pos/t1318.scala index 34e2bc8dd..34e2bc8dd 100644 --- a/tests/untried/pos/t1318.scala +++ b/tests/pos/t1318.scala diff --git a/tests/untried/pos/t1385.scala b/tests/pos/t1385.scala index aefd9c35b..aefd9c35b 100644 --- a/tests/untried/pos/t1385.scala +++ b/tests/pos/t1385.scala diff --git a/tests/untried/pos/t1391.scala b/tests/pos/t1391.scala index 5178ba987..5178ba987 100644 --- a/tests/untried/pos/t1391.scala +++ b/tests/pos/t1391.scala diff --git a/tests/untried/pos/t1422_pos.scala b/tests/pos/t1422_pos.scala index 658f5c730..658f5c730 100644 --- a/tests/untried/pos/t1422_pos.scala +++ b/tests/pos/t1422_pos.scala diff --git a/tests/untried/pos/t1438.scala b/tests/pos/t1438.scala index 221c3439d..221c3439d 100644 --- a/tests/untried/pos/t1438.scala +++ b/tests/pos/t1438.scala diff --git a/tests/untried/pos/t1439.scala b/tests/pos/t1439.scala index 0efcc74b6..0efcc74b6 100644 --- a/tests/untried/pos/t1439.scala +++ b/tests/pos/t1439.scala diff --git a/tests/untried/pos/t1480.scala b/tests/pos/t1480.scala index 1d9f94d2e..1d9f94d2e 100644 --- a/tests/untried/pos/t1480.scala +++ b/tests/pos/t1480.scala diff --git a/tests/untried/pos/t151.scala b/tests/pos/t151.scala index 86667b49f..86667b49f 100644 --- a/tests/untried/pos/t151.scala +++ b/tests/pos/t151.scala diff --git a/tests/untried/pos/t1560.scala b/tests/pos/t1560.scala index 2af299af8..dd76392e6 100644 --- a/tests/untried/pos/t1560.scala +++ b/tests/pos/t1560.scala @@ -4,7 +4,7 @@ object Test extends App { def t: T } - def b: Option[C[x] forSome { type x }] = null + def b: Option[C[_]] = null def c = b match { case Some(b) => b.t diff --git a/tests/pos/t1565.scala b/tests/pos/t1565.scala new file mode 100644 index 000000000..59d27a086 --- /dev/null +++ b/tests/pos/t1565.scala @@ -0,0 +1,19 @@ +object Bug1565 { + +// object X0 { 0; (a : Int, b : Int, c : Int) => println(List(a, b)) } // can't parse in Dotty +// def x() = { 0; (a : Int, b : Int) => println(List(a, b)) ; 0 } // can't parse in Dotty + +// (a : Int, b : Int) => println(List(a, b)) not legal as a template statement + + // various function syntaxes to exercise the parser + val xs = List(1,2,3) + xs.filter(x => x < 2) + xs.filter((x) => x < 2) + xs.filter { x => x < 2 } + xs.filter { _ < 2 } + xs.filter (_ < 2) + xs.foreach { e => + val buf0 = e + 1 + buf0 + } +} diff --git a/tests/untried/pos/t1569.scala b/tests/pos/t1569.scala index a7200a6d1..a7200a6d1 100644 --- a/tests/untried/pos/t1569.scala +++ b/tests/pos/t1569.scala diff --git a/tests/untried/pos/t159.scala b/tests/pos/t159.scala index 4d67f8aff..4d67f8aff 100644 --- a/tests/untried/pos/t159.scala +++ b/tests/pos/t159.scala diff --git a/tests/untried/pos/t1591_pos.scala b/tests/pos/t1591_pos.scala index 4f55d7ce1..4f55d7ce1 100644 --- a/tests/untried/pos/t1591_pos.scala +++ b/tests/pos/t1591_pos.scala diff --git a/tests/untried/pos/t160.scala b/tests/pos/t160.scala index 91ac2ba84..91ac2ba84 100644 --- a/tests/untried/pos/t160.scala +++ b/tests/pos/t160.scala diff --git a/tests/untried/pos/t1642b.scala b/tests/pos/t1642b.scala index 72e53b0c9..72e53b0c9 100644 --- a/tests/untried/pos/t1642b.scala +++ b/tests/pos/t1642b.scala diff --git a/tests/untried/pos/t1659.scala b/tests/pos/t1659.scala index 10470d66f..10470d66f 100644 --- a/tests/untried/pos/t1659.scala +++ b/tests/pos/t1659.scala diff --git a/tests/untried/pos/t1675.scala b/tests/pos/t1675.scala index 8630890ee..8630890ee 100644 --- a/tests/untried/pos/t1675.scala +++ b/tests/pos/t1675.scala diff --git a/tests/untried/pos/t1693.scala b/tests/pos/t1693.scala index 881bf89a0..881bf89a0 100644 --- a/tests/untried/pos/t1693.scala +++ b/tests/pos/t1693.scala diff --git a/tests/untried/pos/t1722-A.scala b/tests/pos/t1722-A.scala index d059bf22f..d059bf22f 100644 --- a/tests/untried/pos/t1722-A.scala +++ b/tests/pos/t1722-A.scala diff --git a/tests/untried/pos/t1722/Test.scala b/tests/pos/t1722/Test.scala index f236d3fdc..f236d3fdc 100755 --- a/tests/untried/pos/t1722/Test.scala +++ b/tests/pos/t1722/Test.scala diff --git a/tests/untried/pos/t1722/Top.scala b/tests/pos/t1722/Top.scala index 4ac52412a..4ac52412a 100755 --- a/tests/untried/pos/t1722/Top.scala +++ b/tests/pos/t1722/Top.scala diff --git a/tests/untried/pos/t175.scala b/tests/pos/t175.scala index 4c0eb28ba..4c0eb28ba 100644 --- a/tests/untried/pos/t175.scala +++ b/tests/pos/t175.scala diff --git a/tests/untried/pos/t177.scala b/tests/pos/t177.scala index 33b4de926..33b4de926 100644 --- a/tests/untried/pos/t177.scala +++ b/tests/pos/t177.scala diff --git a/tests/untried/pos/t1785.scala b/tests/pos/t1785.scala index 0b1fafb27..0b1fafb27 100644 --- a/tests/untried/pos/t1785.scala +++ b/tests/pos/t1785.scala diff --git a/tests/untried/pos/t1786-counter.scala b/tests/pos/t1786-counter.scala index a2431343d..a2431343d 100644 --- a/tests/untried/pos/t1786-counter.scala +++ b/tests/pos/t1786-counter.scala diff --git a/tests/untried/pos/t1786-cycle.scala b/tests/pos/t1786-cycle.scala index 9de149fbc..9de149fbc 100644 --- a/tests/untried/pos/t1786-cycle.scala +++ b/tests/pos/t1786-cycle.scala diff --git a/tests/untried/pos/t1789.scala b/tests/pos/t1789.scala index 1a37d48d0..1a37d48d0 100644 --- a/tests/untried/pos/t1789.scala +++ b/tests/pos/t1789.scala diff --git a/tests/untried/pos/t1798.scala b/tests/pos/t1798.scala index 1624e3025..1624e3025 100644 --- a/tests/untried/pos/t1798.scala +++ b/tests/pos/t1798.scala diff --git a/tests/untried/pos/t183.scala b/tests/pos/t183.scala index d7ed27f73..d7ed27f73 100644 --- a/tests/untried/pos/t183.scala +++ b/tests/pos/t183.scala diff --git a/tests/pos/t1832.scala b/tests/pos/t1832.scala new file mode 100644 index 000000000..9ad9703c2 --- /dev/null +++ b/tests/pos/t1832.scala @@ -0,0 +1,10 @@ +trait Cloning { + trait Foo + def fn(g: Any => Unit): Foo + + class Star { def *(a: Cloning.this.Foo): Cloning.this.Foo } + + implicit def mkStar(i: Int): Star = new Star { def *(a: Foo): Foo = null } + + val pool = 4 * fn { case ghostSYMBOL: Int => ghostSYMBOL * 2 } +} diff --git a/tests/pos/t1843.scala b/tests/pos/t1843.scala new file mode 100644 index 000000000..e9b5c5d2d --- /dev/null +++ b/tests/pos/t1843.scala @@ -0,0 +1,25 @@ +/** +* Scala Compiler Will Crash On this File +* ... Or Will It? +* +*/ + +object Crash { + trait UpdateType[A] + case class StateUpdate[+A](updateType : UpdateType[A], value : A) + case object IntegerUpdateType extends UpdateType[Integer] + + //However this method will cause a crash + def crash(updates: List[StateUpdate[_]]): Unit = { + updates match { + case Nil => + case u::us => + u match { + //Line below seems to be the crashing line + case StateUpdate(key, newValue) if (key == IntegerUpdateType) => + println("Requires a statement to induce the crash") + case _ => + } + } + } +} diff --git a/tests/untried/pos/t1858.scala b/tests/pos/t1858.scala index c06e73e7e..c06e73e7e 100644 --- a/tests/untried/pos/t1858.scala +++ b/tests/pos/t1858.scala diff --git a/tests/untried/pos/t1896/D0.scala b/tests/pos/t1896/D0.scala index 6b3150d96..6b3150d96 100644 --- a/tests/untried/pos/t1896/D0.scala +++ b/tests/pos/t1896/D0.scala diff --git a/tests/untried/pos/t1896/D1.scala b/tests/pos/t1896/D1.scala index e1ab50679..e1ab50679 100644 --- a/tests/untried/pos/t1896/D1.scala +++ b/tests/pos/t1896/D1.scala diff --git a/tests/untried/pos/t1942/A_1.scala b/tests/pos/t1942/A_1.scala index 4915b54a6..4915b54a6 100644 --- a/tests/untried/pos/t1942/A_1.scala +++ b/tests/pos/t1942/A_1.scala diff --git a/tests/untried/pos/t1942/Test_2.scala b/tests/pos/t1942/Test_2.scala index 6c045bbce..6c045bbce 100644 --- a/tests/untried/pos/t1942/Test_2.scala +++ b/tests/pos/t1942/Test_2.scala diff --git a/tests/untried/pos/t1957.scala b/tests/pos/t1957.scala index 711ce17de..711ce17de 100644 --- a/tests/untried/pos/t1957.scala +++ b/tests/pos/t1957.scala diff --git a/tests/untried/pos/t1974.scala b/tests/pos/t1974.scala index 3f4d41e7f..3f4d41e7f 100644 --- a/tests/untried/pos/t1974.scala +++ b/tests/pos/t1974.scala diff --git a/tests/untried/pos/t1987a.scala b/tests/pos/t1987a.scala index ccab13371..ccab13371 100644 --- a/tests/untried/pos/t1987a.scala +++ b/tests/pos/t1987a.scala diff --git a/tests/untried/pos/t1987b/a.scala b/tests/pos/t1987b/a.scala index ff27044b6..ff27044b6 100644 --- a/tests/untried/pos/t1987b/a.scala +++ b/tests/pos/t1987b/a.scala diff --git a/tests/untried/pos/t1987b/b.scala b/tests/pos/t1987b/b.scala index a469ca6ea..a469ca6ea 100644 --- a/tests/untried/pos/t1987b/b.scala +++ b/tests/pos/t1987b/b.scala diff --git a/tests/untried/pos/t1996.scala b/tests/pos/t1996.scala index 273012819..273012819 100644 --- a/tests/untried/pos/t1996.scala +++ b/tests/pos/t1996.scala diff --git a/tests/untried/pos/t201.scala b/tests/pos/t201.scala index b0c6b8da4..b0c6b8da4 100644 --- a/tests/untried/pos/t201.scala +++ b/tests/pos/t201.scala diff --git a/tests/untried/pos/t2018.scala b/tests/pos/t2018.scala index 198b4be42..198b4be42 100644 --- a/tests/untried/pos/t2018.scala +++ b/tests/pos/t2018.scala diff --git a/tests/untried/pos/t2023.scala b/tests/pos/t2023.scala index 21c6fc96a..21c6fc96a 100644 --- a/tests/untried/pos/t2023.scala +++ b/tests/pos/t2023.scala diff --git a/tests/untried/pos/t2038.scala b/tests/pos/t2038.scala index 8c8ca44da..8c8ca44da 100644 --- a/tests/untried/pos/t2038.scala +++ b/tests/pos/t2038.scala diff --git a/tests/untried/pos/t2060.scala b/tests/pos/t2060.scala index 0b9079062..0b9079062 100755 --- a/tests/untried/pos/t2060.scala +++ b/tests/pos/t2060.scala diff --git a/tests/untried/pos/t2081.scala b/tests/pos/t2081.scala index 395134f71..395134f71 100644 --- a/tests/untried/pos/t2081.scala +++ b/tests/pos/t2081.scala diff --git a/tests/untried/pos/t2082.scala b/tests/pos/t2082.scala index a7ee3789b..a7ee3789b 100755 --- a/tests/untried/pos/t2082.scala +++ b/tests/pos/t2082.scala diff --git a/tests/untried/pos/t2094.scala b/tests/pos/t2094.scala index 6b6c4f077..6b6c4f077 100644 --- a/tests/untried/pos/t2094.scala +++ b/tests/pos/t2094.scala diff --git a/tests/untried/pos/t210.scala b/tests/pos/t210.scala index f0b907aa5..f0b907aa5 100644 --- a/tests/untried/pos/t210.scala +++ b/tests/pos/t210.scala diff --git a/tests/untried/pos/t211.scala b/tests/pos/t211.scala index d51c9706d..d51c9706d 100644 --- a/tests/untried/pos/t211.scala +++ b/tests/pos/t211.scala diff --git a/tests/untried/pos/t2119.scala b/tests/pos/t2119.scala index b9cb4d9c6..b9cb4d9c6 100644 --- a/tests/untried/pos/t2119.scala +++ b/tests/pos/t2119.scala diff --git a/tests/untried/pos/t2127.scala b/tests/pos/t2127.scala index 88cc9e708..88cc9e708 100644 --- a/tests/untried/pos/t2127.scala +++ b/tests/pos/t2127.scala diff --git a/tests/untried/pos/t2130-1.scala b/tests/pos/t2130-1.scala index 8dd61c4d3..8dd61c4d3 100644 --- a/tests/untried/pos/t2130-1.scala +++ b/tests/pos/t2130-1.scala diff --git a/tests/untried/pos/t2130-2.scala b/tests/pos/t2130-2.scala index 1d0b33c3e..1d0b33c3e 100644 --- a/tests/untried/pos/t2130-2.scala +++ b/tests/pos/t2130-2.scala diff --git a/tests/untried/pos/t2133.scala b/tests/pos/t2133.scala index c74d0a4bb..02ef43c21 100644 --- a/tests/untried/pos/t2133.scala +++ b/tests/pos/t2133.scala @@ -1,6 +1,6 @@ trait Foo { object bar { - private[this] def fn() = 5 + private def fn() = 5 } } diff --git a/tests/untried/pos/t2168.scala b/tests/pos/t2168.scala index 21afb239a..21afb239a 100644 --- a/tests/untried/pos/t2168.scala +++ b/tests/pos/t2168.scala diff --git a/tests/untried/pos/t2171.flags b/tests/pos/t2171.flags index eb4d19bcb..eb4d19bcb 100644 --- a/tests/untried/pos/t2171.flags +++ b/tests/pos/t2171.flags diff --git a/tests/untried/pos/t2171.scala b/tests/pos/t2171.scala index 6c754c76a..6c754c76a 100644 --- a/tests/untried/pos/t2171.scala +++ b/tests/pos/t2171.scala diff --git a/tests/untried/pos/t2179.scala b/tests/pos/t2179.scala index 89e22b6e2..89e22b6e2 100755 --- a/tests/untried/pos/t2179.scala +++ b/tests/pos/t2179.scala diff --git a/tests/untried/pos/t2183.scala b/tests/pos/t2183.scala index 1243568b6..1243568b6 100644 --- a/tests/untried/pos/t2183.scala +++ b/tests/pos/t2183.scala diff --git a/tests/untried/pos/t2187-2.scala b/tests/pos/t2187-2.scala index 506cc496f..506cc496f 100644 --- a/tests/untried/pos/t2187-2.scala +++ b/tests/pos/t2187-2.scala diff --git a/tests/untried/pos/t2187.scala b/tests/pos/t2187.scala index 8a3353154..8a3353154 100644 --- a/tests/untried/pos/t2187.scala +++ b/tests/pos/t2187.scala diff --git a/tests/untried/pos/t2194.scala b/tests/pos/t2194.scala index e87be509d..e87be509d 100644 --- a/tests/untried/pos/t2194.scala +++ b/tests/pos/t2194.scala diff --git a/tests/untried/pos/t2208_pos.scala b/tests/pos/t2208_pos.scala index dd6d686ba..dd6d686ba 100644 --- a/tests/untried/pos/t2208_pos.scala +++ b/tests/pos/t2208_pos.scala diff --git a/tests/untried/pos/t2234.scala b/tests/pos/t2234.scala index 218e9f5e5..218e9f5e5 100644 --- a/tests/untried/pos/t2234.scala +++ b/tests/pos/t2234.scala diff --git a/tests/untried/pos/t2260.scala b/tests/pos/t2260.scala index 4e4cc5ab2..4e4cc5ab2 100644 --- a/tests/untried/pos/t2260.scala +++ b/tests/pos/t2260.scala diff --git a/tests/untried/pos/t2261.scala b/tests/pos/t2261.scala index 06360d500..06360d500 100644 --- a/tests/untried/pos/t2261.scala +++ b/tests/pos/t2261.scala diff --git a/tests/untried/pos/t229.scala b/tests/pos/t229.scala index 72ddfa74f..72ddfa74f 100644 --- a/tests/untried/pos/t229.scala +++ b/tests/pos/t229.scala diff --git a/tests/untried/pos/t2293.scala b/tests/pos/t2293.scala index 536d4ec3d..536d4ec3d 100644 --- a/tests/untried/pos/t2293.scala +++ b/tests/pos/t2293.scala diff --git a/tests/untried/pos/t2305.scala b/tests/pos/t2305.scala index 3338ab911..3338ab911 100644 --- a/tests/untried/pos/t2305.scala +++ b/tests/pos/t2305.scala diff --git a/tests/untried/pos/t2310.scala b/tests/pos/t2310.scala index 68912b496..68912b496 100644 --- a/tests/untried/pos/t2310.scala +++ b/tests/pos/t2310.scala diff --git a/tests/untried/pos/t2331.scala b/tests/pos/t2331.scala index a7f80ac98..a7f80ac98 100644 --- a/tests/untried/pos/t2331.scala +++ b/tests/pos/t2331.scala diff --git a/tests/untried/pos/t2399.scala b/tests/pos/t2399.scala index a99998a0a..a99998a0a 100644 --- a/tests/untried/pos/t2399.scala +++ b/tests/pos/t2399.scala diff --git a/tests/untried/pos/t2429.scala b/tests/pos/t2429.scala index 4cda3bde1..4cda3bde1 100755 --- a/tests/untried/pos/t2429.scala +++ b/tests/pos/t2429.scala diff --git a/tests/pos/typeinferNull.scala b/tests/pos/typeinferNull.scala new file mode 100644 index 000000000..ba25ae181 --- /dev/null +++ b/tests/pos/typeinferNull.scala @@ -0,0 +1,9 @@ +object typeinferNull { + + val x1 = null :: Nil + val x2 = List(null) + + var y1: List[Null] = x1 + y1 = x2 + +} diff --git a/tests/untried/pos/t0002.scala b/tests/untried/pos/t0002.scala deleted file mode 100644 index 4c58ed3f4..000000000 --- a/tests/untried/pos/t0002.scala +++ /dev/null @@ -1,6 +0,0 @@ -object main { - def main(args: Array[String]) = { - val b = true; - while (b == true) { } - } -} diff --git a/tests/untried/pos/t0017.scala b/tests/untried/pos/t0017.scala deleted file mode 100644 index d2bcda08d..000000000 --- a/tests/untried/pos/t0017.scala +++ /dev/null @@ -1,21 +0,0 @@ -class Quantity { - def getValue = 0; - def connect(c: Constraint) = c.newValue; -} - -abstract class Constraint(q: Quantity) { - def newValue: Unit; - q connect this -} - -class Adder(q: Quantity) extends Constraint(q) { - def newValue = Console.println(q.getValue); -} - -object Main { - def main(args: Array[String]): Unit = { - val x = new Quantity; - new Adder(x); - () - } -} diff --git a/tests/untried/pos/t0020.scala b/tests/untried/pos/t0020.scala deleted file mode 100644 index 4f1e5b173..000000000 --- a/tests/untried/pos/t0020.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Exceptions { - - class CubeException(s: String) extends RuntimeException(s); - - def main(args: Array[String]) = - Console.println(new CubeException("test")); - -} diff --git a/tests/untried/pos/t0029.scala b/tests/untried/pos/t0029.scala deleted file mode 100644 index 937b6d70c..000000000 --- a/tests/untried/pos/t0029.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Main { - def f[a]: List[List[a]] = for (l1 <- Nil; l2 <- Nil) yield l1 -} diff --git a/tests/untried/pos/t0030.scala b/tests/untried/pos/t0030.scala deleted file mode 100644 index 2f23be14d..000000000 --- a/tests/untried/pos/t0030.scala +++ /dev/null @@ -1,9 +0,0 @@ -trait A { - def f(x: Int): Unit; - def f(x: String): Unit; -} - -class B extends A { - def f(x: Int): Unit = (); - def f(x: String): Unit = (); -} diff --git a/tests/untried/pos/t0031.scala b/tests/untried/pos/t0031.scala deleted file mode 100644 index d4050c818..000000000 --- a/tests/untried/pos/t0031.scala +++ /dev/null @@ -1,29 +0,0 @@ -object Main { - - trait Ensure[a] { - def ensure(postcondition: a => Boolean): a - } - - def require[a](precondition: => Boolean)(command: => a): Ensure[a] = - if (precondition) - new Ensure[a] { - def ensure(postcondition: a => Boolean): a = { - val result = command; - if (postcondition(result)) result - else sys.error("Assertion error") - } - } - else - sys.error("Assertion error"); - - def arb[a](s: List[a]) = - require (! s.isEmpty) { - s.head - } ensure (result => s contains result); - - def main(args: Array[String]) = { - val s = List(1, 2); - Console.println(arb(s)) - } - -} diff --git a/tests/untried/pos/t0032.scala b/tests/untried/pos/t0032.scala deleted file mode 100644 index 727a7d4e9..000000000 --- a/tests/untried/pos/t0032.scala +++ /dev/null @@ -1,17 +0,0 @@ -import java.io.{OutputStream, PrintStream}; - -class PromptStream(s: OutputStream) extends PrintStream(s) { - override def println() = super.println(); -} - -object Main { - - val out = new PromptStream(java.lang.System.out); - - java.lang.System.setOut(out); - - def main(args: Array[String]) = - //out.println("hello world"); - () - -} diff --git a/tests/untried/pos/t0036.scala b/tests/untried/pos/t0036.scala deleted file mode 100644 index 3c9a84f8a..000000000 --- a/tests/untried/pos/t0036.scala +++ /dev/null @@ -1,8 +0,0 @@ -object m { - - val xs: List[Int] = Nil - def f(i: Int) = 0 - val v = xs map f - - def m() = {} -} diff --git a/tests/untried/pos/t0039.scala b/tests/untried/pos/t0039.scala deleted file mode 100644 index 652c606b0..000000000 --- a/tests/untried/pos/t0039.scala +++ /dev/null @@ -1,6 +0,0 @@ -abstract class Extensible[A, This <: Extensible[A, This]](x: A, xs: This) { self: This => - def mkObj(x: A, xs: This): This; -} -class Fixed[A](x: A, xs: Fixed[A]) extends Extensible[A, Fixed[A]](x, xs) { - def mkObj(x: A, xs: Fixed[A]) = new Fixed(x, xs); -} diff --git a/tests/untried/pos/t0049.scala b/tests/untried/pos/t0049.scala deleted file mode 100644 index dd8664226..000000000 --- a/tests/untried/pos/t0049.scala +++ /dev/null @@ -1,3 +0,0 @@ -class C1(x: AnyRef) {}; - -class C2 extends C1({ class A extends AnyRef {}; (new A) : AnyRef }) {}; diff --git a/tests/untried/pos/t0053.scala b/tests/untried/pos/t0053.scala deleted file mode 100644 index 44763ef14..000000000 --- a/tests/untried/pos/t0053.scala +++ /dev/null @@ -1,7 +0,0 @@ -object bug { - def foobar[c]: Int = { - class Foo { def foo: Bar = new Bar(); } - class Bar { def bar: c = bar; } - 0 - } -} diff --git a/tests/untried/pos/t0054.scala b/tests/untried/pos/t0054.scala deleted file mode 100644 index 670160f36..000000000 --- a/tests/untried/pos/t0054.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A { - case class B(x: C) extends A { val z: A.this.C = x } - class C {} -} diff --git a/tests/untried/pos/t0055.scala b/tests/untried/pos/t0055.scala deleted file mode 100644 index 079629440..000000000 --- a/tests/untried/pos/t0055.scala +++ /dev/null @@ -1,6 +0,0 @@ -class X(x : Any) -class W { - new X(new Z() with Y) {} - trait Y { def y = () } -} -class Z(r : Any) { def this() = this(null) } diff --git a/tests/untried/pos/t0061.scala b/tests/untried/pos/t0061.scala deleted file mode 100644 index dd3f94f30..000000000 --- a/tests/untried/pos/t0061.scala +++ /dev/null @@ -1,10 +0,0 @@ -object O { - - class testClass ; - - case class testA() extends testClass ; // works if you leave away "extends..." - // or if you write TestA - def ga( x:testClass ) = x match { - case testA() => () - } -} diff --git a/tests/untried/pos/t0064.scala b/tests/untried/pos/t0064.scala deleted file mode 100644 index 1eeca8dca..000000000 --- a/tests/untried/pos/t0064.scala +++ /dev/null @@ -1,6 +0,0 @@ -object B { - def main(Args:Array[String]) = { - val (_,x) = (1,2); - x + 1; - } -} diff --git a/tests/untried/pos/t0066.scala b/tests/untried/pos/t0066.scala deleted file mode 100644 index 2153264e7..000000000 --- a/tests/untried/pos/t0066.scala +++ /dev/null @@ -1,7 +0,0 @@ -class GBTree[A, B] /*with Map[A, B, GBTree[A,B]]*/ { - abstract class Tree[A,B]; - case class Node[A,B](key:A,value:B,smaller:Node[A,B],bigger:Node[A,B]) - extends Tree[A,B]; - case class Nil[A,B]() extends Tree[A,B]; - -} diff --git a/tests/untried/pos/t0068.scala b/tests/untried/pos/t0068.scala deleted file mode 100644 index beb2c7c0a..000000000 --- a/tests/untried/pos/t0068.scala +++ /dev/null @@ -1,6 +0,0 @@ -class E { - def f() = { - val (_::l1) = List(1,2,3); - l1.tail; - } -} diff --git a/tests/untried/pos/t0069.scala b/tests/untried/pos/t0069.scala deleted file mode 100644 index e4c242c0e..000000000 --- a/tests/untried/pos/t0069.scala +++ /dev/null @@ -1,10 +0,0 @@ -object testCQ { - // why does this not work directly - case class Thing( name:String, contains:List[ Thing ] ); - - /* ... but this one does? - abstract class T; - case class Thing2( name:String, contains:List[ T ] ) extends T; - */ - -} diff --git a/tests/untried/pos/t0076.scala b/tests/untried/pos/t0076.scala deleted file mode 100644 index 5419cf515..000000000 --- a/tests/untried/pos/t0076.scala +++ /dev/null @@ -1,9 +0,0 @@ -// This is extracted from a test file => don't add a new test file. -object bug { - def foo(i: => Int): Int = 0; - - def bar: Int = { - var i: Int = 0; - foo (i); - } -} diff --git a/tests/untried/pos/t0081.scala b/tests/untried/pos/t0081.scala deleted file mode 100644 index 20fd60497..000000000 --- a/tests/untried/pos/t0081.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A { - val b: A#B = new B; - class B {} -} diff --git a/tests/untried/pos/t0082.scala b/tests/untried/pos/t0082.scala deleted file mode 100644 index 2b365ca33..000000000 --- a/tests/untried/pos/t0082.scala +++ /dev/null @@ -1,18 +0,0 @@ - -object Main { - - def min0[A](less: (A, A) => Boolean, xs: List[A]): Option[A] = xs match { - case List() => None - case List(x) => Some(x) -// case x :: Nil => Some(x) - case y :: ys => (min0(less, ys): @unchecked) match { - case Some(m) => if (less(y, m)) Some(y) else Some(m) - } - } - - def min(xs: List[Int]) = min0((x: Int, y: Int) => x < y, xs); - - def main(args: Array[String]) = - Console.println(min(List())); - -} diff --git a/tests/untried/pos/t0085.scala b/tests/untried/pos/t0085.scala deleted file mode 100644 index e018afb6e..000000000 --- a/tests/untried/pos/t0085.scala +++ /dev/null @@ -1,8 +0,0 @@ -object A { - case class B(c: C) { - class C; - } - class C; - val b: B = new B(new C()); - val c: C = b.c; -} diff --git a/tests/untried/pos/t0091.scala b/tests/untried/pos/t0091.scala deleted file mode 100644 index d491b7cfb..000000000 --- a/tests/untried/pos/t0091.scala +++ /dev/null @@ -1,6 +0,0 @@ -class Bug { - def main(args: Array[String]) = { - var msg: String = null; // no bug if "null" instead of "_" - val f: PartialFunction[Any, Unit] = { case 42 => msg = "coucou" }; - } -} diff --git a/tests/untried/pos/t0093.scala b/tests/untried/pos/t0093.scala deleted file mode 100644 index d648d773b..000000000 --- a/tests/untried/pos/t0093.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Bug { - def f(cond: => Boolean) = while (cond == false) {}; - // no bug with "false == cond" -} diff --git a/tests/untried/pos/t0095.scala b/tests/untried/pos/t0095.scala deleted file mode 100644 index 71386cf5c..000000000 --- a/tests/untried/pos/t0095.scala +++ /dev/null @@ -1,15 +0,0 @@ -class ParseResult[+T] -case class Success[+T](t: T) extends ParseResult[T] - -abstract class Nonterminal[Output] { - - type SubNonterminal = Nonterminal[T] forSome { type T <: Output } - - def parse: ParseResult[Output] - - def parse1(nts: List[SubNonterminal]): ParseResult[Output] = - nts match { - case nt::nts => nt.parse match { case Success(so) => Success(so) } - case Nil => throw new Error - } -} diff --git a/tests/untried/pos/t1381-old.scala b/tests/untried/pos/t1381-old.scala deleted file mode 100644 index 076289189..000000000 --- a/tests/untried/pos/t1381-old.scala +++ /dev/null @@ -1,31 +0,0 @@ -import scala.reflect.Manifest - -class D[V <: Variable] - -class ID[V<:IV] extends D[V] { - type E = V#ValueType - def index(value:E) : Int = 0 - // Comment this out to eliminate crash. Or see below - def index(values:E*) : Iterable[Int] = null -} - -abstract class Variable { - type VT <: Variable - def d : D[VT] = null -} - -abstract class PV[T](initval:T) extends Variable { - type VT <: PV[T] - type ValueType = T -} - -trait IV extends Variable { - type ValueType -} - -abstract class EV[T](initval:T) extends PV[T](initval) with IV { - type VT <: EV[T] - override def d : ID[VT] = null - // Comment this out to eliminate crash - protected var indx = d.index(initval) -} diff --git a/tests/untried/pos/t1439.flags b/tests/untried/pos/t1439.flags deleted file mode 100644 index bca57e478..000000000 --- a/tests/untried/pos/t1439.flags +++ /dev/null @@ -1 +0,0 @@ --unchecked -Xfatal-warnings -language:higherKinds diff --git a/tests/untried/pos/t1565.scala b/tests/untried/pos/t1565.scala deleted file mode 100644 index df333151d..000000000 --- a/tests/untried/pos/t1565.scala +++ /dev/null @@ -1,18 +0,0 @@ -object Bug1565 { - object X0 { 0; (a : Int, b : Int, c : Int) => println(List(a, b)) } - def x() = { 0; (a : Int, b : Int) => println(List(a, b)) ; 0 } - - (a : Int, b : Int) => println(List(a, b)) - - // various function syntaxes to exercise the parser - val xs = List(1,2,3) - xs.filter(x => x < 2) - xs.filter((x) => x < 2) - xs.filter { x => x < 2 } - xs.filter { _ < 2 } - xs.filter (_ < 2) - xs.foreach { e => - val buf0 = e + 1 - buf0 - } -} diff --git a/tests/untried/pos/t1591b.scala b/tests/untried/pos/t1591b.scala deleted file mode 100644 index c671ad647..000000000 --- a/tests/untried/pos/t1591b.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.tools.nsc._ - -class SemanticTokens(val compiler: Global) { - import compiler._ - - def build() = ErrorType - - class Process { - def f() = analyzer - // or to crash the compiler instead of a nice message, - // def f() = analyzer underlying _ - } -} diff --git a/tests/untried/pos/t1614/bar.scala b/tests/untried/pos/t1614/bar.scala index be994c3af..0b69a8462 100644 --- a/tests/untried/pos/t1614/bar.scala +++ b/tests/untried/pos/t1614/bar.scala @@ -1,4 +1,4 @@ // bar.scala object Bar { - val a = new FooImpl with AbstractOverrideFoo + val a = new FooImpl with AbstractOverrideFoo } diff --git a/tests/untried/pos/t1614/foo.scala b/tests/untried/pos/t1614/foo.scala index 5db548ac7..de225b9e5 100644 --- a/tests/untried/pos/t1614/foo.scala +++ b/tests/untried/pos/t1614/foo.scala @@ -1,6 +1,6 @@ // foo.scala trait Foo { - def foo(arg: List[_]) + def foo(arg: List[_]) } trait FooImpl extends Foo { def foo(arg: List[_]): Unit = {} diff --git a/tests/untried/pos/t1832.scala b/tests/untried/pos/t1832.scala deleted file mode 100644 index 3a5280640..000000000 --- a/tests/untried/pos/t1832.scala +++ /dev/null @@ -1,8 +0,0 @@ -trait Cloning { - trait Foo - def fn(g: Any => Unit): Foo - - implicit def mkStar(i: Int): AnyRef{def *(a: Cloning.this.Foo): Cloning.this.Foo} = new { def *(a: Foo): Foo = null } - - val pool = 4 * fn { case ghostSYMBOL: Int => ghostSYMBOL * 2 } -} diff --git a/tests/untried/pos/t2066-2.10-compat.flags b/tests/untried/pos/t2066-2.10-compat.flags deleted file mode 100644 index 94c805674..000000000 --- a/tests/untried/pos/t2066-2.10-compat.flags +++ /dev/null @@ -1 +0,0 @@ --Xsource:2.10 |