@@ -373,11 +373,15 @@ inferBinder val (NamedBinder name binder) = do
373 return $ M.insert name val m
373 return $ M.insert name val m
374inferBinder val (PositionedBinder pos _ binder) =
374inferBinder val (PositionedBinder pos _ binder) =
375 warnAndRethrowWithPosition pos $ inferBinder val binder
375 warnAndRethrowWithPosition pos $ inferBinder val binder
376−-- TODO: When adding support for polymorphic types, check subsumption here
376+-- TODO: When adding support for polymorphic types, check subsumption here,
377−-- and change the definition of `binderRequiresMonotype`
377+-- change the definition of `binderRequiresMonotype`,
378+-- and use `kindOfWithScopedVars`.
378inferBinder val (TypedBinder ty binder) = do
379inferBinder val (TypedBinder ty binder) = do
379− ty' <- replaceAllTypeSynonyms ty
380+ ty1 <- replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty
381+ kind <- liftCheck $ kindOf ty1
382+ checkTypeKind ty1 kind
380− val =?= ty' >> inferBinder val binder
384+ inferBinder val binder
382-- | Returns true if a binder requires its argument type to be a monotype.
386-- | Returns true if a binder requires its argument type to be a monotype.
383-- | If this is the case, we need to instantiate any polymorphic types before checking binders.
387-- | If this is the case, we need to instantiate any polymorphic types before checking binders.