From f35aca72cedf6bc5bbb741a4703162bbe8157400 Mon Sep 17 00:00:00 2001 From: James Clark Date: Mon, 15 Mar 2021 16:24:14 +0700 Subject: [PATCH] Add disjoint requirement for dependent type inference Fixes #386. --- lang/spec.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lang/spec.html b/lang/spec.html index 99a201bb..40a473cb 100644 --- a/lang/spec.html +++ b/lang/spec.html @@ -2007,7 +2007,11 @@

Functions

type-reference occurring in a return-type-descriptor can refer to a parameter name if the type of the parameter is a subtype of typedesc. If p is such a parameter, then a reference to p in the return-type-descriptor denotes -the type that is the value of p. The return-type-descriptor thus denotes a +the type that is the value of p. If the default value for p is +<> and p occurs in the return-type-descriptor in a union p|T, +then for every basic type B, either the intersection of B and T must be empty, +or the intersection of typedesc<B> and the declared type of p must be +empty, or both. The return-type-descriptor thus denotes a distinct set of shapes for each invocation of the function. A function-signature with a return-type-descriptor that uses a type-reference to refer to a parameter name in this way is said to be dependently-typed. Functions with