Skip to content

Skip EnumValue as supertype of enum values in semanticdb #11807

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

Merged
merged 1 commit into from
Mar 24, 2021
Merged

Skip EnumValue as supertype of enum values in semanticdb #11807

merged 1 commit into from
Mar 24, 2021

Conversation

Kordyjan
Copy link
Contributor

Fixes #11689

The information that enum values are internally extending scala.runtime.EnumValue shouldn't be present in semanticdb as this is not visible from the outside of the enum, that is, enum values cannot be assigned to value with type scala.runtime.EnumValue.

@@ -154,7 +154,7 @@ class ExtractSemanticDB extends Phase:
if tree.symbol.isAllOf(EnumValue) =>
tree.rhs match
case Block(TypeDef(_, template: Template) :: _, _) => // simple case with specialised extends clause
template.parents.foreach(traverse)
template.parents.filter(_.symbol != defn.EnumValueClass).foreach(traverse)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not work if someone explicitly writes runtime.EnumValue as a parent

enum Color/*<-enumVal::Color#*/(val rgb/*<-enumVal::Color#rgb.*/: Int/*->scala::Int#*/):
  case Red/*<-enumVal::Color.Red.*/   extends Color/*->enumVal::Color#*/(0xFF0000) with runtime.EnumValue

/*<-enumVal::EnumVal$package.*/val e/*<-enumVal::EnumVal$package.e.*/: scala.runtime.EnumValue/*->scala::runtime::EnumValue#*/ = ???/*->scala::Predef.`???`().*/

Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should still have an occurrence if it is explicit

@bishabosha bishabosha assigned Kordyjan and unassigned bishabosha Mar 24, 2021
Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bishabosha bishabosha enabled auto-merge March 24, 2021 16:35
@bishabosha bishabosha merged commit 0c4321a into scala:master Mar 24, 2021
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SemanticDB] scala.runtime.EnumValue gets added to occurrences in semanticdb
2 participants