-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docstring and attribute support to interfaces (#25825)
Adds compiler support for interfaces to have attributes applied to them and have docstrings recognized by chpldoc Resolves #17383 Relies on chapel-lang/sphinxcontrib-chapeldomain#95 This PR also updates the interface `Allocators.allocator`. #25821 will update the existing Sort module allocators. No other allocators are currently shown in our documentation While adding tests of `@unstable` with interfaces, I found that some tests weren't actually testing what we thought they were (i.e. `test/unstable-keyword/enum_test1.chpl`), so I updated them Testing - [x] full paratest with/without comm [Reviewed by @lydia-duncan and @DanilaFe]
- Loading branch information
Showing
18 changed files
with
5,487 additions
and
5,221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docs/source/modules/interface.doc.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
An interface without formals | ||
*/ | ||
interface myInterface { | ||
/* The foo method */ | ||
proc Self.foo(); | ||
@deprecated("bar is deprecated") | ||
proc Self.bar(); | ||
} | ||
|
||
/* | ||
An interface with formals | ||
*/ | ||
@unstable("I am unstable") | ||
interface myInterfaceWithFormals(T1, T2) { | ||
proc Self.foo(x: T1); | ||
/* The bar method */ | ||
proc Self.bar(y: T2); | ||
@chpldoc.nodoc | ||
proc Self.hidden(); | ||
} | ||
|
||
@chpldoc.nodoc | ||
interface hiddenInterface { | ||
proc Self.hidden(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.. default-domain:: chpl | ||
|
||
.. module:: interface.doc | ||
|
||
interface.doc | ||
============= | ||
**Usage** | ||
|
||
.. code-block:: chapel | ||
|
||
use interface.doc; | ||
|
||
|
||
or | ||
|
||
.. code-block:: chapel | ||
|
||
import interface.doc; | ||
|
||
.. interface:: interface myInterface | ||
|
||
|
||
An interface without formals | ||
|
||
.. method:: proc Self.foo() | ||
|
||
The foo method | ||
|
||
.. method:: proc Self.bar() | ||
|
||
.. warning:: | ||
|
||
bar is deprecated | ||
|
||
.. interface:: interface myInterfaceWithFormals(type T1, type T2) | ||
|
||
.. warning:: | ||
|
||
I am unstable | ||
|
||
|
||
An interface with formals | ||
|
||
.. method:: proc Self.foo(x: T1) | ||
|
||
.. method:: proc Self.bar(y: T2) | ||
|
||
The bar method | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
@deprecated("I am deprecated") | ||
interface myInterface { | ||
proc Self.foo(); | ||
proc Self.bar(); | ||
} | ||
|
||
record R1: myInterface { // should warn | ||
proc foo() { | ||
writeln("foo"); | ||
} | ||
proc bar() { | ||
writeln("bar"); | ||
} | ||
} | ||
var r1 = new R1(); | ||
r1.foo(); | ||
r1.bar(); | ||
|
||
record R2 {} | ||
R2 implements myInterface; // should warn | ||
proc R2.foo() { | ||
writeln("foo"); | ||
} | ||
proc R2.bar() { | ||
writeln("bar"); | ||
} | ||
var r2 = new R2(); | ||
r2.foo(); | ||
r2.bar(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
handleInterface.chpl:21: warning: I am deprecated | ||
handleInterface.chpl:8: warning: I am deprecated | ||
foo | ||
bar | ||
foo | ||
bar |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.