If a generic parameter is not referred to from a function signature, it can never be inferred and thus such a function can never be invoked.
We now produce the following error:
generic parameter 'T' is not used in function signature
func f8<T> (x: Int) {}
This commit takes Jordan't comments on r28181 into account:
- it produces a shorter error message
- it does not change the compiler_crashers_fixed test and add a new expected error instead
Swift SVN r28194
If a generic parameter is not referred to from a function signature, it can never be inferred and thus such a function can never be invoked.
We now produce the following error:
There is no way to infer the generic parameter 'T' if it is not used in function signature
func f8<T> (x: Int) {}
^
Swift SVN r28181
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK. The driver was defaulting to the
host OS. Thus, we could not run the tests when the standard library was
not built for OS X.
Swift SVN r24504
This reverts commit r23030.
This puts non-primary archetypes back in the all-archetypes list,
which is the deepest underlying problem behind
rdar://problem/19049566.
Conflicts:
lib/AST/ArchetypeBuilder.cpp
validation-test/compiler_crashers/0033-error.swift
validation-test/compiler_crashers/035-multiple-typecheck-segfault.swift
Swift SVN r24333
The archetype builder is responsible for figuring out what should go
into a generic signature anyway, so move the generic signature
creation there. This will also allow us to eliminate some code
duplication across Sema and AST.
Fixes compiler crasher 033.
Swift SVN r23030
This will turn into "exactly" in a future commit, when we can build a
generic signature from an archetype builder (directly) and compare the
results.
Swift SVN r23010
Extend the contract for enumerateRequirements() a bit to preserve
archetype-to-archetype same-type constraints. Use that extra
information in the debug dump. NFC elsewhere.
Swift SVN r23008
This pushes some of the extra same-type requirements introduced in r22649 into the generic signature. Doesn’t really have an effect outside of extending generic signatures slightly.
Swift SVN r22680
When we have two protocol conformance requirements for the same type
T, and each of those protocols has an associated type with a given
(shared) name N, infer a same-type requirement between the two. Only
really enabled for testing now; it doesn't feed into general type
checking yet.
Swift SVN r22649
Whenever we add a requirement, we now know
(1) Why we added the requirement, e.g., whether it was explicitly written, inferred from a signature, or introduced by an outer scope.
(2) Where in the source code that requirement originated.
Also add a debugging flag for dumping the archetype builder information, so we can write tests against it.
This is effectively NFC, but it's infrastructure to help a number of requirements-related tasks.
Swift SVN r22638
When a specialization of a generic type occurs within the signature of
a generic function, it implies that the generic arguments meet the
requirements of the generic type. For example, in
func printHashes<K, V>(dict : Dictionary<K, V>) {
for (k, v) in dict {
print("\(k.hashValue())\n")
}
}
the presence of Dictionary<K, V> in the signature implies that K and V
meet the requirements on Dictionary's generic parameters, i.e., that K
is Hashable. Thus, infer that K is Hashable in printHashes().
Fixes the easy part of <rdar://problem/14691708>. Same-type and
superclass requirements are more interesting.
<rdar://problem/14691708>
Swift SVN r7574