Skip to content

BPORT: Include used types in the set of used names#2523

Merged
eed3si9n merged 1 commit intosbt:0.13from
smarter:bug/inv-subtyping
May 4, 2016
Merged

BPORT: Include used types in the set of used names#2523
eed3si9n merged 1 commit intosbt:0.13from
smarter:bug/inv-subtyping

Conversation

@smarter
Copy link
Contributor

@smarter smarter commented Mar 27, 2016

This is a backport of sbt/zinc#87

When B2.scala replaces B.scala in the new test
types-in-used-names-a, the name hash of listb does not change because
the signature of C.listb is still List[B], however users of
C.listb have to be recompiled since the subtyping relationships of its
type have changed.

This commit does this by extending the definition of "used names" to
also include the names of the types of trees, even if these types
do not appear in the source like List[B] in D.scala (since B has
been invalidated, this will force the recompilation of D.scala).

This commit does not fix every issue with used types as illustrated by
the pending test types-in-used-names-b, B.scala is not recompiled
because it uses the type T whose hash has not changed, but T is
bounded by S and S has changed, so it should be recompiled.
This should be fixable by including the type bounds underlying a
TypeRef in symbolsInType.

The test as-seen-from-a that did not work before shows that we may not
have to worry about tracking prefixes in ExtractAPI anymore, see the
discussion in sbt/zinc#87 for more information.

@eed3si9n eed3si9n added the ready label Mar 27, 2016
@smarter smarter force-pushed the bug/inv-subtyping branch from b7887e7 to e384bd6 Compare April 9, 2016 19:22
smarter added a commit to smarter/sbt that referenced this pull request Apr 14, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
smarter added a commit to smarter/sbt that referenced this pull request Apr 14, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
smarter added a commit to smarter/sbt that referenced this pull request Apr 15, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
smarter added a commit to smarter/sbt that referenced this pull request Apr 15, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
@smarter smarter force-pushed the bug/inv-subtyping branch from e384bd6 to a27c750 Compare April 15, 2016 16:44
smarter added a commit to smarter/sbt that referenced this pull request Apr 15, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
@smarter smarter force-pushed the bug/inv-subtyping branch from a27c750 to e534fc3 Compare April 15, 2016 21:44
smarter added a commit to smarter/sbt that referenced this pull request Apr 15, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
@smarter smarter force-pushed the bug/inv-subtyping branch from e534fc3 to 7a47eb4 Compare April 16, 2016 00:33
smarter added a commit to smarter/sbt that referenced this pull request Apr 16, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
@smarter smarter force-pushed the bug/inv-subtyping branch 4 times, most recently from 928f24b to e9f37da Compare April 18, 2016 14:48
smarter added a commit to smarter/sbt that referenced this pull request Apr 18, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
@smarter smarter force-pushed the bug/inv-subtyping branch from e9f37da to e66cbcb Compare April 19, 2016 15:02
smarter added a commit to smarter/sbt that referenced this pull request Apr 19, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
This is a backport of sbt/zinc#87

When `B2.scala` replaces `B.scala` in the new test
`types-in-used-names-a`, the name hash of `listb` does not change because
the signature of `C.listb` is still `List[B]`, however users of
`C.listb` have to be recompiled since the subtyping relationships of its
type have changed.

This commit does this by extending the definition of "used names" to
also include the names of the types of trees, even if these types
do not appear in the source like `List[B]` in `D.scala` (since `B` has
been invalidated, this will force the recompilation of `D.scala`).

This commit does not fix every issue with used types as illustrated by
the pending test `types-in-used-names-b`, `B.scala` is not recompiled
because it uses the type `T` whose hash has not changed, but `T` is
bounded by `S` and `S` has changed, so it should be recompiled.
This should be fixable by including the type bounds underlying a
`TypeRef` in `symbolsInType`.

The test `as-seen-from-a` that did not work before shows that we may not
have to worry about tracking prefixes in `ExtractAPI` anymore, see the
discussion in sbt/zinc#87 for more information.
@smarter smarter force-pushed the bug/inv-subtyping branch from e66cbcb to cae569b Compare April 20, 2016 16:27
smarter added a commit to smarter/sbt that referenced this pull request Apr 20, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
smarter added a commit to smarter/sbt that referenced this pull request Apr 20, 2016
This is a backport of sbt/zinc#95

The previous approach to value class API (introduced by sbt#2261 and
refined by sbt#2413 and sbt#2414) was to store both unerased and
erased signatures so that changes to value classes forced
recompilations.
This is no longer necessary thanks to sbt#2523: if a class type is
used, then it becomes a dependency of the current class and its name is
part of the used names of the current class. Since the name hash of a
class changes if it stops or start extending AnyVal, this is enough to
force recompilation of anything that uses a value class type. If the
underlying type of a value class change, its name hash doesn't change,
but the name hash of `<init>` changes and since every class uses the name
`<init>`, we don't need to do anything special to trigger recompilations
either.
@smarter
Copy link
Contributor Author

smarter commented Apr 24, 2016

types-in-used-names-b is flaky but I have no idea why, it succeeds sometimes when it should always fail. Adding sleep 1000 like in #2565 didn't help.

eed3si9n added a commit to eed3si9n/sbt that referenced this pull request May 2, 2016
eed3si9n added a commit to eed3si9n/sbt that referenced this pull request May 3, 2016
eed3si9n added a commit to eed3si9n/sbt that referenced this pull request May 4, 2016
@eed3si9n eed3si9n merged commit cae569b into sbt:0.13 May 4, 2016
@eed3si9n eed3si9n removed the ready label May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants