Skip to content

Commit

Permalink
upgrade to use opaque inline scala/scala3#12815
Browse files Browse the repository at this point in the history
  • Loading branch information
bblfish committed Aug 30, 2021
1 parent fc47506 commit f47dc17
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ lazy val root = project
// "-Yexplicit-nulls", // For explicit nulls behavior.
)
)
val Scala3Version = "3.0.1"
val Scala3Version = "3.0.2-RC1"
val munit = "org.scalameta" %% "munit" % "0.7.28" % Test
32 changes: 23 additions & 9 deletions src/test/scala/ideas/MatchTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ package ideas
/**
* following an idea by Neko-kai https://twitter.com/kai_nyasha
* https://discord.com/channels/632277896739946517/632277897448652844/880944909660606525
*
* Differences with banana-rdf:
* -
*
*/
object MatchTypes {

Expand Down Expand Up @@ -32,13 +36,20 @@ object MatchTypes {
override opaque type BNode <: Node = jena.Node_Blank
override opaque type Literal <: Node = jena.Node_Literal

override def mkUri(iriStr: String): URI =
override inline
def mkUri(iriStr: String): URI =
NodeFactory.createURI(iriStr).asInstanceOf[URI]
override def mkStringLit(str: String): Literal =

override inline
def mkStringLit(str: String): Literal =
NodeFactory.createLiteral(str).asInstanceOf[Literal]
override def mkTriple(subj: Node, rel: URI, obj: Node): Triple =

override inline
def mkTriple(subj: Node, rel: URI, obj: Node): Triple =
jena.Triple.create(subj, rel, obj)
override def mkGraph(triples: Iterable[Triple]): Graph =

override inline
def mkGraph(triples: Iterable[Triple]): Graph =
val g = Factory.createDefaultGraph()
triples.foreach(t => g.add(t))
g
Expand All @@ -52,12 +63,15 @@ object MatchTypes {
override opaque type Literal <: Node = String
override opaque type Graph = Set[Triple]

override def mkUri(iriStr: String): URI = new java.net.URI(iriStr)
override def mkStringLit(str: String): Literal = str
override def mkTriple(subj: Node, rel: URI, obj: Node): Triple =
override inline
def mkUri(iriStr: String): URI = new java.net.URI(iriStr)
override inline
def mkStringLit(str: String): Literal = str
override inline
def mkTriple(subj: Node, rel: URI, obj: Node): Triple =
(subj,rel,obj)
override def mkGraph(triples: Iterable[Triple]): Graph =
triples.toSet
override inline
def mkGraph(triples: Iterable[Triple]): Graph = triples.toSet
}

object RDF {
Expand Down

0 comments on commit f47dc17

Please sign in to comment.