Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ object Parsers {

in.token match {
case ARROW => functionRest(t :: Nil)
case FORSOME => syntaxError("existential types no longer supported; use a wildcard type or dependent type instead"); t
case FORSOME => syntaxError(ExistentialTypesNoLongerSupported()); t
case _ => t
}
}
Expand Down
24 changes: 21 additions & 3 deletions compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ package diagnostic

import dotc.core._
import Contexts.Context, Decorators._, Symbols._, Names._, NameOps._, Types._
import util.{SourceFile, NoSource}
import util.{SourcePosition, NoSourcePosition}
import util.SourcePosition
Copy link
Contributor

Choose a reason for hiding this comment

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

This line shouldn't need to be added IIRC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These imports that were removed were unused, that's why I removed them. util.SourcePosition still needs to be included as it is in use in the MessageContainers.

I can put the imports back in if that's what you want

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah, it's fine boyscout principle right? 😃. The one below however didn't need to change right?

Copy link
Contributor Author

@raindeerr raindeerr Dec 21, 2016

Choose a reason for hiding this comment

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

That was my idea in cleaning up the used imports! 😄

No the one below shouldn't have changed, I've fixed that. That might have been the IDE trying to tidy up for me!

import config.Settings.Setting
import interfaces.Diagnostic.{ERROR, WARNING, INFO}
import interfaces.Diagnostic.{ERROR, INFO, WARNING}
Copy link
Contributor

Choose a reason for hiding this comment

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

This one shouldn't need to be changed either.

import printing.Highlighting._
import printing.Formatting

Expand Down Expand Up @@ -901,4 +900,23 @@ object messages {
val msg = hl"trying to define package with same name as `$existing`"
val explanation = ""
}

case class ExistentialTypesNoLongerSupported()(implicit ctx: Context) extends Message(34) {
val kind = "Syntax"
val msg = "Existential types are no longer supported - use a wildcard or dependent type instead"
val explanation =
hl"""| The use of existential types is no longer supported and a wildcard or dependent type should be used instead
Copy link
Contributor

Choose a reason for hiding this comment

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

This row is too long, max should be 80 characters, split it so that it is shorter than 80 (preferably even shorter).

|
| For example:
|
| Instead of using ${"forSome"} to specify a type variable
|
| ${"List[T forSome { type T }]"}
|
| Try using a wildcard type variable
|
| ${"List[_]"}
|"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Throughout this explanation, there's no need for there to be a padding of whitespace after the |-signs. None of the other messages should be doing this.

}

}