diff --git a/src/libponyc/type/typeparam.c b/src/libponyc/type/typeparam.c index 972db8bac7..c0d08f726e 100644 --- a/src/libponyc/type/typeparam.c +++ b/src/libponyc/type/typeparam.c @@ -612,6 +612,17 @@ static void typeparam_current_inner(ast_t* type, ast_t* scope) break; } + // These can appear on the left side of a TK_ARROW, + // but we have no need to do anything with them here. + case TK_ISO: + case TK_TRN: + case TK_REF: + case TK_VAL: + case TK_BOX: + case TK_TAG: + case TK_THISTYPE: + break; + default: pony_assert(0); } diff --git a/src/libponyc/type/viewpoint.c b/src/libponyc/type/viewpoint.c index 97e9b4548b..3f445eec4f 100644 --- a/src/libponyc/type/viewpoint.c +++ b/src/libponyc/type/viewpoint.c @@ -35,8 +35,11 @@ ast_t* viewpoint_type(ast_t* l_type, ast_t* r_type) return type; } - case TK_NOMINAL: case TK_TYPEPARAMREF: + upper = VIEW_UPPER_NO; + break; + + case TK_NOMINAL: { ast_t* cap = cap_fetch(r_type); diff --git a/test/libponyc/type_check_subtype.cc b/test/libponyc/type_check_subtype.cc index 624a377fbe..3df735c259 100644 --- a/test/libponyc/type_check_subtype.cc +++ b/test/libponyc/type_check_subtype.cc @@ -1133,3 +1133,29 @@ TEST_F(SubTypeTest, TupleValRefNotSubAnyShare) TEST_ERRORS_1(src, "type argument is outside its constraint"); } + + +TEST_F(SubTypeTest, BoxArrowTypeParamReifiedWithTypeParam) +{ + const char* src = + "interface _V[A: _V[A] ref]\n" + " fun ref reset(delta: A): A\n" + " fun ref converge(other: box->A)\n" + + "class ref Container[V: _V[V] ref] is _V[Container[V]]\n" + " let _value: V\n" + " new ref create(value': V) => _value = value'\n" + + " fun ref reset(delta: Container[V]): Container[V] =>\n" + " _value.reset(delta._value)\n" + " delta\n" + + " fun ref converge(other: Container[V] box) =>\n" + " _value.converge(other._value)\n" + + "actor Main\n" + " new create(env: Env) =>\n" + " None"; + + TEST_COMPILE(src); +}