Split error codes for read/write on array access and object access
[hiphop-php.git] / hphp / hack / src / errors / error_codes.ml
blob94bb2343a1b26ef2fefa85308e6f3415c1ab5072
1 (*
2 * Copyright (c) 2015, 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 *)
11 Please change the error map file if you have changed the error codes.
12 The file is at hphp/hack/test/errors/error_map.ml
15 (*****************************************************************************)
16 (* Error codes.
17 * Each error has a unique number associated with it. The following modules
18 * define the error code associated with each kind of error.
19 * It is ok to extend the codes with new values, it is NOT OK to change the
20 * value of an existing error to a different error code!
21 * I added some comments to make that extra clear :-)
23 (*****************************************************************************)
25 (* Errors in the Temporary range are for errors that will disappear in the
26 * future. *)
27 module Temporary = struct
28 let darray_not_supported = 1
30 let varray_not_supported = 2
32 (* DEPRECATED let unknown_fields_not_supported = 3 *)
33 let varray_or_darray_not_supported = 4
35 (* DEPRECATED let goto_not_supported = 5 *)
36 let nonnull_not_supported = 6
37 end
39 module Parsing = struct
40 type t =
41 | FixmeFormat [@value 1001]
42 | ParsingError
43 | UnexpectedEofDEPRECATED
44 | UnterminatedCommentDEPRECATED
45 | UnterminatedXhpCommentDEPRECATED
46 | CallTimePassByReferenceDEPRECATED
47 | XhpParsingError (* EXTEND HERE WITH NEW VALUES IF NEEDED *)
48 [@@deriving enum, show { with_path = false }]
50 let err_code = to_enum
51 end
53 module Naming = struct
54 type t =
55 | AddATypehint [@value 2001]
56 | TypeparamAlokDEPRECATED
57 | AssertArity
58 | PrimitiveInvalidAlias
59 | CyclicConstraintDEPRECATED
60 | DidYouMeanNaming
61 | DifferentScopeDEPRECATED
62 | DisallowedXhpType
63 | DoubleInsteadOfFloatDEPRECATED
64 | DynamicClassDEPRECATED
65 | LvarInObjGet
66 | ErrorNameAlreadyBound
67 | ExpectedCollection
68 | ExpectedVariable
69 | FdNameAlreadyBound
70 | GenArrayRecArityDEPRECATED
71 | GenArrayVaRecArityDEPRECATED
72 | GenaArityDEPRECATED
73 | GenericClassVarDEPRECATED
74 | GenvaArityDEPRECATED
75 | IllegalClass
76 | IllegalClassMeth
77 | IllegalConstant
78 | IllegalFun
79 | IllegalInstMeth
80 | IllegalMethCaller
81 | IllegalMethFun
82 | IntegerInsteadOfIntDEPRECATED
83 | InvalidReqExtends
84 | InvalidReqImplements
85 | LocalConstDEPRECATED
86 | LowercaseThis
87 | MethodNameAlreadyBound
88 | MissingArrow
89 | MissingTypehint
90 | NameAlreadyBound
91 | NamingTooFewArguments
92 | NamingTooManyArguments
93 | PrimitiveToplevel
94 | RealInsteadOfFloatDEPRECATED
95 | ShadowedTypeParam
96 | StartWith_T
97 | ThisMustBeReturn
98 | ThisNoArgument
99 | ThisHintOutsideClass
100 | ThisReserved
101 | TparamWithTparam
102 | TypedefConstraintDEPRECATED
103 | UnboundName
104 | Undefined
105 | UnexpectedArrow
106 | UnexpectedTypedef
107 | UsingInternalClass
108 | VoidCast
109 | ObjectCast
110 | UnsetCast
111 | NullsafePropertyAccessDEPRECATED
112 | IllegalTrait
113 | ShapeTypehintDEPRECATED
114 | DynamicNewInStrictMode
115 | InvalidTypeAccessRoot
116 | DuplicateUserAttribute
117 | ReturnOnlyTypehint
118 | UnexpectedTypeArguments
119 | TooManyTypeArguments
120 | ClassnameParam
121 | InvalidInstanceofDEPRECATED
122 | NameIsReserved
123 | DollardollarUnused
124 | IllegalMemberVariableClass
125 | TooFewTypeArguments
126 | GotoLabelAlreadyDefined
127 | GotoLabelUndefined
128 | GotoLabelDefinedInFinally
129 | GotoInvokedInFinally
130 | DynamicClassPropertyNameInStrictModeDEPRECATED
131 | ThisAsLexicalVariable
132 | DynamicClassNameInStrictMode
133 | XhpOptionalRequiredAttr
134 | XhpRequiredWithDefault
135 | VariableVariablesDisallowedDEPRECATED
136 | ArrayTypehintsDisallowed
137 | ArrayLiteralsDisallowed
138 | WildcardDisallowed
139 | AttributeClassNameConflict
140 | MethodNeedsVisibility
141 | ReferenceInStrictModeDEPRECATED
142 | ReferenceInRxDEPRECATED
143 | DeclareStatementDEPRECATED
144 | MisplacedRxOfScopeDEPRECATED
145 | RxOfScopeAndExplicitRxDEPRECATED
146 | UnsupportedFeatureDEPRECATED
147 | TraitInterfaceConstructorPromoDEPRECATED
148 | NonstaticPropertyWithLSB
149 | ReferenceInAnonUseClauseDEPRECATED
150 | RxMoveInvalidLocation
151 | MisplacedMutabilityHint
152 | MutabilityHintInNonRx
153 | InvalidReturnMutableHint
154 | NoTparamsOnTypeConstsDEPRECATED
155 | PocketUniversesDuplication
156 | UnsupportedTraitUseAs
157 | UnsupportedInsteadOf
158 | InvalidTraitUseAsVisibility
159 | InvalidFunPointer
160 | IllegalUseOfDynamicallyCallable
161 | PocketUniversesNotInClass
162 | PocketUniversesAtomMissing
163 | PocketUniversesAtomUnknown
164 | PocketUniversesLocalization
165 | ClassMethNonFinalSelf (* EXTEND HERE WITH NEW VALUES IF NEEDED *)
166 [@@deriving enum, show { with_path = false }]
168 let err_code = to_enum
171 module NastCheck = struct
172 type t =
173 | AbstractBody [@value 3001]
174 | AbstractWithBody
175 | AwaitInSyncFunction
176 | CallBeforeInit
177 | CaseFallthrough
178 | ContinueInSwitch
179 | DangerousMethodNameDEPRECATED
180 | DefaultFallthrough
181 | InterfaceWithMemberVariable
182 | InterfaceWithStaticMemberVariable
183 | Magic
184 | NoConstructParent
185 | NonInterface
186 | NotAbstractWithoutBody
187 | NotInitialized
188 | NotPublicInterface
189 | RequiresNonClass
190 | ReturnInFinally
191 | ReturnInGen
192 | ToStringReturnsString
193 | ToStringVisibility
194 | ToplevelBreak
195 | ToplevelContinue
196 | UsesNonTrait
197 | IllegalFunctionName
198 | NotAbstractWithoutTypeconst
199 | TypeconstDependsOnExternalTparam
200 | TypeconstAssignedTparamDEPRECATED
201 | AbstractWithTypeconstDEPRECATED
202 | ConstructorRequired
203 | InterfaceWithPartialTypeconst
204 | MultipleXhpCategory
205 | OptionalShapeFieldsNotSupportedDEPRECATED
206 | AwaitNotAllowedDEPRECATED
207 | AsyncInInterfaceDEPRECATED
208 | AwaitInCoroutine
209 | YieldInCoroutine
210 | SuspendOutsideOfCoroutine
211 | SuspendInFinally
212 | BreakContinueNNotSupportedDEPRECATED
213 | StaticMemoizedFunction
214 | InoutParamsInCoroutine
215 | InoutParamsSpecial
216 | InoutParamsMixByrefDEPRECATED
217 | InoutParamsMemoize
218 | InoutParamsRetByRefDEPRECATED
219 | ReadingFromAppend
220 | ConstAttributeProhibitedDEPRECATED
221 | RetiredError3049DEPRECATED
222 | InoutArgumentBadExpr
223 | MutableParamsOutsideOfSyncDEPRECATED
224 | MutableAsyncMethodDEPRECATED
225 | MutableMethodsMustBeReactive
226 | MutableAttributeOnFunction
227 | MutableReturnAnnotatedDeclsMustBeReactive
228 | IllegalDestructor
229 | ConditionallyReactiveFunctionDEPRECATED
230 | MultipleConditionallyReactiveAnnotations
231 | ConditionallyReactiveAnnotationInvalidArguments
232 | MissingReactivityForConditionDEPRECATED
233 | MultipleReactivityAnnotationsDEPRECATED
234 | RxIsEnabledInvalidLocation
235 | MaybeRxInvalidLocation
236 | NoOnlyrxIfRxfuncForRxIfArgs
237 | CoroutineInConstructor
238 | IllegalReturnByRefDEPRECATED
239 | IllegalByRefExprDEPRECATED
240 | VariadicByRefParamDEPRECATED
241 | MaybeMutableAttributeOnFunction
242 | ConflictingMutableAndMaybeMutableAttributes
243 | MaybeMutableMethodsMustBeReactive
244 | RequiresFinalClass
245 | InterfaceUsesTrait
246 | NonstaticMethodInAbstractFinalClass
247 | MutableOnStaticDEPRECATED
248 | ClassnameConstInstanceOfDEPRECATED
249 | ByRefParamOnConstructDEPRECATED
250 | ByRefDynamicCallDEPRECATED
251 | ByRefPropertyDEPRECATED
252 | ByRefCallDEPRECATED
253 | SwitchNonTerminalDefault
254 | SwitchMultipleDefault
255 | RepeatedRecordFieldName
256 | PhpLambdaDisallowed (* EXTEND HERE WITH NEW VALUES IF NEEDED *)
257 [@@deriving enum, show { with_path = false }]
259 let err_code = to_enum
262 module Typing = struct
263 type t =
264 | AbstractClassFinalDEPRECATED [@value 4001]
265 | UninstantiableClass
266 | AnonymousRecursiveDEPRECATED
267 | AnonymousRecursiveCallDEPRECATED
268 | ArrayAccessRead
269 | ArrayAppend
270 | ArrayCast
271 | ArrayGetArity
272 | BadCall
273 | ClassArityDEPRECATED
274 | ConstMutation
275 | ConstructorNoArgs
276 | CyclicClassDef
277 | CyclicTypedef
278 | DiscardedAwaitable
279 | IssetEmptyInStrict
280 | DynamicYieldPrivateDEPRECATED
281 | EnumConstantTypeBad
282 | EnumSwitchNonexhaustive
283 | EnumSwitchNotConst
284 | EnumSwitchRedundant
285 | EnumSwitchRedundantDefault
286 | EnumSwitchWrongClass
287 | EnumTypeBad
288 | EnumTypeTypedefMixedDEPRECATED
289 | ExpectedClass
290 | ExpectedLiteralFormatString
291 | ExpectedStaticIntDEPRECATED
292 | ExpectedTparam
293 | ExpectingReturnTypeHint
294 | ExpectingReturnTypeHintSuggestDEPRECATED
295 | ExpectingTypeHint
296 | ExpectingTypeHintVariadic
297 | RetiredError4034DEPRECATED
298 | ExtendFinal
299 | FieldKinds
300 | FieldMissingDEPRECATED
301 | FormatString
302 | FunArityMismatch
303 | FunTooFewArgs
304 | FunTooManyArgs
305 | FunUnexpectedNonvariadic
306 | FunVariadicityHhVsPhp56
307 | GenaExpectsArrayDEPRECATED
308 | GenericArrayStrict
309 | GenericStatic
310 | ImplementAbstract
311 | InterfaceFinalDEPRECATED
312 | InvalidShapeFieldConst
313 | InvalidShapeFieldLiteral
314 | InvalidShapeFieldName
315 | InvalidShapeFieldType
316 | MemberNotFound
317 | MemberNotImplemented
318 | MissingAssign
319 | MissingConstructor
320 | MissingField
321 | NegativeTupleIndexDEPRECATED
322 | SelfOutsideClass
323 | NewStaticInconsistent
324 | StaticOutsideClass
325 | NonObjectMemberRead
326 | NullContainer
327 | NullMemberRead
328 | NullableParameterDEPRECATED
329 | OptionReturnOnlyTypehint
330 | ObjectString
331 | OptionMixed
332 | OverflowDEPRECATED
333 | OverrideFinal
334 | OverridePerTrait
335 | PairArityDEPRECATED
336 | AbstractCall
337 | ParentInTrait
338 | ParentOutsideClass
339 | ParentUndefined
340 | PreviousDefault
341 | PrivateClassMeth
342 | PrivateInstMeth
343 | PrivateOverride
344 | ProtectedClassMeth
345 | ProtectedInstMeth
346 | ReadBeforeWrite
347 | ReturnInVoid
348 | ShapeFieldClassMismatch
349 | ShapeFieldTypeMismatch
350 | ShouldBeOverride
351 | SketchyNullCheckDEPRECATED
352 | SketchyNullCheckPrimitiveDEPRECATED
353 | SmemberNotFound
354 | StaticDynamic
355 | StaticOverflowDEPRECATED
356 | RetiredError4093DEPRECATED
357 | ThisInStaticDEPRECATED
358 | ThisVarOutsideClass
359 | TraitFinalDEPRECATED
360 | TupleArityDEPRECATED
361 | TupleArityMismatchDEPRECATED
362 | TupleIndexTooLargeDEPRECATED
363 | TupleSyntax
364 | TypeArityMismatch
365 | TypeParamArityDEPRECATED
366 | RetiredError4103DEPRECATED
367 | TypingTooFewArgs
368 | TypingTooManyArgs
369 | UnboundGlobal
370 | UnboundNameTyping
371 | UndefinedField
372 | UndefinedParent
373 | UnifyError
374 | UnsatisfiedReq
375 | Visibility
376 | VisibilityExtends
377 | VoidParameterDEPRECATED
378 | WrongExtendKind
379 | GenericUnify
380 | NullsafeNotNeeded
381 | TrivialStrictEq
382 | VoidUsage
383 | DeclaredCovariant
384 | DeclaredContravariant
385 | UnsetInStrictDEPRECATED
386 | StrictMembersNotKnown
387 | ErasedGenericAtRuntime
388 | DynamicClassDEPRECATED
389 | AttributeTooManyArguments
390 | AttributeParamType
391 | DeprecatedUse
392 | AbstractConstUsage
393 | CannotDeclareConstant
394 | CyclicTypeconst
395 | NullsafePropertyWriteContext
396 | NoreturnUsage
397 | ThisLvalueDEPRECATED
398 | UnsetNonidxInStrict
399 | InvalidShapeFieldNameEmpty
400 | InvalidShapeFieldNameNumberDEPRECATED
401 | ShapeFieldsUnknown
402 | InvalidShapeRemoveKey
403 | MissingOptionalFieldDEPRECATED
404 | ShapeFieldUnset
405 | AbstractConcreteOverride
406 | LocalVariableModifedAndUsed
407 | LocalVariableModifedTwice
408 | AssignDuringCase
409 | CyclicEnumConstraint
410 | UnpackingDisallowed
411 | InvalidClassname
412 | InvalidMemoizedParam
413 | IllegalTypeStructure
414 | NotNullableCompareNullTrivial
415 | ClassPropertyOnlyStaticLiteralDEPRECATED
416 | AttributeTooFewArguments
417 | ReferenceExprDEPRECATED
418 | UnificationCycle
419 | KeysetSet
420 | EqIncompatibleTypes
421 | ContravariantThis
422 | InstanceofAlwaysFalseDEPRECATED
423 | InstanceofAlwaysTrueDEPRECATED
424 | AmbiguousMember
425 | InstanceofGenericClassnameDEPRECATED
426 | RequiredFieldIsOptional
427 | FinalProperty
428 | ArrayGetWithOptionalField
429 | UnknownFieldDisallowedInShape
430 | NullableCast
431 | PassByRefAnnotationMissingDEPRECATED
432 | NonCallArgumentInSuspend
433 | NonCoroutineCallInSuspend
434 | CoroutineCallOutsideOfSuspend
435 | FunctionIsNotCoroutine
436 | CoroutinnessMismatch
437 | ExpectingAwaitableReturnTypeHint
438 | ReffinessInvariantDEPRECATED
439 | DollardollarLvalue
440 | StaticMethodOnInterfaceDEPRECATED
441 | DuplicateUsingVar
442 | IllegalDisposable
443 | EscapingDisposable
444 | PassByRefAnnotationUnexpectedDEPRECATED
445 | InoutAnnotationMissing
446 | InoutAnnotationUnexpected
447 | InoutnessMismatch
448 | StaticSyntheticMethod
449 | TraitReuse
450 | InvalidNewDisposable
451 | EscapingDisposableParameter
452 | AcceptDisposableInvariant
453 | InvalidDisposableHint
454 | XhpRequired
455 | EscapingThis
456 | IllegalXhpChild
457 | MustExtendDisposable
458 | InvalidIsAsExpressionHint
459 | AssigningToConst
460 | SelfConstParentNot
461 | ParentConstSelfNotDEPRECATED
462 | PartiallyValidIsAsExpressionHintDEPRECATED
463 | NonreactiveFunctionCall
464 | NonreactiveIndexing
465 | ObjSetReactive
466 | FunReactivityMismatch
467 | OverridingPropConstMismatch
468 | InvalidReturnDisposable
469 | InvalidDisposableReturnHint
470 | ReturnDisposableMismatch
471 | InoutArgumentBadType
472 | InconsistentUnsetDEPRECATED
473 | ReassignMutableVar
474 | InvalidFreezeTarget
475 | InvalidFreezeUse
476 | FreezeInNonreactiveContext
477 | MutableCallOnImmutable
478 | MutableArgumentMismatch
479 | InvalidMutableReturnResult
480 | MutableReturnResultMismatch
481 | NonreactiveCallFromShallow
482 | EnumTypeTypedefNonnull
483 | RxEnabledInNonRxContext
484 | RxEnabledInLambdasDEPRECATED
485 | AmbiguousLambda
486 | EllipsisStrictMode
487 | UntypedLambdaStrictMode
488 | BindingRefInArrayDEPRECATED
489 | EchoInReactiveContext
490 | SuperglobalInReactiveContext
491 | StaticPropertyInReactiveContext
492 | StaticInReactiveContextDEPRECATED
493 | GlobalInReactiveContextDEPRECATED
494 | WrongExpressionKindAttribute
495 | AttributeClassNoConstructorArgsDEPRECATED
496 | InvalidTypeForOnlyrxIfRxfuncParameter
497 | MissingAnnotationForOnlyrxIfRxfuncParameter
498 | CannotReturnBorrowedValueAsImmutable
499 | DeclOverrideMissingHint
500 | InvalidConditionallyReactiveCall
501 | ExtendSealed
502 | SealedFinalDEPRECATED
503 | ComparisonInvalidTypes
504 | OptionVoidDEPRECATED
505 | MutableInNonreactiveContext
506 | InvalidArgumentOfRxMutableFunction
507 | LetVarImmutabilityViolation
508 | UnsealableDEPRECATED
509 | ReturnVoidToRxMismatch
510 | ReturnsVoidToRxAsNonExpressionStatement
511 | NonawaitedAwaitableInReactiveContext
512 | ShapesKeyExistsAlwaysTrue
513 | ShapesKeyExistsAlwaysFalse
514 | ShapesMethodAccessWithNonExistentField
515 | NonClassMember
516 | PassingArrayCellByRefDEPRECATED
517 | CallSiteReactivityMismatch
518 | RxParameterConditionMismatch
519 | AmbiguousObjectAccess
520 | ExtendPPL
521 | ReassignMaybeMutableVar
522 | MaybeMutableArgumentMismatch
523 | ImmutableArgumentMismatch
524 | ImmutableCallOnMutable
525 | InvalidCallMaybeMutable
526 | MutabilityMismatch
527 | InvalidPPLCall
528 | InvalidPPLStaticCall
529 | TypeTestInLambdaDEPRECATED
530 | InvalidTraversableInRx
531 | ReassignMutableThis
532 | MutableExpressionAsMultipleMutableArguments
533 | InvalidUnsetTargetInRx
534 | CoroutineOutsideExperimental
535 | PPLMethPointer
536 | InvalidTruthinessTestDEPRECATED
537 | RePrefixedNonString
538 | BadRegexPattern
539 | SketchyTruthinessTestDEPRECATED
540 | LateInitWithDefault
541 | OverrideMemoizeLSB
542 | ClassVarTypeGenericParam
543 | InvalidSwitchCaseValueType
544 | StringCast
545 | BadLateInitOverride
546 | EscapingMutableObject
547 | OverrideLSB
548 | MultipleConcreteDefs
549 | MoveInNonreactiveContext
550 | InvalidMoveUse
551 | InvalidMoveTarget
552 | IgnoredResultOfFreezeDEPRECATED
553 | IgnoredResultOfMoveDEPRECATED
554 | UnexpectedTy
555 | UnserializableType
556 | InconsistentMutability
557 | InvalidMutabilityFlavorInAssignment
558 | OptionNull
559 | UnknownObjectMember
560 | UnknownType
561 | InvalidArrayKeyRead
562 | ReferenceExprNotFunctionArgDEPRECATED
563 | RedundantRxCondition
564 | RedeclaringMissingMethod
565 | InvalidEnforceableTypeArgument
566 | RequireArgsReify
567 | TypecheckerTimeout
568 | InvalidReifiedArgument
569 | GenericsNotAllowed
570 | InvalidNewableTypeArgument
571 | InvalidNewableTypeParamConstraints
572 | NewWithoutNewable
573 | NewStaticClassReified
574 | MemoizeReified
575 | ConsistentConstructReified
576 | MethodVariance
577 | MissingXhpRequiredAttr
578 | BadXhpAttrRequiredOverride
579 | ReifiedTparamVariadicDEPRECATED
580 | UnresolvedTypeVariable
581 | InvalidSubString
582 | InvalidArrayKeyConstraint
583 | OverrideNoDefaultTypeconst
584 | ShapeAccessWithNonExistentField
585 | DisallowPHPArraysAttr
586 | TypeConstraintViolation
587 | IndexTypeMismatch
588 | ExpectedStringlike
589 | TypeConstantMismatch
590 | TypeConstantRedeclarationDEPRECATED
591 | ConstantDoesNotMatchEnumType
592 | EnumConstraintMustBeArraykey
593 | EnumSubtypeMustHaveCompatibleConstraint
594 | ParameterDefaultValueWrongType
595 | NewtypeAliasMustSatisfyConstraint
596 | BadFunctionTypevar
597 | BadClassTypevar
598 | BadMethodTypevar
599 | MissingReturnInNonVoidFunction
600 | InoutReturnTypeMismatch
601 | ClassConstantValueDoesNotMatchHint
602 | ClassPropertyInitializerTypeDoesNotMatchHint
603 | BadDeclOverride
604 | BadMethodOverride
605 | BadEnumExtends
606 | XhpAttributeValueDoesNotMatchHint
607 | TraitPropConstClass
608 | EnumUnderlyingTypeMustBeArraykey
609 | ClassGetReified
610 | RequireGenericExplicit
611 | ClassConstantTypeMismatch
612 | PocketUniversesExpansion
613 | PocketUniversesTyping
614 | RecordInitValueDoesNotMatchHint
615 | AbstractTconstNotAllowed
616 | NewAbstractRecord
617 | RecordMissingRequiredField
618 | RecordUnknownField
619 | CyclicRecordDef
620 | InvalidDestructure
621 | StaticCallWithClassLevelReifiedGeneric
622 | SplatArrayRequired
623 | SplatArrayVariadic
624 | ExceptionOccurred
625 | InvalidReifiedFunctionPointer
626 | BadFunctionPointerConstruction
627 | NotARecord
628 | TraitReuseInsideClass
629 | RedundantGeneric
630 | PocketUniversesInvalidUpperBounds
631 | PocketUniversesRefinement
632 | PocketUniversesReservedSyntax
633 | ArrayAccessWrite
634 | InvalidArrayKeyWrite
635 | NullMemberWrite
636 | NonObjectMemberWrite (* EXTEND HERE WITH NEW VALUES IF NEEDED *)
637 [@@deriving enum, show { with_path = false }]
639 let err_code = to_enum
642 (* 5xxx: reserved for FB lint *)
643 (* 6xxx: reserved for FB ai *)
644 (* 7xxx: reserved for FB ai *)
646 module Init = struct
647 type t =
648 | ForwardCompatibilityNotCurrent [@value 8001]
649 | ForwardCompatibilityBelowMinimum
650 [@@deriving enum, show { with_path = false }]
652 let err_code = to_enum
655 (* 9xxx: reserved for FB ai *)
656 (* 10xxx: reserved for FB ai *)