mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We previously asserted that for a call the function type had the same number of parameters as the declaration. But that’s not true for parameter packs anymore because the parameter pack will be exploded in the function type to account for passing multiple arguments to the pack. To fix this, use `ConcreteDeclRef` instead of a `ValueDecl`, which has a substitution map and is able to account for the exploded parameter packs when accessed using `getParameterAt`. rdar://100066716
48 lines
1.6 KiB
C++
48 lines
1.6 KiB
C++
//===--- SelectedOverloadInfo.h -------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_IDE_SWIFTCOMPLETIONINFO_H
|
|
#define SWIFT_IDE_SWIFTCOMPLETIONINFO_H
|
|
|
|
#include "swift/AST/Decl.h"
|
|
#include "swift/Sema/ConstraintSystem.h"
|
|
|
|
namespace swift {
|
|
namespace ide {
|
|
|
|
using namespace swift::constraints;
|
|
|
|
/// Information that \c getSelectedOverloadInfo gathered about a
|
|
/// \c SelectedOverload.
|
|
struct SelectedOverloadInfo {
|
|
/// The function that is being called or the value that is being accessed.
|
|
ConcreteDeclRef ValueRef;
|
|
/// For a function, type of the called function itself (not its result type),
|
|
/// for an arbitrary value the type of that value.
|
|
Type ValueTy;
|
|
/// The type on which the overload is being accessed. \c null if it does not
|
|
/// have a base type, e.g. for a free function.
|
|
Type BaseTy;
|
|
|
|
ValueDecl *getValue() const { return ValueRef.getDecl(); }
|
|
};
|
|
|
|
/// Extract additional information about the overload that is being called by
|
|
/// \p CalleeLocator.
|
|
SelectedOverloadInfo getSelectedOverloadInfo(const Solution &S,
|
|
ConstraintLocator *CalleeLocator);
|
|
|
|
} // end namespace ide
|
|
} // end namespace swift
|
|
|
|
#endif // SWIFT_IDE_SWIFTCOMPLETIONINFO_H
|