Skip to content

Commit

Permalink
Avoid ambiguity for local method
Browse files Browse the repository at this point in the history
effectively Case 2 in chapel-lang#19352.

---
Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
  • Loading branch information
mppf committed May 10, 2022
1 parent 8bf282e commit 934865f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 52 deletions.
5 changes: 3 additions & 2 deletions test/functions/generic/poi/check-gc-reuse-opers.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ module User {
}
}
proc u3() {
proc MyRecord.init(param p) { note("u3.init", 2); rp = 0; }
proc MyRecord.init=(other) { note("u3.init=", 2); rp = 0; }
// having these methods here would lead to ambiguity -- see #19352
//proc MyRecord.init(param p) { note("u3.init", 2); rp = 0; }
//proc MyRecord.init=(other) { note("u3.init=", 2); rp = 0; }
operator =(ref lhs:MyRecord, rhs:MyRecord) { note("u3.=", 2); }
operator <(lhs:MyRecord, rhs:MyRecord) { note("u3.<", 2);
return true; }
Expand Down
95 changes: 45 additions & 50 deletions test/functions/generic/poi/check-gc-reuse-opers.good
Original file line number Diff line number Diff line change
Expand Up @@ -21,84 +21,79 @@ check-gc-reuse-opers.chpl:27: warning: User._castT
check-gc-reuse-opers.chpl:49: In function 'u2':
check-gc-reuse-opers.chpl:51: warning: User.u2
check-gc-reuse-opers.chpl:60: In function 'u3':
check-gc-reuse-opers.chpl:69: warning: User.u3
check-gc-reuse-opers.chpl:23: In function 'libIE':
check-gc-reuse-opers.chpl:23: warning: u3.init=
check-gc-reuse-opers.chpl:71: called as libIE(myArg: int(64))
check-gc-reuse-opers.chpl:70: warning: User.u3
check-gc-reuse-opers.chpl:24: In function 'libAS':
check-gc-reuse-opers.chpl:24: warning: u3.=
check-gc-reuse-opers.chpl:72: called as libAS(myArg: int(64))
check-gc-reuse-opers.chpl:73: called as libAS(myArg: int(64))
check-gc-reuse-opers.chpl:25: In function 'libLT':
check-gc-reuse-opers.chpl:25: warning: u3.<
check-gc-reuse-opers.chpl:73: called as libLT(myArg: int(64))
check-gc-reuse-opers.chpl:74: called as libLT(myArg: int(64))
check-gc-reuse-opers.chpl:26: In function 'libCF':
check-gc-reuse-opers.chpl:26: warning: u3._castF
check-gc-reuse-opers.chpl:74: called as libCF(myArg: int(64))
check-gc-reuse-opers.chpl:75: called as libCF(myArg: int(64))
check-gc-reuse-opers.chpl:27: In function 'libCT':
check-gc-reuse-opers.chpl:27: warning: u3._castT
check-gc-reuse-opers.chpl:75: called as libCT(myArg: int(64))
check-gc-reuse-opers.chpl:60: In function 'u3':
check-gc-reuse-opers.chpl:68: warning: u3.init
check-gc-reuse-opers.chpl:114: In function 'm1con':
check-gc-reuse-opers.chpl:115: warning: More1.m1con
check-gc-reuse-opers.chpl:76: called as libCT(myArg: int(64))
check-gc-reuse-opers.chpl:115: In function 'm1con':
check-gc-reuse-opers.chpl:116: warning: More1.m1con
check-gc-reuse-opers.chpl:23: In function 'libIE':
check-gc-reuse-opers.chpl:23: warning: More1.init=
check-gc-reuse-opers.chpl:117: called as libIE(myArg: int(64))
check-gc-reuse-opers.chpl:118: called as libIE(myArg: int(64))
check-gc-reuse-opers.chpl:24: In function 'libAS':
check-gc-reuse-opers.chpl:24: warning: More1.=
check-gc-reuse-opers.chpl:118: called as libAS(myArg: int(64))
check-gc-reuse-opers.chpl:119: called as libAS(myArg: int(64))
check-gc-reuse-opers.chpl:25: In function 'libLT':
check-gc-reuse-opers.chpl:25: warning: More1.<
check-gc-reuse-opers.chpl:119: called as libLT(myArg: int(64))
check-gc-reuse-opers.chpl:120: called as libLT(myArg: int(64))
check-gc-reuse-opers.chpl:26: In function 'libCF':
check-gc-reuse-opers.chpl:26: warning: More1._castF
check-gc-reuse-opers.chpl:120: called as libCF(myArg: int(64))
check-gc-reuse-opers.chpl:121: called as libCF(myArg: int(64))
check-gc-reuse-opers.chpl:27: In function 'libCT':
check-gc-reuse-opers.chpl:27: warning: More1._castT
check-gc-reuse-opers.chpl:121: called as libCT(myArg: int(64))
check-gc-reuse-opers.chpl:112: In function ':':
check-gc-reuse-opers.chpl:113: warning: More1.init
check-gc-reuse-opers.chpl:122: called as libCT(myArg: int(64))
check-gc-reuse-opers.chpl:113: In function ':':
check-gc-reuse-opers.chpl:114: warning: More1.init
check-gc-reuse-opers.chpl:27: called as :(rhs: int(64), type t = MyRecord) from function 'libCT'
check-gc-reuse-opers.chpl:121: called as libCT(myArg: int(64))
check-gc-reuse-opers.chpl:123: In function 'm1gen':
check-gc-reuse-opers.chpl:124: warning: More1.m1gen
check-gc-reuse-opers.chpl:85: called as m1gen(param p = 0)
check-gc-reuse-opers.chpl:137: In function 'm2con':
check-gc-reuse-opers.chpl:138: warning: More2.m2con
check-gc-reuse-opers.chpl:141: In function 'm2gen':
check-gc-reuse-opers.chpl:142: warning: More2.m2gen
check-gc-reuse-opers.chpl:90: called as m2gen(param p = 0)
check-gc-reuse-opers.chpl:180: In function 'combo2a':
check-gc-reuse-opers.chpl:181: warning: Combo2.combo2a
check-gc-reuse-opers.chpl:164: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:122: called as libCT(myArg: int(64))
check-gc-reuse-opers.chpl:124: In function 'm1gen':
check-gc-reuse-opers.chpl:125: warning: More1.m1gen
check-gc-reuse-opers.chpl:86: called as m1gen(param p = 0)
check-gc-reuse-opers.chpl:138: In function 'm2con':
check-gc-reuse-opers.chpl:139: warning: More2.m2con
check-gc-reuse-opers.chpl:142: In function 'm2gen':
check-gc-reuse-opers.chpl:143: warning: More2.m2gen
check-gc-reuse-opers.chpl:91: called as m2gen(param p = 0)
check-gc-reuse-opers.chpl:181: In function 'combo2a':
check-gc-reuse-opers.chpl:182: warning: Combo2.combo2a
check-gc-reuse-opers.chpl:165: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:23: In function 'libIE':
check-gc-reuse-opers.chpl:23: warning: Combo1.init=
check-gc-reuse-opers.chpl:183: called as libIE(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:164: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:184: called as libIE(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:165: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:24: In function 'libAS':
check-gc-reuse-opers.chpl:24: warning: Combo1.=
check-gc-reuse-opers.chpl:184: called as libAS(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:164: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:185: called as libAS(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:165: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:25: In function 'libLT':
check-gc-reuse-opers.chpl:25: warning: Combo1.<
check-gc-reuse-opers.chpl:185: called as libLT(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:164: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:186: called as libLT(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:165: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:26: In function 'libCF':
check-gc-reuse-opers.chpl:26: warning: Combo1._castF
check-gc-reuse-opers.chpl:186: called as libCF(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:164: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:187: called as libCF(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:165: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:27: In function 'libCT':
check-gc-reuse-opers.chpl:27: warning: Combo1._castT
check-gc-reuse-opers.chpl:187: called as libCT(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:164: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:160: In function ':':
check-gc-reuse-opers.chpl:161: warning: Combo1.init
check-gc-reuse-opers.chpl:188: called as libCT(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:165: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:161: In function ':':
check-gc-reuse-opers.chpl:162: warning: Combo1.init
check-gc-reuse-opers.chpl:27: called as :(rhs: int(64), type t = MyRecord) from function 'libCT'
check-gc-reuse-opers.chpl:187: called as libCT(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:164: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:166: In function 'combo1b':
check-gc-reuse-opers.chpl:167: warning: Combo1.combo1b
check-gc-reuse-opers.chpl:191: called as combo1b(param p = 0)
check-gc-reuse-opers.chpl:188: called as libCT(myArg: int(64)) from function 'combo2a'
check-gc-reuse-opers.chpl:165: called as combo2a(param p = 0)
check-gc-reuse-opers.chpl:167: In function 'combo1b':
check-gc-reuse-opers.chpl:168: warning: Combo1.combo1b
check-gc-reuse-opers.chpl:192: called as combo1b(param p = 0)

User.u1
User.init
Expand All @@ -120,12 +115,12 @@ User.init

User.u3
User.init
u3.init=
User.init=
u3.=
u3.<
u3._castF
u3._castT
u3.init
User.init

More1.m1con
User.init
Expand Down

0 comments on commit 934865f

Please sign in to comment.