Skip to content

Conversation

@seoethereal
Copy link
Contributor

Fix for issue #231. This essentially refines the tag types so that the tags can actually be used inside the doctype's case class constructor.

There is a regression introduced during the Scala 3 upgrade where the
`scalatags.Text.all.doctype` case class no longer worked with the
pre-existing tags since its second argument accepts a
`scalatags.text.Frag` but the tags themselves refined to
`<tag-name>.Self` (the <tag-name> is a placeholder for the tag's name).
As it turns out, this self type was not being refined by the tags
themselves because for some reason, the Scala 3 compiler resolves this
type to be `scalatags.generic.TypedTag` i.e. it resolves to the more
generic type as opposed to the more specific type of
`scalatags.Text.TypedTag`. Fortunately in Scala 2, this works out fine
as the type does get refined and therefore the tags can be used inside
a `scalatags.text.Frag`.

This commit essentially adds type annotations to all the tags under the
text package so that the more specific `ConcreteHtmlTag[String]` is used
instead of the more generic `TypedTag`.


def check(txt: String, expected: String) = {
// augmentString = work around scala/bug#11125 on JDK 11
Copy link
Member

Choose a reason for hiding this comment

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

If you use linesIterator then you can probably remove the Predef.augmentSring workaround and the comment.
Anyways, I would do that in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably. I only replaced lines with linesIterator since it gave warnings about lines being deprecated or something.

@lolgab
Copy link
Member

lolgab commented Dec 17, 2021

Actually I had to do this in other tags to make the tests pass. But I didn't do for all of them so I created a bug.
Good that you did it :) thanks!

@lolgab lolgab merged commit 47f8f7f into com-lihaoyi:master Dec 17, 2021
@keynmol
Copy link

keynmol commented Jan 19, 2022

@lolgab would you mind releasing a new version with these changes?
Or is there another change that is needed to make it usable on Scala 3?

@lolgab
Copy link
Member

lolgab commented Jan 19, 2022

@keynmol Thanks for the reminder. Pushed version 0.11.1.
If there are other changes needed we can push 0.11.2 :)

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.

3 participants