You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I pass the type borrowed C to a function and then instantiate the type argument using new, I expect an instance of a borrowed C but get an owned C.
Steps to Reproduce
Source Code:
class C { var x:int=0; }
proc test(type t) {
var x =new t(128);
compilerWarning(x.type:string);
return;
}
type t =borrowed C?;
test(t);
The text was updated successfully, but these errors were encountered:
It's clear that the decorator is there and then is being ignored, though...
class C { var x:int=0; }
proc test(type t) {
var x =newborrowed t(128);
compilerWarning(x.type:string);
return;
}
type T =borrowed C?;
test(T);
TestPassedBorrow.chpl:3: In function 'test':
TestPassedBorrow.chpl:4: error: duplicate decorators - borrowed borrowed C?
TestPassedBorrow.chpl:9: Function 'test' instantiated as: test(type t = borrowed C?)
TestPassedBorrow.chpl:9: warning: borrowed C?
If the class didn't have a decorator attached to it I would expect an implicit owned. But when it already has a borrowed, seems weird to just discard it.
Fix problem with new applied to a borrowed nilable type argument
Resolves#15586
Reviewed by @dlongnecke-cray - thanks!
- [x] full local futures testing
Summary of Problem
When I pass the type
borrowed C
to a function and then instantiate the type argument usingnew
, I expect an instance of aborrowed C
but get anowned C
.Steps to Reproduce
Source Code:
The text was updated successfully, but these errors were encountered: