Skip to content

have better error message for a case of missing/misnamed variable #145

@paciorek

Description

@paciorek

Here's a case where we should explicitly say that y is not found.

go = nFunction(
   fun = function(x = 'numericVector') {
       for(i in 1:length(y)) {}
       })
cgo <- nCompile(go)
An error occurred in compiler stage labelAbstractTypes (for method or nFunction nFun_10_NFID_14):
argument is of length zero
This occurred while: handling labelAbstractTypes for y.
Error in if (code$args[[1]]$type$nDim >= 2) { : 
  argument is of length zero

I will note that in other scenarios we do better messaging, so there's probably something about the nesting that needs to be investigated.

go = nFunction(
   fun = function(x = 'numericVector') {
       y <- z
       })
cgo <- nCompile(go)
An error occurred in compiler stage labelAbstractTypes (for method or nFunction nFun_9_NFID_13):
variable 'z' has not been created yet.
This occurred while: handling labelAbstractTypes for z.
Error: variable 'z' has not been created yet.

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