Skip to content

Commit 545df40

Browse files
committed
nameTagToString now total, add doc comments
1 parent a15c4a6 commit 545df40

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tasty/src/dotty/tools/tasty/TastyFormat.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ object TastyFormat {
254254
val MajorVersion: Int = 18
255255
val MinorVersion: Int = 0
256256

257-
/** Tags used to serialize names */
257+
/** Tags used to serialize names, should update [[nameTagToString]] if a new constant is added */
258258
class NameTags {
259259
final val UTF8 = 1 // A simple name in UTF8 encoding.
260260

@@ -286,6 +286,11 @@ object TastyFormat {
286286
}
287287
object NameTags extends NameTags
288288

289+
/**Should be kept in sync with [[NameTags]]. Converts constants to a String representing their identifier,
290+
* or NotANameTag(\d+) if unrecognised.
291+
*
292+
* For debugging purposes when unpickling names in a TASTy file.
293+
*/
289294
def nameTagToString(tag: Int) = {
290295
import NameTags._
291296
tag match {
@@ -300,6 +305,7 @@ object TastyFormat {
300305
case INLINEACCESSOR => "INLINEACCESSOR"
301306
case OBJECTCLASS => "OBJECTCLASS"
302307
case SIGNED => "SIGNED"
308+
case id => s"NotANameTag($id)"
303309
}
304310
}
305311

0 commit comments

Comments
 (0)