Skip to content

Commit

Permalink
Improve error on except constructor rename.
Browse files Browse the repository at this point in the history
  • Loading branch information
toinehartman committed Aug 7, 2024
1 parent e4c6d50 commit e0b7c41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ tuple[Cursor, WorkspaceInfo] getCursor(WorkspaceInfo ws, Tree cursorT) {
, <findSmallestContaining({l | l <- ws.facts, at := ws.facts[l], (at is aset || at is alist) && at.elmType.alabel? && at.elmType.alabel == cursorName}, cursorLoc), collectionField()>
// Module name declaration, where the cursor location is in the module header
, <flatMap(locationOfName(parseModuleWithSpacesCached(cursorLoc.top).top.header), Maybe[loc](loc nameLoc) { return isContainedIn(cursorLoc, nameLoc) ? just(nameLoc) : nothing(); }), moduleName()>
// Nonterminal constructor names in exception productions
, <findSmallestContaining({l | l <- ws.facts, at := ws.facts[l], at is conditional}, cursorLoc), exceptConstructor()>
}
};
Expand Down Expand Up @@ -320,6 +322,7 @@ tuple[Cursor, WorkspaceInfo] getCursor(WorkspaceInfo ws, Tree cursorT) {
}
if (cur.l.scheme == "unknown") throw unsupportedRename("Could not retrieve information for \'<cursorName>\' at <cursorLoc>.");
if (cur.kind is exceptConstructor) throw unsupportedRename("Constructors can not be renamed from except productions.");
return <cur, ws>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ data CursorKind
| typeParam()
| collectionField()
| moduleName()
| exceptConstructor()
;

data Cursor
Expand Down

0 comments on commit e0b7c41

Please sign in to comment.