Skip to content

Commit

Permalink
io_lib:char_list predicate
Browse files Browse the repository at this point in the history
Summary: - supporting narrowing `case io_lib:char_list(T) of`

Reviewed By: michalmuskala

Differential Revision: D66964528

fbshipit-source-id: 5465948ec1b221f811aca6d753bf57860f210779
  • Loading branch information
ilya-klyuchnikov authored and facebook-github-bot committed Dec 10, 2024
1 parent 626451b commit da4f7a0
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ class ElabApplyCustom(pipelineContext: PipelineContext) {
else Set()

private lazy val customPredicate: Set[RemoteId] =
Set(RemoteId("lists", "member", 2))
Set(
RemoteId("io_lib", "char_list", 1),
RemoteId("io_lib", "latin1_char_list", 1),
RemoteId("lists", "member", 2),
)

def isCustomPredicate(id: RemoteId): Boolean =
customPredicate(id)
Expand Down Expand Up @@ -608,6 +612,15 @@ class ElabApplyCustom(pipelineContext: PipelineContext) {
case _ =>
(booleanType, env1, env1)
}
case RemoteId("io_lib", "char_list" | "latin1_char_list", 1) =>
val List(arg) = args
arg match {
case Var(x) =>
val posEnv = env1.updated(x, stringType)
(booleanType, posEnv, env1)
case _ =>
(booleanType, env1, env1)
}
case rid =>
throw new IllegalArgumentException(s"unexpected $rid")
}
Expand Down

0 comments on commit da4f7a0

Please sign in to comment.