Ban constructor parameter promotion on traits and interfaces
[hiphop-php.git] / hphp / hack / test / errors / error_map.ml
blob20df5299a347a897cb224babf5ec156f707ecb02
1 (**
2 * Copyright (c) 2018, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 open Printf
11 open Buffer
13 module GenErr(M: Errors.Error_category) = struct
14 let generate_errors buffer name =
15 add_string buffer @@ sprintf "%s Errors:\n" name;
16 for i = M.min to M.max do
17 match M.of_enum i with
18 | Some err -> add_string buffer @@ sprintf "%s = %d\n" (M.show err) i;
19 | None -> ();
20 done;
21 add_string buffer "\n"
23 end
25 module P = GenErr(Errors.Parsing)
26 module N = GenErr(Errors.Naming)
27 module NC = GenErr(Errors.NastCheck)
28 module T = GenErr(Errors.Typing)
30 let gen_error_map_content () : string =
31 let buffer = create 4096 in
32 P.generate_errors buffer "Parsing";
33 N.generate_errors buffer "Naming";
34 NC.generate_errors buffer "NastCheck";
35 T.generate_errors buffer "Typing";
36 contents buffer
39 Please modify the error map below if you have changed the error codes.
42 let%expect_test "error_map" =
43 let map = gen_error_map_content () in
44 Printf.printf "%s\n" map;
45 [%expect {|
46 Parsing Errors:
47 FixmeFormat = 1001
48 ParsingError = 1002
49 UnexpectedEof = 1003
50 UnterminatedComment = 1004
51 UnterminatedXhpComment = 1005
52 CallTimePassByReferenceDEPRECATED = 1006
54 Naming Errors:
55 AddATypehint = 2001
56 TypeparamAlok = 2002
57 AssertArity = 2003
58 PrimitiveInvalidAlias = 2004
59 CyclicConstraintDEPRECATED = 2005
60 DidYouMeanNaming = 2006
61 DifferentScope = 2007
62 DisallowedXhpType = 2008
63 DoubleInsteadOfFloatDEPRECATED = 2009
64 DynamicClassDEPRECATED = 2010
65 DynamicMethodCall = 2011
66 ErrorNameAlreadyBound = 2012
67 ExpectedCollection = 2013
68 ExpectedVariable = 2014
69 FdNameAlreadyBound = 2015
70 GenArrayRecArity = 2016
71 GenArrayVaRecArityDEPRECATED = 2017
72 GenaArity = 2018
73 GenericClassVar = 2019
74 GenvaArity = 2020
75 IllegalClass = 2021
76 IllegalClassMeth = 2022
77 IllegalConstant = 2023
78 IllegalFun = 2024
79 IllegalInstMeth = 2025
80 IllegalMethCaller = 2026
81 IllegalMethFun = 2027
82 IntegerInsteadOfIntDEPRECATED = 2028
83 InvalidReqExtends = 2029
84 InvalidReqImplements = 2030
85 LocalConst = 2031
86 LowercaseThis = 2032
87 MethodNameAlreadyBound = 2033
88 MissingArrow = 2034
89 MissingTypehint = 2035
90 NameAlreadyBound = 2036
91 NamingTooFewArguments = 2037
92 NamingTooManyArguments = 2038
93 PrimitiveToplevel = 2039
94 RealInsteadOfFloatDEPRECATED = 2040
95 ShadowedTypeParam = 2041
96 StartWith_T = 2042
97 ThisMustBeReturn = 2043
98 ThisNoArgument = 2044
99 ThisHintOutsideClass = 2045
100 ThisReserved = 2046
101 TparamWithTparam = 2047
102 TypedefConstraint = 2048
103 UnboundName = 2049
104 Undefined = 2050
105 UnexpectedArrow = 2051
106 UnexpectedTypedef = 2052
107 UsingInternalClass = 2053
108 VoidCast = 2054
109 ObjectCast = 2055
110 UnsetCast = 2056
111 NullsafePropertyAccessDEPRECATED = 2057
112 IllegalTrait = 2058
113 ShapeTypehintDEPRECATED = 2059
114 DynamicNewInStrictMode = 2060
115 InvalidTypeAccessRoot = 2061
116 DuplicateUserAttribute = 2062
117 ReturnOnlyTypehint = 2063
118 UnexpectedTypeArguments = 2064
119 TooManyTypeArguments = 2065
120 ClassnameParam = 2066
121 InvalidInstanceof = 2067
122 NameIsReserved = 2068
123 DollardollarUnused = 2069
124 IllegalMemberVariableClass = 2070
125 TooFewTypeArguments = 2071
126 GotoLabelAlreadyDefined = 2072
127 GotoLabelUndefined = 2073
128 GotoLabelDefinedInFinally = 2074
129 GotoInvokedInFinally = 2075
130 DynamicClassPropertyNameInStrictMode = 2076
131 ThisAsLexicalVariable = 2077
132 DynamicClassNameInStrictMode = 2078
133 XhpOptionalRequiredAttr = 2079
134 XhpRequiredWithDefault = 2080
135 VariableVariablesDisallowed = 2081
136 ArrayTypehintsDisallowed = 2082
137 ArrayLiteralsDisallowed = 2083
138 WildcardDisallowed = 2084
139 AttributeClassNameConflict = 2085
140 MethodNeedsVisibility = 2086
141 ReferenceInStrictMode = 2087
142 ReferenceInRx = 2088
143 DeclareStatement = 2089
144 MisplacedRxOfScope = 2090
145 RxOfScopeAndExplicitRx = 2091
146 UnsupportedFeature = 2092
147 TraitInterfaceConstructorPromo = 2093
149 NastCheck Errors:
150 AbstractBody = 3001
151 AbstractWithBody = 3002
152 AwaitInSyncFunction = 3003
153 CallBeforeInit = 3004
154 CaseFallthrough = 3005
155 ContinueInSwitch = 3006
156 DangerousMethodName = 3007
157 DefaultFallthrough = 3008
158 InterfaceWithMemberVariable = 3009
159 InterfaceWithStaticMemberVariable = 3010
160 Magic = 3011
161 NoConstructParent = 3012
162 NonInterface = 3013
163 NotAbstractWithoutBody = 3014
164 NotInitialized = 3015
165 NotPublicInterface = 3016
166 RequiresNonClass = 3017
167 ReturnInFinally = 3018
168 ReturnInGen = 3019
169 ToStringReturnsString = 3020
170 ToStringVisibility = 3021
171 ToplevelBreak = 3022
172 ToplevelContinue = 3023
173 UsesNonTrait = 3024
174 IllegalFunctionName = 3025
175 NotAbstractWithoutTypeconst = 3026
176 TypeconstDependsOnExternalTparam = 3027
177 TypeconstAssignedTparam = 3028
178 AbstractWithTypeconst = 3029
179 ConstructorRequired = 3030
180 InterfaceWithPartialTypeconst = 3031
181 MultipleXhpCategory = 3032
182 OptionalShapeFieldsNotSupportedDEPRECATED = 3033
183 AwaitNotAllowed = 3034
184 AsyncInInterface = 3035
185 AwaitInCoroutine = 3036
186 YieldInCoroutine = 3037
187 SuspendOutsideOfCoroutine = 3038
188 SuspendInFinally = 3039
189 BreakContinueNNotSupported = 3040
190 StaticMemoizedFunction = 3041
191 InoutParamsOutsideOfSync = 3042
192 InoutParamsSpecial = 3043
193 InoutParamsMixByref = 3044
194 InoutParamsMemoize = 3045
195 InoutParamsRetByRef = 3046
196 ReadingFromAppend = 3047
197 ConstAttributeProhibited = 3048
198 RetiredError3049DEPRECATED = 3049
199 InoutArgumentBadExpr = 3050
200 MutableParamsOutsideOfSync = 3051
201 MutableAsyncMethod = 3052
202 MutableMethodsMustBeReactive = 3053
203 MutableAttributeOnFunction = 3054
204 MutableReturnAnnotatedDeclsMustBeReactive = 3055
205 IllegalDestructor = 3056
206 ConditionallyReactiveFunction = 3057
207 MultipleConditionallyReactiveAnnotations = 3058
208 ConditionallyReactiveAnnotationInvalidArguments = 3059
209 MissingReactivityForCondition = 3060
210 MultipleReactivityAnnotations = 3061
211 RxIsEnabledInvalidLocation = 3062
212 MaybeRxInvalidLocation = 3063
213 NoOnlyrxIfRxfuncForRxIfArgs = 3064
214 CoroutineInConstructor = 3065
215 IllegalReturnByRef = 3066
216 IllegalByRefExpr = 3067
217 VariadicByRefParam = 3068
218 MaybeMutableAttributeOnFunction = 3069
219 ConflictingMutableAndMaybeMutableAttributes = 3070
220 MaybeMutableMethodsMustBeReactive = 3071
221 RequiresFinalClass = 3072
222 InterfaceUsesTrait = 3073
223 NonstaticMethodInAbstractFinalClass = 3074
224 MutableOnStatic = 3075
226 Typing Errors:
227 AbstractClassFinalDEPRECATED = 4001
228 UninstantiableClass = 4002
229 AnonymousRecursive = 4003
230 AnonymousRecursiveCall = 4004
231 ArrayAccess = 4005
232 ArrayAppend = 4006
233 ArrayCast = 4007
234 ArrayGetArity = 4008
235 BadCall = 4009
236 ClassArity = 4010
237 ConstMutation = 4011
238 ConstructorNoArgs = 4012
239 CyclicClassDef = 4013
240 CyclicTypedef = 4014
241 DiscardedAwaitable = 4015
242 IssetEmptyInStrict = 4016
243 DynamicYieldPrivateDEPRECATED = 4017
244 EnumConstantTypeBad = 4018
245 EnumSwitchNonexhaustive = 4019
246 EnumSwitchNotConst = 4020
247 EnumSwitchRedundant = 4021
248 EnumSwitchRedundantDefault = 4022
249 EnumSwitchWrongClass = 4023
250 EnumTypeBad = 4024
251 EnumTypeTypedefMixed = 4025
252 ExpectedClass = 4026
253 ExpectedLiteralFormatString = 4027
254 ExpectedStaticIntDEPRECATED = 4028
255 ExpectedTparam = 4029
256 ExpectingReturnTypeHint = 4030
257 ExpectingReturnTypeHintSuggest = 4031
258 ExpectingTypeHint = 4032
259 ExpectingTypeHintSuggest = 4033
260 RetiredError4034DEPRECATED = 4034
261 ExtendFinal = 4035
262 FieldKinds = 4036
263 FieldMissingDEPRECATED = 4037
264 FormatString = 4038
265 FunArityMismatch = 4039
266 FunTooFewArgs = 4040
267 FunTooManyArgs = 4041
268 FunUnexpectedNonvariadic = 4042
269 FunVariadicityHhVsPhp56 = 4043
270 GenaExpectsArray = 4044
271 GenericArrayStrict = 4045
272 GenericStatic = 4046
273 ImplementAbstract = 4047
274 InterfaceFinal = 4048
275 InvalidShapeFieldConst = 4049
276 InvalidShapeFieldLiteral = 4050
277 InvalidShapeFieldName = 4051
278 InvalidShapeFieldType = 4052
279 MemberNotFound = 4053
280 MemberNotImplemented = 4054
281 MissingAssign = 4055
282 MissingConstructor = 4056
283 MissingField = 4057
284 NegativeTupleIndexDEPRECATED = 4058
285 SelfOutsideClass = 4059
286 NewStaticInconsistent = 4060
287 StaticOutsideClass = 4061
288 NonObjectMember = 4062
289 NullContainer = 4063
290 NullMember = 4064
291 NullableParameterDEPRECATED = 4065
292 OptionReturnOnlyTypehint = 4066
293 ObjectString = 4067
294 OptionMixed = 4068
295 Overflow = 4069
296 OverrideFinal = 4070
297 OverridePerTrait = 4071
298 PairArity = 4072
299 AbstractCall = 4073
300 ParentInTrait = 4074
301 ParentOutsideClass = 4075
302 ParentUndefined = 4076
303 PreviousDefault = 4077
304 PrivateClassMeth = 4078
305 PrivateInstMeth = 4079
306 PrivateOverride = 4080
307 ProtectedClassMeth = 4081
308 ProtectedInstMeth = 4082
309 ReadBeforeWrite = 4083
310 ReturnInVoid = 4084
311 ShapeFieldClassMismatch = 4085
312 ShapeFieldTypeMismatch = 4086
313 ShouldBeOverride = 4087
314 SketchyNullCheck = 4088
315 SketchyNullCheckPrimitive = 4089
316 SmemberNotFound = 4090
317 StaticDynamic = 4091
318 StaticOverflowDEPRECATED = 4092
319 RetiredError4093DEPRECATED = 4093
320 ThisInStatic = 4094
321 ThisVarOutsideClass = 4095
322 TraitFinal = 4096
323 TupleArity = 4097
324 TupleArityMismatch = 4098
325 TupleIndexTooLargeDEPRECATED = 4099
326 TupleSyntax = 4100
327 TypeArityMismatch = 4101
328 TypeParamArity = 4102
329 RetiredError4103DEPRECATED = 4103
330 TypingTooFewArgs = 4104
331 TypingTooManyArgs = 4105
332 UnboundGlobal = 4106
333 UnboundNameTyping = 4107
334 UndefinedField = 4108
335 UndefinedParent = 4109
336 UnifyError = 4110
337 UnsatisfiedReq = 4111
338 Visibility = 4112
339 VisibilityExtends = 4113
340 VoidParameterDEPRECATED = 4114
341 WrongExtendKind = 4115
342 GenericUnify = 4116
343 NullsafeNotNeeded = 4117
344 TrivialStrictEq = 4118
345 VoidUsage = 4119
346 DeclaredCovariant = 4120
347 DeclaredContravariant = 4121
348 UnsetInStrictDEPRECATED = 4122
349 StrictMembersNotKnown = 4123
350 GenericAtRuntime = 4124
351 DynamicClassDEPRECATED = 4125
352 AttributeTooManyArguments = 4126
353 AttributeParamType = 4127
354 DeprecatedUse = 4128
355 AbstractConstUsage = 4129
356 CannotDeclareConstant = 4130
357 CyclicTypeconst = 4131
358 NullsafePropertyWriteContext = 4132
359 NoreturnUsage = 4133
360 ThisLvalue = 4134
361 UnsetNonidxInStrict = 4135
362 InvalidShapeFieldNameEmpty = 4136
363 InvalidShapeFieldNameNumber = 4137
364 ShapeFieldsUnknown = 4138
365 InvalidShapeRemoveKey = 4139
366 MissingOptionalFieldDEPRECATED = 4140
367 ShapeFieldUnset = 4141
368 AbstractConcreteOverride = 4142
369 LocalVariableModifedAndUsed = 4143
370 LocalVariableModifedTwice = 4144
371 AssignDuringCase = 4145
372 CyclicEnumConstraint = 4146
373 UnpackingDisallowed = 4147
374 InvalidClassname = 4148
375 InvalidMemoizedParam = 4149
376 IllegalTypeStructure = 4150
377 NotNullableCompareNullTrivial = 4151
378 ClassPropertyOnlyStaticLiteral = 4152
379 AttributeTooFewArguments = 4153
380 ReferenceExpr = 4154
381 UnificationCycle = 4155
382 KeysetSet = 4156
383 EqIncompatibleTypes = 4157
384 ContravariantThis = 4158
385 InstanceofAlwaysFalseDEPRECATED = 4159
386 InstanceofAlwaysTrueDEPRECATED = 4160
387 AmbiguousMember = 4161
388 InstanceofGenericClassname = 4162
389 RequiredFieldIsOptional = 4163
390 FinalProperty = 4164
391 ArrayGetWithOptionalField = 4165
392 UnknownFieldDisallowedInShape = 4166
393 NullableCast = 4167
394 PassByRefAnnotationMissing = 4168
395 NonCallArgumentInSuspend = 4169
396 NonCoroutineCallInSuspend = 4170
397 CoroutineCallOutsideOfSuspend = 4171
398 FunctionIsNotCoroutine = 4172
399 CoroutinnessMismatch = 4173
400 ExpectingAwaitableReturnTypeHint = 4174
401 ReffinessInvariant = 4175
402 DollardollarLvalue = 4176
403 StaticMethodOnInterfaceDEPRECATED = 4177
404 DuplicateUsingVar = 4178
405 IllegalDisposable = 4179
406 EscapingDisposable = 4180
407 PassByRefAnnotationUnexpected = 4181
408 InoutAnnotationMissing = 4182
409 InoutAnnotationUnexpected = 4183
410 InoutnessMismatch = 4184
411 StaticSyntheticMethod = 4185
412 TraitReuse = 4186
413 InvalidNewDisposable = 4187
414 EscapingDisposableParameter = 4188
415 AcceptDisposableInvariant = 4189
416 InvalidDisposableHint = 4190
417 XhpRequired = 4191
418 EscapingThis = 4192
419 IllegalXhpChild = 4193
420 MustExtendDisposable = 4194
421 InvalidIsAsExpressionHint = 4195
422 AssigningToConst = 4196
423 SelfConstParentNot = 4197
424 ParentConstSelfNot = 4198
425 PartiallyValidIsAsExpressionHint = 4199
426 NonreactiveFunctionCall = 4200
427 NonreactiveAppend = 4201
428 ObjSetReactive = 4202
429 FunReactivityMismatch = 4203
430 OverridingPropConstMismatch = 4204
431 InvalidReturnDisposable = 4205
432 InvalidDisposableReturnHint = 4206
433 ReturnDisposableMismatch = 4207
434 InoutArgumentBadType = 4208
435 FrozenInIncorrectScope = 4209
436 ReassignMutableVar = 4210
437 InvalidFreezeTarget = 4211
438 InvalidFreezeUse = 4212
439 FreezeInNonreactiveContext = 4213
440 MutableCallOnImmutable = 4214
441 MutableArgumentMismatch = 4215
442 InvalidMutableReturnResult = 4216
443 MutableReturnResultMismatch = 4217
444 NonreactiveCallFromShallow = 4218
445 EnumTypeTypedefNonnull = 4219
446 RxEnabledInNonRxContext = 4220
447 RxEnabledInLambdas = 4221
448 AmbiguousLambda = 4222
449 EllipsisStrictMode = 4223
450 UntypedLambdaStrictMode = 4224
451 BindingRefInArray = 4225
452 EchoInReactiveContext = 4226
453 SuperglobalInReactiveContext = 4227
454 StaticPropertyInReactiveContext = 4228
455 StaticInReactiveContext = 4229
456 GlobalInReactiveContext = 4230
457 WrongExpressionKindAttribute = 4231
458 AttributeClassNoConstructorArgs = 4232
459 InvalidTypeForOnlyrxIfRxfuncParameter = 4233
460 MissingAnnotationForOnlyrxIfRxfuncParameter = 4234
461 CannotReturnBorrowedValueAsImmutable = 4235
462 DeclOverrideMissingHint = 4236
463 InvalidConditionallyReactiveCall = 4237
464 ExtendSealed = 4238
465 SealedFinal = 4239
466 ComparisonInvalidTypes = 4240
467 OptionVoid = 4241
468 MutableInNonreactiveContext = 4242
469 InvalidArgumentOfRxMutableFunction = 4243
470 LetVarImmutabilityViolation = 4244
471 Unsealable = 4245
472 ReturnVoidToRxMismatch = 4246
473 ReturnsVoidToRxAsNonExpressionStatement = 4247
474 NonawaitedAwaitableInReactiveContext = 4248
475 ShapesKeyExistsAlwaysTrue = 4249
476 ShapesKeyExistsAlwaysFalse = 4250
477 ShapesIdxWithNonExistentField = 4251
478 NonClassMember = 4252
479 PassingArrayCellByRef = 4253
480 CallSiteReactivityMismatch = 4254
481 RxParameterConditionMismatch = 4255
482 AmbiguousObjectAccess = 4256
483 ExtendPPL = 4257
484 ReassignMaybeMutableVar = 4258
485 MaybeMutableArgumentMismatch = 4259
486 ImmutableArgumentMismatch = 4260
487 ImmutableCallOnMutable = 4261
488 InvalidCallMaybeMutable = 4262
489 MutabilityMismatch = 4263
490 InvalidPPLCall = 4264
491 InvalidPPLStaticCall = 4265
492 TypeTestInLambda = 4266
493 InvalidTraversableInRx = 4267
494 ReassignMutableThis = 4268
495 MutableExpressionAsMultipleMutableArguments = 4269
496 InvalidUnsetTargetInRx = 4270
497 CoroutineOutsideExperimental = 4271
498 PPLMethPointer = 4272
499 InvalidTruthinessTest = 4273
500 RePrefixedNonString = 4274
501 BadRegexPattern = 4275
502 SketchyTruthinessTest = 4276
503 LateInitWithDefault = 4277
504 OverrideMemoizeLSB = 4278
505 ClassVarTypeGenericParam = 4279
506 InvalidSwitchCaseValueType = 4280