-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SemanticDB] Fix missing symbol occurrence of type params' type bounds for constructor #13284
[SemanticDB] Fix missing symbol occurrence of type params' type bounds for constructor #13284
Conversation
c67e283
to
5d3bdf3
Compare
trait Obj/*<-_empty_::Obj#*/[T/*<-_empty_::Obj#[T]*/ <: Txn/*->_empty_::Txn#*/[T/*->_empty_::Obj#[T]*/]] extends Elem/*->_empty_::Elem#*/[T/*->_empty_::Obj#[T]*/] | ||
|
||
trait Copy/*<-_empty_::Copy#*/[In/*<-_empty_::Copy#[In]*/ <: Txn/*->_empty_::Txn#*/[In/*->_empty_::Copy#[In]*/], Out/*<-_empty_::Copy#[Out]*/ <: Txn/*->_empty_::Txn#*/[Out/*->_empty_::Copy#[Out]*/]] { | ||
def copyImpl/*<-_empty_::Copy#copyImpl().*/[Repr/*<-_empty_::Copy#copyImpl().[Repr]*/[~ <: Txn[~]] <: Elem[~]](in/*<-_empty_::Copy#copyImpl().(in)*/: Repr/*->_empty_::Copy#copyImpl().[Repr]*/[In/*->_empty_::Copy#[In]*/]): Repr/*->_empty_::Copy#copyImpl().[Repr]*/[Out/*->_empty_::Copy#[Out]*/] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like here that there are no occurrences for the parameters of Repr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although looking at the tree it seems maybe something else is hiding the occurrence:
-- Info: /Users/jamie/Workspace/dotty/tests/semanticdb/expect/i9782.scala:9:6 --
9 | def copyImpl[Repr[~ <: Txn[~]] <: Elem[~]](in: Repr[In]): Repr[Out]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|here is a defdef tree: DefDef(copyImpl,List(List(TypeDef(Repr,LambdaTypeTree(List(TypeDef(~,TypeBoundsTree(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)],AppliedTypeTree(Ident(Txn),List(Ident(~))),EmptyTree))),TypeBoundsTree(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)],AppliedTypeTree(Ident(Elem),List(Ident(~))),EmptyTree)))), List(ValDef(in,AppliedTypeTree(Ident(Repr),List(Ident(In))),EmptyTree))),AppliedTypeTree(Ident(Repr),List(Ident(Out))),EmptyTree)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be addressed separately in a new PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. I think we can fix it in this PR, I'll take a look :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 5a108df
I found type params are going to this branch:
https://github.com/lampepfl/dotty/blob/28a671a71a3a5f6627a2db0c9cc5d9c0ec6218a2/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala#L168-L170
and excludeChildren
is true if the parameter is HKTypeLambda, and that's why those symbols are missing.
This will still need a rebase |
883a6a1
to
b30dae6
Compare
b30dae6
to
5a108df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
Head branch was pushed to by a user without write access
91f243c
to
28a671a
Compare
Fixed failed rebase 🙇 28a671a |
Fix #13270
This PR fixes missing symbol occurrence of
For example:
The root problem is we are ignoring TypeDef's rhs of type parameters in the constructor. Once it traverses the trees (like
TypeBoundsTree
andAppliedTypeTree
), the original traverser will look intoIdent(Txn)
andIdent(T)
inside ofAppliedTypeTree
in the following case.Also registered symbol that appears inside of TypeRef (of TypeTree).
I understand TypeTree can contain any type, but as far as I know,
TypeRef
is the only type that is present in the source and we need to handle.