Browse Source

Add call-generic-function-from-generic-function test

David Peter 1 year ago
parent
commit
2d3ae3b05a
1 changed files with 7 additions and 7 deletions
  1. 7 7
      numbat/src/typechecker/tests.rs

+ 7 - 7
numbat/src/typechecker/tests.rs

@@ -22,14 +22,9 @@ const TEST_PRELUDE: &str = "
     struct SomeStruct { a: A, b: B }
 
     let callable = takes_a_returns_b
-    ";
 
-fn base_type(name: &str) -> BaseRepresentation {
-    BaseRepresentation::from_factor(BaseRepresentationFactor(
-        name.into(),
-        Rational::from_integer(1),
-    ))
-}
+    fn atan2<T>(x: T, y: T) -> Scalar
+    ";
 
 fn type_a() -> DType {
     DType::base_dimension("A")
@@ -254,6 +249,11 @@ fn generics_basic() {
             f(2 a, 2 b)
             ",
     );
+    assert_successful_typecheck(
+        "
+        fn f3<T>(y: T, x: T) = atan2(y, x)
+        ",
+    );
 
     // assert!(matches!(
     //     get_typecheck_error("fn f<T1, T2>(x: T1, y: T2) -> T2/T1 = x/y"),