Skip to content

Commit da4f7a0

Browse files
io_lib:char_list predicate
Summary: - supporting narrowing `case io_lib:char_list(T) of` Reviewed By: michalmuskala Differential Revision: D66964528 fbshipit-source-id: 5465948ec1b221f811aca6d753bf57860f210779
1 parent 626451b commit da4f7a0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/ElabApplyCustom.scala

+14-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ class ElabApplyCustom(pipelineContext: PipelineContext) {
7171
else Set()
7272

7373
private lazy val customPredicate: Set[RemoteId] =
74-
Set(RemoteId("lists", "member", 2))
74+
Set(
75+
RemoteId("io_lib", "char_list", 1),
76+
RemoteId("io_lib", "latin1_char_list", 1),
77+
RemoteId("lists", "member", 2),
78+
)
7579

7680
def isCustomPredicate(id: RemoteId): Boolean =
7781
customPredicate(id)
@@ -608,6 +612,15 @@ class ElabApplyCustom(pipelineContext: PipelineContext) {
608612
case _ =>
609613
(booleanType, env1, env1)
610614
}
615+
case RemoteId("io_lib", "char_list" | "latin1_char_list", 1) =>
616+
val List(arg) = args
617+
arg match {
618+
case Var(x) =>
619+
val posEnv = env1.updated(x, stringType)
620+
(booleanType, posEnv, env1)
621+
case _ =>
622+
(booleanType, env1, env1)
623+
}
611624
case rid =>
612625
throw new IllegalArgumentException(s"unexpected $rid")
613626
}

0 commit comments

Comments
 (0)