Skip to content

Conversation

@robsimmons
Copy link
Collaborator

No description provided.


public abbrev DirectiveExpanderOf α := α → TSyntaxArray `block → DocElabM Term

public abbrev DirectiveElaborator := Array Arg → TSyntaxArray `block → DocElabM (Array Target.Block)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want this old-school version to be public?

let n ← mkFreshUserName <| declName ++ `directive

-- Find the appropriate adapter for both new (`DirectiveElabOf`) and legacy (`DirectiveExpanderOf`) declarations
let constructor ← match (← getEnv).find? declName |>.map (·.type.getAppFn) with
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is probably correct, but I figured I'd flag it up just to be sure. Right now, this will reject user-written abbrevs that expand to one of the allowed forms. The check could be done modulo defeq to allow those. I think this is correct anyway because I think the attributes reject types that don't strictly have this form, but I thought it was worth double-checking.

let n ← mkFreshUserName <| declName ++ `directive

-- Find the appropriate adapter for both new (`DirectiveElabOf`) and legacy (`DirectiveExpanderOf`) declarations
let constructor ← match (← getEnv).find? declName |>.map (·.type.getAppFn) with
Copy link
Collaborator

Choose a reason for hiding this comment

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

constructor has a specific meaning that I think we should avoid overloading. What about adapter?

}

private unsafe def directiveExpandersForUnsafe' (x : Name) : DocElabM (Array (DirectiveExpander × Option String × Option SigDoc)) := do
private unsafe def directiveExpandersForUnsafe' (x : Name) : DocElabM (Array (DirectiveElaborator × Option String × Option SigDoc)) := do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the function be renamed too?

Suggested change
private unsafe def directiveExpandersForUnsafe' (x : Name) : DocElabM (Array (DirectiveElaborator × Option String × Option SigDoc)) := do
private unsafe def directiveElabsForUnsafe' (x : Name) : DocElabM (Array (DirectiveElaborator × Option String × Option SigDoc)) := do

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