Created
December 24, 2017 13:05
-
-
Save susisu/79f212977658c19ff2f0755ec5b40b33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait SourceInfo { | |
type NoInfoType <: this.type | |
val NoInfo: NoInfoType | |
def showMessage(msg: String): String | |
} | |
object NoPositionInfo extends PositionInfo(NoPosition) { | |
override def showMessage(msg: String): String = s"${pos.toString}: $msg" | |
} | |
class PositionInfo(val pos: Position) { | |
type NoInfoType = NoPositionInfo.type | |
val NoInfo = NoPositionInfo | |
def showMessage(msg: String): String = s"${pos.toString}: $msg\n${pos.longString}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait SourceInfo { | |
type NoInfoType <: this.type | |
val NoInfo: NoInfoType | |
def showMessage(msg: String): String | |
} | |
object NoPositionInfo extends PositionInfo(NoPosition) with SourceInfo { | |
override def showMessage(msg: String): String = s"${pos.toString}: $msg" | |
} | |
class PositionInfo(val pos: Position) { | |
self: SourceInfo => | |
type NoInfoType = NoPositionInfo.type | |
val NoInfo = NoPositionInfo | |
def showMessage(msg: String): String = s"${pos.toString}: $msg\n${pos.longString}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment