Skip to content

Instantly share code, notes, and snippets.

@frenchy64
Last active December 16, 2015 06:39
Show Gist options
  • Save frenchy64/5393338 to your computer and use it in GitHub Desktop.
Save frenchy64/5393338 to your computer and use it in GitHub Desktop.
Multiple errors
(ns test-core-typed.core
(:import (clojure.lang Symbol))
(:require [clojure.core.typed :refer [ann]]))
(ann foo-bar [Symbol -> Number])
(defn foo-bar [a]
(+ a 1))
(ann barbar [Number -> Boolean])
(defn barbar [a]
(inc a))
user=> (require '[clojure.core.typed :refer [check-ns]])
nil
user=> (check-ns 'test-core-typed.core)
Initializing core.typed ...
core.typed initialized.
Checking line: 5
Checking line: 6
Checking line: 9
Checking line: 10
Type Error (test-core-typed.core:7:3) Static method clojure.lang.Numbers/add could not be applied to arguments:
Domains:
(U java.math.BigInteger java.lang.Integer java.lang.Long clojure.lang.BigInt java.lang.Short java.lang.Byte) (U java.math.BigInteger java.lang.Integer java.lang.Long clojure.lang.BigInt java.lang.Short java.lang.Byte)
java.lang.Number java.lang.Number
Arguments:
clojure.lang.Symbol (Value 1)
with expected type:
java.lang.Number
in: (clojure.lang.Numbers/add a 1)
Type Error (test-core-typed.core:11:3) Return type of static method clojure.lang.Numbers/inc is java.lang.Number, expected java.lang.Boolean.
in: (clojure.lang.Numbers/inc a)
Type Error (test-core-typed.core:11:3) Expected type: java.lang.Boolean, Actual: java.lang.Number
Type Error (test-core-typed.core:10:1) Expected type: (Fn [java.lang.Number -> java.lang.Boolean]), Actual: (Fn [java.lang.Number -> java.lang.Number])
ExceptionInfo Type Checker: Found 4 errors clojure.core/ex-info (core.clj:4327)
user=>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment