Skip to content

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

Merged
merged 4 commits into from
Oct 23, 2017
Merged

Remove warnings #3320

merged 4 commits into from
Oct 23, 2017

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@@ -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)
Copy link
Contributor

@allanrenucci allanrenucci Oct 13, 2017

Choose a reason for hiding this comment

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

This looks like a bug. Scalac doesn't report a warning

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

It might due to #3208

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not, this is just a warning about erasure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created #3323

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though I would merge this change as the : List[List[A]] is absolutely useless.

@@ -1523,9 +1523,9 @@ object Types {
if (mySig == null) mySig = Signature.NotAMethod
case designator: Symbol =>
uncheckedSetSym(designator)
case LocalName(underlying, space) =>
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why? =)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

[warn] -- Warning: /Users/nicolasstucki/GitHub/dotty/compiler/src/dotty/tools/dotc/core/Types.scala:1543:22 
[warn] 1543 |        case LocalName(underlying, space) =>
[warn]      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[warn]      |There is no best instantiation of pattern type dotty.tools.dotc.core.Designators.LocalName[dotty.tools.dotc.core.Names.Name]
[warn]      |that makes it a subtype of selector type dotty.tools.dotc.core.Designators.Designator.
[warn]      |Non-variant type variable N cannot be uniquely instantiated.
[warn]      |(This would be an error under strict mode)

We are pattern matching on a Designator { type ThisType <: Name } but we try to match it against a LocalName[N <: Name] { type ThisType = N }. Note that the designator does not define the N type parameter. With these constraints we could instantiate N = Typename or N = TermName.

@@ -67,6 +61,7 @@ object references {
s"$title: $byName${ref.showReference}$repeated"

case ConstantReference(title) => title
case EmptyReference => ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it ever happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did no happen so far. Will put an assert

@allanrenucci allanrenucci merged commit e1365d9 into scala:master Oct 23, 2017
@allanrenucci allanrenucci deleted the remove-warinings branch December 14, 2017 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants