mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix the type-checker's recursive value type checking.
Track the types we've seen instead of the type declarations we've passed through, which eliminates some holes relating to generic types. Detect infinite expansions by imposing an arbitrary limit. Fixes rdar://30355804
This commit is contained in:
@@ -957,6 +957,17 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
|
||||
Opts.SolverMemoryThreshold = threshold;
|
||||
}
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_value_recursion_threshold)) {
|
||||
unsigned threshold;
|
||||
if (StringRef(A->getValue()).getAsInteger(10, threshold)) {
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
|
||||
A->getAsString(Args), A->getValue());
|
||||
return true;
|
||||
}
|
||||
|
||||
Opts.MaxCircularityDepth = threshold;
|
||||
}
|
||||
|
||||
for (const Arg *A : make_range(Args.filtered_begin(OPT_D),
|
||||
Args.filtered_end())) {
|
||||
|
||||
Reference in New Issue
Block a user