-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
Nowarn fix for Whitespace
macro
#310
Changes from all commits
e1c5559
687a5f9
20570e0
90ca4e7
2ca9570
b14a738
aaec995
411bb3e
49f4069
3e406ea
6982bb6
c262686
7575386
828827b
82dec8c
f242c9a
6f7a7ce
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.11.7-29-f2e220 | ||
0.11.7-86-18d144 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package fastparse.internal | ||
|
||
object NoWarn{ | ||
@deprecated("Use scala.annotation.nowarn instead", "3.1.1") | ||
class nowarn(msg: String = "") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package fastparse.internal | ||
|
||
object NoWarn{ | ||
@deprecated("Use scala.annotation.nowarn instead", "3.1.1") | ||
type nowarn = scala.annotation.nowarn | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package fastparse.internal | ||
|
||
object NoWarn{ | ||
@deprecated("Use scala.annotation.nowarn instead", "3.1.1") | ||
type nowarn = scala.annotation.nowarn | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
package test.fastparse | ||
|
||
import fastparse._ | ||
import fastparse._ | ||
import utest._ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package scalaparse | ||
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. @He-Pin is this change intentional? 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. Yes, because the api in nsc is different in Scala 2.12 and newer version of scala 2.13. 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. So I have to separate this test for Scala 2.12 and Scala 2.13, maybe I can split it into a dedicated PR. but as the commits is one by one, maybe that's fine too. 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. related link: scala/scala#10406 |
||
|
||
import scala.reflect.internal.util.CodeAction | ||
import scala.tools.nsc.{Global, Settings} | ||
|
||
object ScalacParser{ | ||
var current = Thread.currentThread().getContextClassLoader | ||
val files = collection.mutable.Buffer.empty[java.io.File] | ||
files.appendAll( | ||
System.getProperty("sun.boot.class.path") | ||
.split(":") | ||
.map(new java.io.File(_)) | ||
) | ||
while(current != null){ | ||
current match{ | ||
case t: java.net.URLClassLoader => | ||
files.appendAll(t.getURLs.map(u => new java.io.File(u.toURI))) | ||
case _ => | ||
} | ||
current = current.getParent | ||
} | ||
|
||
val settings = new Settings() | ||
settings.usejavacp.value = true | ||
settings.embeddedDefaults[ScalacParser.type] | ||
settings.classpath.append(files.mkString(":")) | ||
|
||
val global = new Global(settings) | ||
|
||
def checkParseFails(input: String) = this.synchronized{ | ||
new global.Run() | ||
var fail = false | ||
import global.syntaxAnalyzer.Offset | ||
val cu = new global.CompilationUnit(global.newSourceFile(input)) | ||
val parser = new global.syntaxAnalyzer.UnitParser(cu, Nil){ | ||
override def newScanner() = new global.syntaxAnalyzer.UnitScanner(cu, Nil){ | ||
override def error(off: Offset, msg: String) = { | ||
fail = true | ||
} | ||
override def syntaxError(off: Offset, msg: String) = { | ||
fail = true | ||
} | ||
override def incompleteInputError(off: Offset, msg: String) = { | ||
fail = true | ||
} | ||
} | ||
|
||
override def incompleteInputError(msg: String, actions: List[CodeAction]): Unit = { | ||
fail = true | ||
super.incompleteInputError(msg, actions) | ||
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. the new api has a |
||
} | ||
|
||
override def syntaxError(offset: global.syntaxAnalyzer.Offset, msg: String, actions: List[CodeAction]): Unit = { | ||
fail = true | ||
super.syntaxError(offset, msg, actions) | ||
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. so does |
||
} | ||
} | ||
parser.parse() | ||
fail | ||
} | ||
} |
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.
it's now 2.13.14, and the nsc is updated scala/scala#10406
@lihaoyi cc