Skip to content

Commit ec12f30

Browse files
committed
Add failing test case for application-based function subtyping
1 parent 2241520 commit ec12f30

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module Main where
2+
3+
class Semigroupoid :: forall k. (k -> k -> Type) -> Constraint
4+
class Semigroupoid f where
5+
compose :: forall a b c. f b c -> f a b -> f a c
6+
7+
instance semigroupoidFn :: Semigroupoid (->) where
8+
compose f g x = f (g x)
9+
10+
newtype Tagged :: Int -> Type -> Type
11+
newtype Tagged n a = Tagged a
12+
13+
type ConcreteTagged :: Type -> Type
14+
type ConcreteTagged a = Tagged 42 a
15+
16+
type HiddenTagged :: Type -> Type
17+
type HiddenTagged a = forall (n :: Int). Tagged n a
18+
19+
make :: forall a. a -> HiddenTagged a
20+
make n = Tagged n
21+
22+
newtype ConcreteNewtype a = ConcreteNewtype (ConcreteTagged a)
23+
24+
test :: forall a. a -> ConcreteNewtype a
25+
test = compose ConcreteNewtype make

tests-integration/fixtures/checking2/260_hidden_forall_compose_application_subtype/Main.snap

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests-integration/tests/checking2/generated.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,3 +543,5 @@ fn run_test(folder: &str, file: &str) {
543543
#[rustfmt::skip] #[test] fn test_258_self_recursive_through_operator_main() { run_test("258_self_recursive_through_operator", "Main"); }
544544

545545
#[rustfmt::skip] #[test] fn test_259_hidden_forall_scope_check_main() { run_test("259_hidden_forall_scope_check", "Main"); }
546+
547+
#[rustfmt::skip] #[test] fn test_260_hidden_forall_compose_application_subtype_main() { run_test("260_hidden_forall_compose_application_subtype", "Main"); }

0 commit comments

Comments
 (0)