Skip to content

Commit

Permalink
Reformat.
Browse files Browse the repository at this point in the history
  • Loading branch information
tarao committed Nov 7, 2023
1 parent f061da9 commit e05c16a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ object Record {
* @return
* the value of the field named by `label`
*/
def lookup[R <: %, L <: String & Singleton, Out](record: R, label: L)(
using Lookup.Aux[R, L, Out],
def lookup[R <: %, L <: String & Singleton, Out](record: R, label: L)(using
Lookup.Aux[R, L, Out],
): Out =
record.__lookup(label).asInstanceOf[Out]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class TypeErrorSpec extends helper.UnitSpec {
val errs = typeCheckErrors("""Record.lookup(r, "email")""")
errs should not be empty
errs.head.kind shouldBe ErrorKind.Typer
errs.head.message should startWith("""Value '("email" : String)' is not a member of""")
errs.head.message should startWith(
"""Value '("email" : String)' is not a member of""",
)
}

it("should detect invalid key type") {
Expand All @@ -71,7 +73,9 @@ class TypeErrorSpec extends helper.UnitSpec {
val errs = typeCheckErrors("""Record.lookup(r, key)""")
errs should not be empty
errs.head.kind shouldBe ErrorKind.Typer
errs.head.message should startWith("""Value '(key : String)' is not a member of""")
errs.head.message should startWith(
"""Value '(key : String)' is not a member of""",
)
}
}

Expand Down Expand Up @@ -142,7 +146,9 @@ class TypeErrorSpec extends helper.UnitSpec {

case class Cell($value: Int)

checkErrors(typeCheckErrors("""ArrayRecord(name = "tarao") ++ Cell(3)"""))
checkErrors(
typeCheckErrors("""ArrayRecord(name = "tarao") ++ Cell(3)"""),
)
checkErrors(typeCheckErrors("""ArrayRecord.from(Cell(3))"""))
}

Expand All @@ -167,7 +173,9 @@ class TypeErrorSpec extends helper.UnitSpec {
val errs = typeCheckErrors("""ArrayRecord.lookup(r, "email")""")
errs should not be empty
errs.head.kind shouldBe ErrorKind.Typer
errs.head.message should startWith("""Value '("email" : String)' is not a member of""")
errs.head.message should startWith(
"""Value '("email" : String)' is not a member of""",
)
}

it("should detect invalid key type") {
Expand All @@ -176,7 +184,9 @@ class TypeErrorSpec extends helper.UnitSpec {
val errs = typeCheckErrors("""ArrayRecord.lookup(r, key)""")
errs should not be empty
errs.head.kind shouldBe ErrorKind.Typer
errs.head.message should startWith("""Value '(key : String)' is not a member of""")
errs.head.message should startWith(
"""Value '(key : String)' is not a member of""",
)
}
}

Expand Down Expand Up @@ -221,7 +231,9 @@ class TypeErrorSpec extends helper.UnitSpec {
describe("RecordLike") {
it("should detect non-literal label type") {
val errs =
typeCheckErrors("""ArrayRecord(name = "tarao") ++ (("age", 3) *: EmptyTuple)""")
typeCheckErrors(
"""ArrayRecord(name = "tarao") ++ (("age", 3) *: EmptyTuple)""",
)
errs should not be empty
errs.head.kind shouldBe ErrorKind.Typer
errs.head.message should startWith(
Expand Down
5 changes: 4 additions & 1 deletion modules/core/src/test/scala/helper/StaticTypeMatcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
package helper

import scala.compiletime.summonInline
import org.scalatest.matchers.dsl.{ResultOfATypeInvocation, ResultOfAnTypeInvocation}
import org.scalatest.matchers.dsl.{
ResultOfATypeInvocation,
ResultOfAnTypeInvocation,
}

trait StaticTypeMatcher {
extension [T1](anything: T1) {
Expand Down

0 comments on commit e05c16a

Please sign in to comment.