Skip to content

Type ascribe arguments of bottom type to inline functions #11917

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 2 commits into from
Mar 28, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 27, 2021

Fixes #11864
Fixes #8612

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

Otherwise, LGTM

true
computeParamBindings(
tp.resultType, targs.drop(tp.paramNames.length), argss,
paramSubst.andThen(_.substParams(tp, targs.map(_.tpe.stripTypeVar))))
Copy link
Contributor

@liufengyun liufengyun Mar 27, 2021

Choose a reason for hiding this comment

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

It seems the usage of tp will disregard the prefix -- maybe methPart.tpe.widen is more accurate? Meanwhile, the current fix does not handle dependent types. Will it be simpler to extract the types from the fun part of Apply trees instead of recomputing them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good observation. Yes, that should be fixed.

def paramTypess(call: Tree, acc: List[List[Type]]): List[List[Type]] = call match
case Apply(fn, args) =>
fn.tpe.widen.match
case mt: MethodType => paramTypess(fn, mt.instantiateParamInfos(args.tpes) :: acc)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering will mt.paramInfos work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because parameter types can depend on parameters in the same clause.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's tested in test4, which failed before when I used paramInfos.

@odersky odersky merged commit 75a4589 into scala:master Mar 28, 2021
@odersky odersky deleted the fix-11864 branch March 28, 2021 13:50
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

Type member selection on argument of type Nothing fails Inline member selection breaks with Nothing arguments
3 participants