Skip to content

Conversation

Duhemm
Copy link
Contributor

@Duhemm Duhemm commented Jun 26, 2025

Previously, sbt would crash when attempting to load a build where projects had minus signs (-) in their name.

For instance, when trying to load a project defined like this:

lazy val `my-project` = project

After compilation, this definition looks somewhat like this

val my$minusproject$lzy1 = ...

sbt was attempting to retrieve the original definition (without the $lzy suffix) by taking the mangled name up to the first $. Unfortunately, this approach does not work when the name includes special characters like a minus sign, because these will be prefixed with $ as well. In the current example, sbt would then try to find the member named my, fail, and crash.

This patch fixes the issue by using the "underlying" name, which is the name without the additional information.

Previously, sbt would crash when attempting to load a build where
projects had minus signs (`-`) in their name.

For instance, when trying to load a project defined like this:

    lazy val `my-project` = project

After compilation, this definition looks somewhat like this

    val my$minusproject$lzy1 = ...

sbt was attempting to retrieve the original definition (without the $lzy
suffix) by taking the mangled name up to the first `$`. Unfortunately,
this approach does not work when the name includes special characters
like a minus sign, because these will be prefixed with `$` as well. In
the current example, sbt would then try to find the member named `my`,
fail, and crash.

This patch fixes the issue by using the "underlying" name, which is the
name without the additional information.
@Duhemm Duhemm force-pushed the mduhem/name-dash branch from 76ec728 to 79dbcd2 Compare June 26, 2025 08:58
Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Duhemm!

@eed3si9n eed3si9n merged commit 3342752 into sbt:develop Jun 27, 2025
12 checks passed
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