                 private class Runtime<T> {
                     var results = [Int: T]()
                     let arguments: [T]
-                    let returnValue: T?
-                    init(arguments: [T], returnValue: T? = nil) {
+                    init(arguments: [T]) {
                         self.arguments = arguments
-                        self.returnValue = returnValue
+                    }
+                }
+
+                private class TypecheckRuntime: Runtime<DeclarationType> {
+                    let returnType: DeclarationType
+                    var releaseResult: [Int]
+                    init(arguments: [DeclarationType], returnType: DeclarationType, count: Int) {
+                        self.returnType = returnType
+                        releaseResult = Array(0..<count)
+                        super.init(arguments: arguments)
                     }
                 }
                 

        output.append("""
                        }
                    }
                    if let returnType = runtime.returnValue {
                        let stepStack = stepStack.appending(function.steps.count)
                        guard function.hasReturnStep else { throw DecodeError(cause: .returnMissing, stack: stepStack) }
                        try check(function.returnStep, with: returnType, function: function, stack: stack, stepStack: stepStack)
                    } else if function.hasReturnStep { throw DecodeError(cause: .returnMismatch, stack: stepStack) }
                }
                
                func typecheck(function: Function, arguments: [DeclarationType], returnType: DeclarationType?) throws {
                    try typecheck(function: function, stack: [Runtime(arguments: arguments, returnValue: returnType)], stepStack: [])
                }

                private func value(_ a: Function.A, in stack: [Runtime<Any>]) -> Any {

        if let type = functionType.returnType {
            output.append("], returnType: .\(type)Type)\n    return {")
        } else {
            output.append("], returnType: .none)\n    return {")
        }
        if let type = functionType.returnType, case .function? = parser.typesMap[type] {
            output.append("\n        let result = decoderRuntime.run(function: function, symbols: symbols, arguments: [")
