Skip to content

Commit 70640c6

Browse files
Philippe Bidingerfacebook-github-bot
authored andcommitted
add new visibility mode to schema
Summary: Hack dbs are broken https://www.internalfb.com/sandcastle/workflow/3855081281038068005 ``` DB create failure: Exception {exception_message = "Error in fact. Expecting an expression of type:\n enum { Private | Protected | Public | Internal | }\nwhich should be of the form:\n number (< 4)\nin JSON term:\n 4\nin JSON term:\n {\"id\":39193,\"key\":{\"declaration\":{\"id\":39191},\"signature\":{\"key\":{\"returnsTypeInfo\":{\"id\":39192},\"contexts\":[{\"key\":\"HH\\\\Contexts\\\\write_props\"}],\"returns\":{\"key\":\"EntSchemaConfig\"},\"parameters\":[]}},\"visibility\":4,\"isAbstract\":false,\"isAsync\":false,\"isFinal\":true,\"isStatic\":false,\"attributes\":[{\"key\":{\"name\":{\"key\":\"__Override\"},\"parameters\":[]}}],\"typeParams\":[]}}\NUL"} ``` This means that the visibility "4" is out of bounds. This new value has been added manually here https://fburl.com/code/65e2eb2g but this should have been generated from the schema using the instruction at the top of the file. Updating the schema should fix it. Follow-up: regenerate the hack.ml binding from the code (even though it's probably a noop) Reviewed By: simonhollis, malanka Differential Revision: D78743083 fbshipit-source-id: b771226d52b2d5ade257256a0b81c6eaec8d94ec
1 parent 67202db commit 70640c6

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

glean/glass/Glean/Glass/Pretty/Hack.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ data PropertyMod = PropertyMod Abstract Final Visibility Static
128128

129129
data Abstract = Abstract | NotAbstract deriving Eq
130130
data Final = Final | NotFinal deriving Eq
131-
data Visibility = Public | Protected | Private | Internal
131+
data Visibility = Public | Protected | Private | Internal | ProtectedInternal
132132
data Static = Static | NotStatic deriving Eq
133133
data Async = Async | NotAsync deriving Eq
134134
data ModuleInternal = IsInternal | NotInternal deriving Eq
@@ -455,6 +455,7 @@ ppMethodModifiers container
455455
Protected -> "protected"
456456
Private -> "private"
457457
Internal -> "internal"
458+
ProtectedInternal -> "protected internal"
458459
when (static==Static) $ tell ["static"]
459460
when (readonlyThis==IsReadOnly) $ tell ["readonly"]
460461
when (async==Async) $ tell ["async"]
@@ -472,6 +473,7 @@ ppPropertyModifiers container (PropertyMod abstract final visibility static) =
472473
Public -> "public"
473474
Protected -> "protected"
474475
Private -> "private"
476+
ProtectedInternal -> "protected internal"
475477
Internal -> "internal"
476478
when (static==Static) $ tell ["static"]
477479

@@ -680,6 +682,7 @@ fromHackVisibility v = case v of
680682
Hack.Visibility_Public -> Public
681683
Hack.Visibility_Protected -> Protected
682684
Hack.Visibility_Private -> Private
685+
Hack.Visibility_ProtectedInternal -> ProtectedInternal
683686
Hack.Visibility_Internal -> Internal
684687
Hack.Visibility__UNKNOWN{} -> error "unexpected visibility"
685688

glean/schema/source/hack.angle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ predicate Signature :
105105
}
106106

107107
# Visibility scope of declaration
108-
type Visibility = enum { Private | Protected | Public | Internal }
108+
type Visibility = enum { Private | Protected | Public | Internal | ProtectedInternal }
109109

110110
# Variance (subtyping)
111111
type Variance = enum { Contravariant | Covariant | Invariant }

0 commit comments

Comments
 (0)