Skip to content

Commit

Permalink
Merge pull request #183 from sjrd/decode-scala2-extern-refs
Browse files Browse the repository at this point in the history
Fix #182: Decode names in Scala 2 external refs.
  • Loading branch information
bishabosha authored Nov 3, 2022
2 parents 751e48b + 1edb94f commit 31491b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private[pickles] class PickleReader {
entries(storeInEntriesAt) = result

def readExtSymbol(): MaybeExternalSymbol =
val name = readNameRef() // TODO .decode
val name = readNameRef().decode
val owner = if (atEnd) ctx.defn.RootPackage else readMaybeExternalSymbolRef()
name match
case nme.RootName | nme.RootPackageName =>
Expand Down
10 changes: 10 additions & 0 deletions tasty-query/shared/src/test/scala/tastyquery/TypeSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,16 @@ class TypeSuite extends UnrestrictedUnpicklingSuite {
assert(clue(ord.declaredType).isRef(BooleanOrdering))
}

testWithContext("read-encoded-scala2-type-ref-type") {
val Function1Class = resolve(name"scala" / tname"Function1").asClass
val SerializableClass = resolve(name"java" / name"io" / tname"Serializable").asClass
val TypeEqClass = resolve(name"scala" / tname"=:=").asClass
val SubtypeClass = resolve(name"scala" / tname"<:<").asClass

assert(clue(SubtypeClass.parentClasses) == List(defn.ObjectClass, Function1Class, SerializableClass))
assert(clue(TypeEqClass.parentClasses) == List(SubtypeClass, SerializableClass))
}

testWithContext("scala2-type-alias") {
val PredefString = resolve(name"scala" / tname"Predef" / obj / tname"String").asType
val JLString = resolve(name"java" / name"lang" / tname"String")
Expand Down

0 comments on commit 31491b2

Please sign in to comment.