Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Chandler Carruth <[email protected]>
  • Loading branch information
jonmeow and chandlerc committed Mar 11, 2024
1 parent 289337c commit fec567f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions proposals/p3762.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
## Abstract

- Add the `extern` keyword for forward declarations in libraries that don't
have the definition.
provide the definition.
- Treat repeated forward declarations as redundant.
- Allow them when they prevent a dependence on an imported name.
- Clarify rules for when modifier keywords should be on forward declarations
Expand Down Expand Up @@ -248,7 +248,7 @@ import library "a";
fn Foo(c: C);
// Invalid: `F` used the imported `C`, so an `extern` declaration of `C` is now
// Invalid: `Foo` used the imported `C`, so an `extern` declaration of `C` is now
// invalid.
extern class C;
```
Expand Down Expand Up @@ -304,16 +304,20 @@ For example:
class C {
class D;
fn F();
fn F() -> D;
class D {
fn G() { return C.F(); }
fn G() -> Self { return C.F(); }
var x: i32;
}
fn F() { D.G(); }
fn F() -> D { return {.x = 42}; }
}
```

This is necessary because type bodies are not automatically moved out-of-line,
unlike function types.
unlike function bodies.

### Merging `extern` declarations

Expand All @@ -330,7 +334,7 @@ different imported libraries):
For a new declaration in the importing file, an imported `extern` declaration is
always superseded. It is invalid to use the imported declaration before the new
declaration. It is considered the same entity for type checking, but diagnostics
will lean towards the local definition.
should use the local definition.

For a new declaration in the importing file, an imported non-`extern`
declaration will:
Expand Down

0 comments on commit fec567f

Please sign in to comment.