Skip to content

Issue 9631 - Error message not using fully qualified name#7405

Merged
dlang-bot merged 3 commits intodlang:masterfrom
ntrel:qualify-symbol
Dec 13, 2017
Merged

Issue 9631 - Error message not using fully qualified name#7405
dlang-bot merged 3 commits intodlang:masterfrom
ntrel:qualify-symbol

Conversation

@ntrel
Copy link
Copy Markdown
Contributor

@ntrel ntrel commented Dec 7, 2017

Fix cannot implicitly convert expression of type T to T ambiguous errors.
Add Type.toAutoQualChars().

There are other related errors that could use this fix, this only addresses the first test case in bugzilla.

Fix "cannot implicitly convert expression" ambiguous errors.
Add Type.toAutoQualChars().
@ntrel ntrel requested a review from WalterBright as a code owner December 7, 2017 13:24
@dlang-bot
Copy link
Copy Markdown
Contributor

Thanks for your pull request, @ntrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Auto-close Bugzilla Description
9631 Error message not using fully qualified name when appropriate.

src/ddmd/mtype.d Outdated
return buf.extractString();
}

static const(char*)[2] toAutoQualChars(Type t1, Type t2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add DDoc comment header.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, why the word "Auto"? I would have expected something like toFullyQualChars.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will do. Auto is because it only qualifies the types if they would otherwise collide. Suggestions welcome.

Copy link
Copy Markdown
Contributor

@JinShil JinShil Dec 7, 2017

Choose a reason for hiding this comment

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

Ok, I see. No need to change it in my opinion. I was just curious.

Copy link
Copy Markdown
Member

@WalterBright WalterBright left a comment

Choose a reason for hiding this comment

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

Needs Ddoc header for toAutoQualChars() function. Also, please make it a non-member function instead of static.

* For printing two types with qualification when necessary.
* Disambiguates the case where toChars() on each type match.
*/
const(char*)[2] toAutoQualChars(Type t1, Type t2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still needs "Returns" and "Params". See https://dlang.org/spec/ddoc.html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added Returns. I don't know anything meaningful to put for Params.

* Disambiguates the case where toChars() on each type match.
* Returns: Names of types.
*/
const(char*)[2] toAutoQualChars(Type t1, Type t2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about this?

/**
* For printing two types with qualification when necessary.
* Params:
*    t1 = The first type to receive the type name for
*    t2 = The second type to receive the type name for
* Returns:  
*    The fully-qualified names of both types if the two type names are not the same, 
*    or the unqualified names of both types if the two type names are the same.
*/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added.

@ntrel
Copy link
Copy Markdown
Contributor Author

ntrel commented Dec 13, 2017

BTW I have follow up fixes for 3 other kinds of error message where the same fix applies, will submit soon.


void main()
{
T2!().F x = T1!().F();
Copy link
Copy Markdown
Contributor

@JinShil JinShil Dec 13, 2017

Choose a reason for hiding this comment

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

Sorry @ntrel but this isn't passing coverage. You'll have to add a test that tests the case when both t1 and t2 are the same different (or so I assume). I'm not sure what's missing, but it needs additional tests to increase coverage.

Copy link
Copy Markdown
Contributor

@JinShil JinShil Dec 13, 2017

Choose a reason for hiding this comment

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

Nevermind, The coverage report looks weird, and the project coverage looks good, so let's merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants