-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fixes @unchecked
warnings
#2168
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
Conversation
This looks like a bug but I have no idea why. Does
Dotty is correct here, def checkIdent(ident: untpd.Ident): Unit = { |
@@ -159,7 +159,7 @@ class TreeBuffer extends TastyBuffer(50000) { | |||
val tree = it.next | |||
treeAddrs.get(tree) match { | |||
case addr: Addr => treeAddrs.put(tree, adjusted(addr)) | |||
case addrs: List[Addr] => treeAddrs.put(tree, addrs.map(adjusted)) | |||
case addrs: List[Addr @unchecked] => treeAddrs.put(tree, addrs.map(adjusted)) |
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.
Have you tried just removing this line? Looks like the definition of treeAddrs
has changed and it canno longer contains lists.
@@ -145,7 +145,7 @@ class TreeChecker extends Phase with SymTransformer { | |||
override def checkDerivedValueClass(clazz: Symbol, stats: List[Tree])(implicit ctx: Context) = () | |||
|
|||
def withDefinedSym[T](tree: untpd.Tree)(op: => T)(implicit ctx: Context): T = tree match { | |||
case tree: DefTree => | |||
case tree: DefTree @unchecked => |
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.
If possible, it's nice to add a comment explaining why @unchecked
is correct here.
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.
@smarter Not sure why this is correct here. tree
is an untpd.Tree
but the type test is on tpd.DefTree
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.
Yeah looking at it, it should be an untpd.DefTree
. Same thing for case t: MemberDef
below.
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 also means changing everDefinedSyms
to be a mutable.HashMap[Symbol, untpd.Tree]
@smarter I was able to minimise the bug with import annotation.unchecked
@unchecked
class Test |
@allanrenucci Cool! Could you open an issue? |
LGTM! |
@unchecked
warnings emitted when compiling dotty.map
bymapConserve
inUntypedTreeMap
dotty fails to compile the files I modified. Not sure if this reveals a bug or if it is a known incompatibility between scalac and dotty