Skip to content
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

Fix warn messages in doc #1255

Merged
merged 3 commits into from Oct 12, 2020
Merged

Fix warn messages in doc #1255

merged 3 commits into from Oct 12, 2020

Conversation

mlachkar
Copy link
Collaborator

@mlachkar mlachkar commented Oct 8, 2020

  • use the new api for SemanticTree
  • add @unchecked for non exhaustive pattern matching (in doc)

fixes #1190

Copy link
Collaborator

@bjaglin bjaglin left a comment

Choose a reason for hiding this comment

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

Nice, fixes #1190 ?

@mlachkar
Copy link
Collaborator Author

mlachkar commented Oct 8, 2020

yes, it will fix #1190

Copy link
Collaborator

@bjaglin bjaglin left a comment

Choose a reason for hiding this comment

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

👍 what about using -Xfatal-warnings so that docs remain up to date as deprecations are added?

@@ -49,7 +49,7 @@ Use `MethodSignature.returnType` to get the types of vals.

```scala mdoc
def getType(symbol: Symbol): SemanticType =
symbol.info.get.signature match {
(symbol.info.get.signature: @unchecked) match {
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe it's clearer with a case _ ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You mean adding a case _ ?
So the return type will be Option[A]..

Copy link
Collaborator

Choose a reason for hiding this comment

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

That would make the doc harder to read indeed... Does removing the --unchecked from scalacOption for the doc project silence these exceptions? If not, there is scala/scala#8373 that could be used as well to avoid repeating this everywhere (which should be usable since the doc is built using 2.13?).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removing -unchecked doesn't silence these exceptions

Copy link
Collaborator Author

@mlachkar mlachkar left a comment

Choose a reason for hiding this comment

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

I am not a big fun of -Xfatal-warnings on documentation. I hesitated between adding a @unchecked or finding the correct scalacOptions to remove warning on exhaustive pattern match. I found on google the @unchecked first

@@ -49,7 +49,7 @@ Use `MethodSignature.returnType` to get the types of vals.

```scala mdoc
def getType(symbol: Symbol): SemanticType =
symbol.info.get.signature match {
(symbol.info.get.signature: @unchecked) match {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You mean adding a case _ ?
So the return type will be Option[A]..

@bjaglin
Copy link
Collaborator

bjaglin commented Oct 12, 2020

I am not a big fun of -Xfatal-warnings on documentation

why?

@mlachkar
Copy link
Collaborator Author

mlachkar commented Oct 12, 2020

I am not a big fun of -Xfatal-warnings on documentation

why?
I mean in documentation having non exhaustive pattern matching is ok, it makes the doc easier to read. I am not against -Xfatal-warnings in general, just for this case.
I agree it's nice to have it for depreciate api.
I am also worried about the confusion @unchecked brings.

@mlachkar
Copy link
Collaborator Author

I fixed last warning and I added xfatal-wanings , and also used -Wconf to silence pattern match errors.

@mlachkar mlachkar merged commit 39d6cf6 into scalacenter:master Oct 12, 2020
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.

Stop using deprecated APIs in documentation
2 participants