-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implement tracked
members
#21761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Implement tracked
members
#21761
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6465291
First draft of abstract tracked vals
KacperFKorban f1d146d
Disallow tracked for unusupported definitions, move tracked modifier …
KacperFKorban d2b6a61
Fix handling tracked param accessors
KacperFKorban f7b7188
Fix tracked modifier checks
KacperFKorban 567b2c1
Support inferring precise types for non-overriding members declared a…
KacperFKorban 28b5725
Move setAbstractTrackedInfo to Namer.Completer
mbovel 4133b83
Move tracked inference logic to `inferredResultType `
mbovel 9ff1af7
Also infer a precise type when tracked is not inherited
mbovel b15153e
Merge pull request #53 from dotty-staging/mb/abstract-tracked-namer
KacperFKorban 8208d46
Add a section about tracked members to the modularity doc and update the
KacperFKorban b3fedfd
Update compiler/src/dotty/tools/dotc/typer/Namer.scala
KacperFKorban 214bfda
Merge branch 'main' into abstract-tracked
KacperFKorban File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,20 @@ | ||
-- [E156] Syntax Error: tests/neg/abstract-tracked.scala:4:14 ---------------------------------------------------------- | ||
4 |tracked trait F // error | ||
|^^^^^^^^^^^^^^^ | ||
|Modifier tracked is not allowed for this definition | ||
-- [E156] Syntax Error: tests/neg/abstract-tracked.scala:9:15 ---------------------------------------------------------- | ||
9 |tracked object O // error | ||
|^^^^^^^^^^^^^^^^ | ||
|Modifier tracked is not allowed for this definition | ||
-- [E156] Syntax Error: tests/neg/abstract-tracked.scala:11:14 --------------------------------------------------------- | ||
11 |tracked class C // error | ||
|^^^^^^^^^^^^^^^ | ||
|Modifier tracked is not allowed for this definition | ||
-- [E156] Syntax Error: tests/neg/abstract-tracked.scala:7:14 ---------------------------------------------------------- | ||
7 | tracked def f: F // error | ||
| ^^^^^^^^^^^^^^^^ | ||
| Modifier tracked is not allowed for this definition | ||
-- [E156] Syntax Error: tests/neg/abstract-tracked.scala:14:14 --------------------------------------------------------- | ||
14 | tracked val x = 1 // error | ||
| ^^^^^^^^^^^^^^^^^ | ||
| Modifier tracked is not allowed for this definition |
This file contains hidden or 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,14 @@ | ||
import scala.language.experimental.modularity | ||
import scala.language.future | ||
|
||
tracked trait F // error | ||
|
||
trait G: | ||
tracked def f: F // error | ||
|
||
tracked object O // error | ||
|
||
tracked class C // error | ||
|
||
def f = | ||
tracked val x = 1 // error |
This file contains hidden or 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 hidden or 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 hidden or 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,50 @@ | ||
import scala.language.experimental.modularity | ||
import scala.language.future | ||
|
||
trait F: | ||
tracked val a: Int | ||
|
||
trait G: | ||
tracked val b: Int | ||
|
||
trait H: | ||
tracked val c: Int = 3 | ||
|
||
trait I extends F | ||
|
||
trait J extends F: | ||
val a: Int = 1 | ||
|
||
class K(tracked val d: Int) | ||
|
||
class L | ||
|
||
trait M: | ||
val f: Int | ||
|
||
object Test: | ||
val f = new F: | ||
val a = 1 | ||
val g = new G: | ||
val b: 2 = 2 | ||
val h = new H: | ||
override val c = 4 | ||
val i = new I: | ||
val a = 5 | ||
val j = new J: | ||
override val a = 6 | ||
val k = new K(7) | ||
val l = new L { | ||
tracked val e = 8 | ||
} | ||
val m = new M: | ||
tracked val f = 9 | ||
|
||
summon[f.a.type <:< 1] | ||
summon[g.b.type <:< 2] | ||
summon[h.c.type <:< 4] | ||
summon[i.a.type <:< 5] | ||
summon[j.a.type <:< 6] | ||
summon[k.d.type <:< 7] | ||
// summon[l.e.type <:< 8] // unrelated issue -- error: e is not a member of L | ||
summon[m.f.type <:< 9] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.