Commit 0931c43
committed
Fix instantiating subtypes with outer references
Minimising from the `case test.Generic =>` in ParallelTesting, the
anonymous pattern match is expanded, wrapping the match with
`applyOrElse`, which has a type parameter A1 as the scrutinee type, with
an upper bound of the original element type (out.Foo for us). During
reachability analysis the pattern type, e.g. out.Bar3.type, is
intersected with the scrutinee type, A1 - giving out.Bar3.type & A1.
Then that we attempt to decompose that type. Previously the abstract A1
in that type lead to 3 WildcardTypes, for the 3 subclasses, which are a
subtype of previous cases.
The fix that by generalising how we recognise the singleton types in the
scrutinee type, so instead of the ownership chain we use the parameter
type info, and we also match term parameters. For extra correctness
we consider the failure to be a subtype of a mixin as a failure for
instantiating.
Also, make sure to handle and avoid recursion in traverseTp2.1 parent 7e47294 commit 0931c43
File tree
3 files changed
+44
-20
lines changed- compiler/src/dotty/tools/dotc/core
- tests/pos
3 files changed
+44
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
839 | 839 | | |
840 | 840 | | |
841 | 841 | | |
842 | | - | |
| 842 | + | |
843 | 843 | | |
844 | | - | |
845 | | - | |
| 844 | + | |
| 845 | + | |
846 | 846 | | |
847 | | - | |
| 847 | + | |
848 | 848 | | |
849 | 849 | | |
850 | 850 | | |
851 | | - | |
852 | | - | |
| 851 | + | |
| 852 | + | |
853 | 853 | | |
854 | | - | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
855 | 858 | | |
856 | 859 | | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
863 | 864 | | |
864 | 865 | | |
865 | | - | |
| 866 | + | |
866 | 867 | | |
867 | | - | |
868 | | - | |
| 868 | + | |
| 869 | + | |
869 | 870 | | |
870 | 871 | | |
871 | 872 | | |
| |||
875 | 876 | | |
876 | 877 | | |
877 | 878 | | |
878 | | - | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
879 | 883 | | |
880 | | - | |
881 | | - | |
| 884 | + | |
| 885 | + | |
882 | 886 | | |
883 | 887 | | |
884 | 888 | | |
| |||
913 | 917 | | |
914 | 918 | | |
915 | 919 | | |
916 | | - | |
| 920 | + | |
| 921 | + | |
917 | 922 | | |
918 | 923 | | |
919 | 924 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
0 commit comments