Skip to content

Avoid "missing parameter type" error when checking isMatchedBy #4165

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 24, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 23, 2018

When checking whether a FunProto is applicable to an argument, we should avoid
falling into "missing parameter type" errors. Better to assume a WildcardType
for the argument instead. This follows the general principle to err on the side
of generosity when checking isMatchedBy.

When checking whether a FunProto is applicable to an argument, we should avoid
falling into "missing parameter type" errors. Better to assume a WildcardType
for the argument instead. This follows the general principle to err on the side
of generosity when checking `isMatchedBy`.
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

Please add a testcase, otherwise LGTM.

myTypedArg = myTypedArg.updated(arg, targ)
evalState = evalState.updated(arg, (ctx.typerState, ctx.typerState.constraint))
if (!force && untpd.functionWithUnknownParamType(arg).isDefined)
// If force = true, assume ? rather than reporting an error.
Copy link
Member

Choose a reason for hiding this comment

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

You mean, force = false ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, yes.

@odersky
Copy link
Contributor Author

odersky commented Mar 24, 2018

I got:

Running Vulpix meta test
++ mktemp

  • tmp=/tmp/tmp.NBPEpn
  • ./project/scripts/sbt 'dotty-compiler/testOnly dotty.tools.vulpix.VulpixMetaTests'
    ++ mktemp
  • tmp1=/tmp/tmp.NaCJLh
  • sed '/Test run started/,$!d'
  • cat /tmp/tmp.NBPEpn
  • set +x
    failed Vulpix meta: the output of sbt differs from the expected output
    expected : 2 | a // Does not compile
    actual : [error]

This after changing a simple doc comment. It looks like the Vulpix meta test is flakey. We need to fix it or disable it. (This is not the first time it happened to me).

@odersky odersky merged commit 771d4c4 into scala:master Mar 24, 2018
@allanrenucci allanrenucci deleted the change-avoid-missing-param branch March 24, 2018 20:32
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