rascal icon indicating copy to clipboard operation
rascal copied to clipboard

Inaccurate error message about IsDefined operator may cause confusion

Open jurgenvinju opened this issue 3 years ago • 1 comments

Describe the bug

Is defined operator ? can only be applied to a keyword parameter

This is not true. It can be used on positional field names as well, and on map keys and I believe even domain elements of relations.

constructor.fieldName?
myMap[myKey]?
myRel[myDomain]?
myList[myIndex]?

Perhaps even more?

jurgenvinju avatar Mar 18 '22 09:03 jurgenvinju

It can not be used on pure variable names however.

Perhaps it can be used to check assignment of default values of keyword parameters of functions, but I'm pretty sure that's not a feature of the interpreter anymore. For keyword fields of ADTs, yes.

jurgenvinju avatar Mar 18 '22 09:03 jurgenvinju