Skip to content

error trap incorrect type declarations #155

@paciorek

Description

@paciorek
> nf <- nFunction(
    fun = function(x = 'numericXXX') {
        return(x/y)
    }, returnType = 'numericVector'
)

cnf <- nCompile(nf)
An error occurred in compiler stage labelAbstractTypes (for method or nFunction nFun_24_NFID_28):
argument is of length zero
This occurred while: handling labelAbstractTypes for y.
Error in if (a1Type$nDim != a2Type$nDim) { : argument is of length zero
In addition: Warning message:
In max(a1Type$nDim, a2Type$nDim) :
  no non-missing arguments to max; returning -Inf

In contrast, invalid returnType values give a reasonable error message:

An error occurred in compiler stage doImplementation:
argument is of length zero
This occurred while: handling eigenize for y.
Error in if (code$args[[i]]$type$type != resultType) { : 
  argument is of length zero
In addition: Warning message:
Object type for return() does not match the nFunction's return type.
 This occurred for: return(x / y)
 This was part of the call:  {
    return(x / y)
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions