From b605fc1ab3ba92d8b38616529f80edf4d23494ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xuan=20Huang=20=28=E9=BB=84=E7=8E=84=29?= Date: Wed, 5 Oct 2022 18:42:16 -0400 Subject: [PATCH] [BE] Even more permissive ref annotation comment Allow `readOnly` and `writable` or even `WriTaBlE`. commit-id:f6f77fd8 --- compiler/forget/src/MiddleEnd/RefKindInfer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/forget/src/MiddleEnd/RefKindInfer.ts b/compiler/forget/src/MiddleEnd/RefKindInfer.ts index 72ed6d7691..5f35e9a162 100644 --- a/compiler/forget/src/MiddleEnd/RefKindInfer.ts +++ b/compiler/forget/src/MiddleEnd/RefKindInfer.ts @@ -22,7 +22,7 @@ export default { }; const ANNOTATIONS_IMMUT = ["immut", "readonly"]; -const ANNOTATIONS_MUT = ["mut", "mutable"]; +const ANNOTATIONS_MUT = ["mut", "mutable", "writable"]; /** * Eventually, we probably want to move RefKind refinements @@ -195,7 +195,7 @@ function refineUses( function hasLeadingComment(path: NodePath, annotation: string): boolean { return ( path.node.leadingComments?.some( - (comment) => comment.value.trim() === annotation + (comment) => comment.value.trim().toLowerCase() === annotation ) ?? false ); }