Branch: refs/heads/master
Revision: 63449c9
Author: vasslitvinov
Log Message:
Merge pull request #17347 from vasslitvinov/fix-error-called-as
Ensure nilability is reflected is "called as" messages
This ensures that the argument type is shown as nilable when appropriate
in the "called as" lines of error messages, for example:
errors-called-as.chpl:8: In function 'showU1':
errors-called-as.chpl:13: error: Scoped variable curr would outlive the value it is set to
errors-called-as.chpl:11: note: consider scope of cur
errors-called-as.chpl:19: called as showU1(name: string, list: owned clist?)
DETAILS
When compiling this test:
test/classes/delete-free/lifetimes/errors-called-as.chpl
the compiler gives the above error in checkLifetimesAndNilDereferences()
during the callDestructors pass.
The last line of it ("called as ....") is, however, printed after the pass
completes and USR_STOP() is invoked, calling printCallstackForLastError().
Therefore this is after callDestructors runs convertClassTypesToCanonical(),
which eliminates nilability declarations from all class types. This makes
the argument type non-nilable and the message showing a non-nilable type
incorrectly.
To fix this, issue USR_STOP() as start of convertClassTypesToCanonical(),
so that the types remains unaffected, should they need to be printed out.
Updated a couple of .good files that previously showed non-nilable borrowed
types instead of nilable and/or unmanaged types in the "called as" messages.
Whether this symptom occurred depended on the test and on the combination
of --devel
and --verify
compilation options.
r: @mppf
Modified Files:
A test/classes/delete-free/lifetimes/errors-called-as.chpl
A test/classes/delete-free/lifetimes/errors-called-as.compopts
A test/classes/delete-free/lifetimes/errors-called-as.good
M compiler/AST/DecoratedClassType.cpp
M test/classes/errors/nilability-init-field-arg/init-field-arg-nonnil-owned-from-nonnil-unmanaged.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-nonnil-owned-from-oknil-borrowed.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-nonnil-owned-from-oknil-unmanaged.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-nonnil-shared-from-nonnil-unmanaged.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-nonnil-shared-from-oknil-borrowed.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-nonnil-shared-from-oknil-unmanaged.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-oknil-owned-from-nonnil-unmanaged.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-oknil-owned-from-oknil-borrowed.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-oknil-owned-from-oknil-unmanaged.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-oknil-shared-from-nonnil-unmanaged.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-oknil-shared-from-oknil-borrowed.good
M test/classes/errors/nilability-init-field-arg/init-field-arg-oknil-shared-from-oknil-unmanaged.good
Compare: https://github.com/chapel-lang/chapel/compare/bb6c1346fb48...63449c9010cd