Commit ba24fe1
committed
Add test file for semanticdb and ignore symbol lookup failures
```scala
val a: String = (((1: Any): b.A): Nothing): String
val b: { type A >: Any <: Nothing } = loop()
```
We can't resolve a symbol of `b.A` in `(1: Any): b.A` because
semanticdb generator basically resolves the symbol of refinement members
(like `type A` of `b`) by
- Traverse trees and collect symbol information by **depth-first** way
- during the traversal, we register the symbols of refinement members
to a symbol table.
- Then outer part of program can resolve the symbol of refinements by
looking up symbols from the symbol table.
However, in this case, we failed to resolve the symbol of b.A bacause
- (1) We try to lookup the symbol of `b.A` first, which has not yet
registered to the symtab.
- (2) And then register a symbol for A in b by traversing `b`.
Maybe we could fix this issue by
- (a) Generate fake symbol for `b.A` in (1), and register it to the symtab
- (b) in (2), when we register the "real" symbol of `A`, it should
collide with the symbol registered in step (a)
- (c) if they had collision, we mark those symbols
(fake one and real one) as an alias
- (d) on building the semanticdb symbol, we use the same symbol for both
fake one and real one1 parent 8465366 commit ba24fe1
File tree
4 files changed
+59
-1
lines changed- compiler/src/dotty/tools/dotc/semanticdb
- tests/semanticdb
- expect
4 files changed
+59
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3880 | 3880 | | |
3881 | 3881 | | |
3882 | 3882 | | |
| 3883 | + | |
| 3884 | + | |
| 3885 | + | |
| 3886 | + | |
| 3887 | + | |
| 3888 | + | |
| 3889 | + | |
| 3890 | + | |
| 3891 | + | |
| 3892 | + | |
| 3893 | + | |
| 3894 | + | |
| 3895 | + | |
| 3896 | + | |
| 3897 | + | |
| 3898 | + | |
| 3899 | + | |
| 3900 | + | |
| 3901 | + | |
| 3902 | + | |
| 3903 | + | |
| 3904 | + | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
| 3908 | + | |
| 3909 | + | |
| 3910 | + | |
| 3911 | + | |
| 3912 | + | |
| 3913 | + | |
| 3914 | + | |
| 3915 | + | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + | |
| 3919 | + | |
3883 | 3920 | | |
3884 | 3921 | | |
3885 | 3922 | | |
| |||
0 commit comments