Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adds new futures for chapel-lang#26083

Tested that futures pass locally

[Reviewed by @mppf]
  • Loading branch information
jabraham17 authored Oct 14, 2024
2 parents 02f6103 + e5cba67 commit aa64396
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/functions/ferguson/spec-insn-method-no-this.bad
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
spec-insn-method-no-this.chpl:10: In method 'bar':
spec-insn-method-no-this.chpl:11: error: 'x' used before defined
spec-insn-method-no-this.chpl:16: note: defined here
spec-insn-method-no-this.chpl:21: note: defined here
6 changes: 6 additions & 0 deletions test/functions/ferguson/spec-insn-method-no-this.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ proc (R(int)).bar() {
writeln("in specific R(int).bar, x=", tmp);
}

proc getR type do return R(int);
proc getR.baz() {
var tmp = x; // as above, x refers to field, `this` is implicit
writeln("in specific R(int).baz, x=", tmp);
}

var x = new R(1);
x.foo();
x.bar();
x.baz();
1 change: 1 addition & 0 deletions test/functions/ferguson/spec-insn-method-no-this.good
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
in specific R(int).foo, x=1
in specific R(int).bar, x=1
in specific R(int).baz, x=1
3 changes: 3 additions & 0 deletions test/functions/ferguson/spec-insn-type-method-no-this.bad
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spec-insn-type-method-no-this.chpl:11: In method 'bar':
spec-insn-type-method-no-this.chpl:12: error: 't' used before defined
spec-insn-type-method-no-this.chpl:22: note: defined here
25 changes: 25 additions & 0 deletions test/functions/ferguson/spec-insn-type-method-no-this.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// similar to spec-insn-method-no-this.chpl, but with type methods
record R {
type t;
}

proc type (R(int)).foo() {
type tmp = this.t;
writeln("in specific R(int).foo, x=", tmp:string);
}

proc type (R(int)).bar() {
type tmp = t; // as above, t refers to field, `this` is implicit
writeln("in specific R(int).bar, x=", tmp:string);
}

proc getR type do return R(int);
proc type getR.baz() {
type tmp = t; // as above, t refers to field, `this` is implicit
writeln("in specific R(int).baz, x=", tmp:string);
}

type t = R(int);
t.foo();
t.bar();
t.baz();
6 changes: 6 additions & 0 deletions test/functions/ferguson/spec-insn-type-method-no-this.future
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bug: implicit this not working for type method on specific instantiation
#26083

Field and method accesses get an implicit `this` added during scopeResolve, but
for specific instantiations, scopeResolve does not do its usual work because
the type of `this` is not known until functionResolution.
3 changes: 3 additions & 0 deletions test/functions/ferguson/spec-insn-type-method-no-this.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
in specific R(int).foo, x=int(64)
in specific R(int).bar, x=int(64)
in specific R(int).baz, x=int(64)

0 comments on commit aa64396

Please sign in to comment.