-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove warnings #3320
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
Remove warnings #3320
Changes from 3 commits
d1c8f1e
1695228
2abb529
2d04a78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,8 +178,8 @@ object FrontEndUtils { | |
def transpose[A](xs: List[List[A]]): List[List[A]] = { | ||
@tailrec def transpose(xs: List[List[A]], result: List[List[A]]): List[List[A]] = { | ||
xs.filter(_.nonEmpty) match { | ||
case Nil => result | ||
case ys: List[List[A]] => transpose(ys.map(_.tail), ys.map(_.head) :: result) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a bug. Scalac doesn't report a warning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, we already know that the list is a list of list of A. There is no runtime check needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might due to #3208 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not, this is just a warning about erasure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created #3323 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Though I would merge this change as the |
||
case Nil => result | ||
case ys => transpose(ys.map(_.tail), ys.map(_.head) :: result) | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,14 +28,6 @@ object references { | |
} | ||
final case class NoLink(title: String, target: String) extends MaterializableLink | ||
|
||
object AndOrTypeReference { | ||
def unapply(ref: Reference): Option[(Reference, String, Reference)] = ref match { | ||
case OrTypeReference(left, right) => Some((left, "|", right)) | ||
case AndTypeReference(left, right) => Some((left, "&", right)) | ||
case _ => None | ||
} | ||
} | ||
|
||
implicit class ReferenceShower(val ref: Reference) extends AnyVal { | ||
def showReference: String = ref match { | ||
case TypeReference(title, _, tparams) => | ||
|
@@ -44,8 +36,10 @@ object references { | |
else "" | ||
} | ||
|
||
case AndOrTypeReference(left, part, right) => | ||
left.showReference + s" $part " + right.showReference | ||
case OrTypeReference(left, right) => | ||
left.showReference + " | " + right.showReference | ||
case AndTypeReference(left, right) => | ||
left.showReference + " & " + right.showReference | ||
|
||
case FunctionReference(args, ret) => | ||
if (args.isEmpty) | ||
|
@@ -67,6 +61,7 @@ object references { | |
s"$title: $byName${ref.showReference}$repeated" | ||
|
||
case ConstantReference(title) => title | ||
case EmptyReference => "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it ever happen? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did no happen so far. Will put an assert |
||
} | ||
} | ||
} |
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.
Is the warning valid 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.
Yes
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.
Can you explain why? =)
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.
We are pattern matching on a
Designator { type ThisType <: Name }
but we try to match it against aLocalName[N <: Name] { type ThisType = N }
. Note that the designator does not define theN
type parameter. With these constraints we could instantiateN = Typename
orN = TermName
.