/lib/Sema/ConstraintLocatorPathElts.def

https://github.com/apple/swift · Module-Definition · 201 lines · 149 code · 52 blank · 0 comment · 9 complexity · 11472753a03c6c349e959cb421dec5a0 MD5 · raw file

  1. //===--- ConstraintLocatorPathElts.def - Constraint Locator Path Elements -===//
  2. //
  3. // This source file is part of the Swift.org open source project
  4. //
  5. // Copyright (c) 2019 Apple Inc. and the Swift project authors
  6. // Licensed under Apache License v2.0 with Runtime Library Exception
  7. //
  8. // See https://swift.org/LICENSE.txt for license information
  9. // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
  10. //
  11. //===----------------------------------------------------------------------===//
  12. ///
  13. /// This file enumerates the elements that can make up the path of a
  14. /// ConstraintLocator.
  15. ///
  16. //===----------------------------------------------------------------------===//
  17. /// Describes any kind of path element.
  18. #ifndef LOCATOR_PATH_ELT
  19. #define LOCATOR_PATH_ELT(Name)
  20. #endif
  21. /// Defines a path element which is characterized only by its kind, and as such
  22. /// doesn't store additional values.
  23. #ifndef SIMPLE_LOCATOR_PATH_ELT
  24. #define SIMPLE_LOCATOR_PATH_ELT(Name) LOCATOR_PATH_ELT(Name)
  25. #endif
  26. /// Defines a path element that requires a class definition to be provided in
  27. /// order to expose things like accessors for path element info.
  28. #ifndef CUSTOM_LOCATOR_PATH_ELT
  29. #define CUSTOM_LOCATOR_PATH_ELT(Name) LOCATOR_PATH_ELT(Name)
  30. #endif
  31. /// Defines an abstract path element superclass which doesn't itself have a path
  32. /// element kind.
  33. #ifndef ABSTRACT_LOCATOR_PATH_ELT
  34. #define ABSTRACT_LOCATOR_PATH_ELT(Name) CUSTOM_LOCATOR_PATH_ELT(Name)
  35. #endif
  36. /// Matching an argument to a parameter.
  37. CUSTOM_LOCATOR_PATH_ELT(ApplyArgToParam)
  38. /// The argument of function application.
  39. SIMPLE_LOCATOR_PATH_ELT(ApplyArgument)
  40. /// The function being applied.
  41. SIMPLE_LOCATOR_PATH_ELT(ApplyFunction)
  42. /// An argument passed in an autoclosure parameter
  43. /// position, which must match the autoclosure return type.
  44. SIMPLE_LOCATOR_PATH_ELT(AutoclosureResult)
  45. /// The result of a closure.
  46. SIMPLE_LOCATOR_PATH_ELT(ClosureResult)
  47. /// The type of a closure body.
  48. CUSTOM_LOCATOR_PATH_ELT(ClosureBody)
  49. /// The lookup for a constructor member.
  50. SIMPLE_LOCATOR_PATH_ELT(ConstructorMember)
  51. /// The desired contextual type passed in to the constraint system.
  52. CUSTOM_LOCATOR_PATH_ELT(ContextualType)
  53. /// A result of an expression involving dynamic lookup.
  54. SIMPLE_LOCATOR_PATH_ELT(DynamicLookupResult)
  55. /// The superclass of a protocol existential type.
  56. SIMPLE_LOCATOR_PATH_ELT(ExistentialSuperclassType)
  57. /// The argument type of a function.
  58. SIMPLE_LOCATOR_PATH_ELT(FunctionArgument)
  59. /// The result type of a function.
  60. SIMPLE_LOCATOR_PATH_ELT(FunctionResult)
  61. /// The result type of a function builder body.
  62. SIMPLE_LOCATOR_PATH_ELT(FunctionBuilderBodyResult)
  63. /// A generic argument.
  64. /// FIXME: Add support for named generic arguments?
  65. CUSTOM_LOCATOR_PATH_ELT(GenericArgument)
  66. /// An implicit reference to a 'callAsFunction' method of a nominal type.
  67. SIMPLE_LOCATOR_PATH_ELT(ImplicitCallAsFunction)
  68. /// Locator for a binding from an IUO disjunction choice.
  69. SIMPLE_LOCATOR_PATH_ELT(ImplicitlyUnwrappedDisjunctionChoice)
  70. /// The instance of a metatype type.
  71. SIMPLE_LOCATOR_PATH_ELT(InstanceType)
  72. /// A generic parameter being opened.
  73. ///
  74. /// Also contains the generic parameter type itself.
  75. CUSTOM_LOCATOR_PATH_ELT(GenericParameter)
  76. /// A component of a key path.
  77. CUSTOM_LOCATOR_PATH_ELT(KeyPathComponent)
  78. /// The result type of a key path component. Not used for subscripts.
  79. SIMPLE_LOCATOR_PATH_ELT(KeyPathComponentResult)
  80. /// The member looked up via keypath based dynamic lookup.
  81. CUSTOM_LOCATOR_PATH_ELT(KeyPathDynamicMember)
  82. /// The root of a key path.
  83. SIMPLE_LOCATOR_PATH_ELT(KeyPathRoot)
  84. /// The type of the key path expression.
  85. SIMPLE_LOCATOR_PATH_ELT(KeyPathType)
  86. /// The value of a key path.
  87. SIMPLE_LOCATOR_PATH_ELT(KeyPathValue)
  88. /// An implicit @lvalue-to-inout conversion; only valid for operator
  89. /// arguments.
  90. SIMPLE_LOCATOR_PATH_ELT(LValueConversion)
  91. /// A member.
  92. /// FIXME: Do we need the actual member name here?
  93. SIMPLE_LOCATOR_PATH_ELT(Member)
  94. /// The base of a member expression.
  95. SIMPLE_LOCATOR_PATH_ELT(MemberRefBase)
  96. /// This is referring to a type produced by opening a generic type at the
  97. /// base of the locator.
  98. CUSTOM_LOCATOR_PATH_ELT(OpenedGeneric)
  99. /// An optional payload.
  100. SIMPLE_LOCATOR_PATH_ELT(OptionalPayload)
  101. /// The parent of a nested type.
  102. SIMPLE_LOCATOR_PATH_ELT(ParentType)
  103. /// The requirement that we're matching during protocol conformance
  104. /// checking.
  105. CUSTOM_LOCATOR_PATH_ELT(ProtocolRequirement)
  106. /// Type parameter requirements.
  107. ABSTRACT_LOCATOR_PATH_ELT(AnyRequirement)
  108. /// The Nth conditional requirement in the parent locator's conformance.
  109. CUSTOM_LOCATOR_PATH_ELT(ConditionalRequirement)
  110. /// A single requirement placed on the type parameters.
  111. CUSTOM_LOCATOR_PATH_ELT(TypeParameterRequirement)
  112. /// RValue adjustment.
  113. SIMPLE_LOCATOR_PATH_ELT(RValueAdjustment)
  114. /// The element type of a sequence in a for ... in ... loop.
  115. SIMPLE_LOCATOR_PATH_ELT(SequenceElementType)
  116. /// The lookup for a subscript member.
  117. SIMPLE_LOCATOR_PATH_ELT(SubscriptMember)
  118. /// The missing argument synthesized by the solver.
  119. CUSTOM_LOCATOR_PATH_ELT(SynthesizedArgument)
  120. /// Tuple elements.
  121. ABSTRACT_LOCATOR_PATH_ELT(AnyTupleElement)
  122. /// A tuple element referenced by position.
  123. CUSTOM_LOCATOR_PATH_ELT(TupleElement)
  124. /// A tuple element referenced by name.
  125. CUSTOM_LOCATOR_PATH_ELT(NamedTupleElement)
  126. /// An unresolved member.
  127. SIMPLE_LOCATOR_PATH_ELT(UnresolvedMember)
  128. /// The candidate witness during protocol conformance checking.
  129. CUSTOM_LOCATOR_PATH_ELT(Witness)
  130. /// The condition associated with 'if' expression or ternary operator.
  131. SIMPLE_LOCATOR_PATH_ELT(Condition)
  132. SIMPLE_LOCATOR_PATH_ELT(DynamicCallable)
  133. /// The 'true' or 'false' branch of a ternary operator.
  134. CUSTOM_LOCATOR_PATH_ELT(TernaryBranch)
  135. /// Performing a pattern patch.
  136. CUSTOM_LOCATOR_PATH_ELT(PatternMatch)
  137. /// Points to a particular attribute associated with one of
  138. /// the arguments e.g. `inout` or its type e.g. `@escaping`.
  139. ///
  140. /// This is very useful when dealing with argument-to-parameter
  141. /// failures because it allows to express in the locator kind
  142. /// of a problem.
  143. CUSTOM_LOCATOR_PATH_ELT(ArgumentAttribute)
  144. /// The result of a chain of member accesses off an UnresolvedMemberExpr
  145. SIMPLE_LOCATOR_PATH_ELT(UnresolvedMemberChainResult)
  146. #undef LOCATOR_PATH_ELT
  147. #undef CUSTOM_LOCATOR_PATH_ELT
  148. #undef SIMPLE_LOCATOR_PATH_ELT
  149. #undef ABSTRACT_LOCATOR_PATH_ELT