Check macro expansion type - #25756
Conversation
2309b50 to
c2ac5fd
Compare
|
Error in Monocle: |
|
Right: See also test, |
|
The culprit is |
ecee1ad to
7bb2c25
Compare
7bb2c25 to
2b47054
Compare
|
Pragmatically, maybe we should first introduce this check only when |
|
Ah, we do pass scala3/community-build/src/scala/dotty/communitybuild/projects.scala Lines 122 to 127 in 2b47054 |
Discussing with @bishabosha and further investigating, I realized the warning I introduced yesterday in #25750 is wrong. Code generated by macros is actually checked, even without `-Xcheck-macros`, here: https://github.com/scala/scala3/blob/20fc4c757617742af469c925d48beaf888f7ebfe/compiler/src/dotty/tools/dotc/inlines/Inliner.scala#L966-L967 The errors I am missing are due to these checks being run without an expected type, which I'll try to address separately (#25756). This PR reverts #25750, but still rephrase to avoid saying these are _runtime_ checks.
2b47054 to
8e2dfc1
Compare
|
Monocle PR: optics-dev/Monocle#1574. |
cd0c6c7 to
637ce99
Compare
Bump the Monocle submodule to optics-dev/Monocle@2de8183 ("Remove whitebox cast from GenIso.fields", scala#1602), which drops the whitebox cast that is rejected once macro expansion types are checked. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
637ce99 to
323de5a
Compare
|
@bishabosha the CI is now green. Monocle was the only error; I updated it upstream and in the community build. Do you still approve? 😄 |
Macro-generated trees are type-checked internally but not with respect to the expected type, such that you can write the following and get a runtime exception:
This PR attempts to fix that by checking the generated-tree type with respect to the parent splice type.