diff --git a/lib/jsdoc/util/templateHelper.js b/lib/jsdoc/util/templateHelper.js
index 78886687..684cc525 100644
--- a/lib/jsdoc/util/templateHelper.js
+++ b/lib/jsdoc/util/templateHelper.js
@@ -264,7 +264,7 @@ function hasUrlPrefix(text) {
function isComplexTypeExpression(expr) {
// record types, type unions, and type applications all count as "complex"
- return expr.search(/[{(|]/) !== -1 || expr.search(/) > 0;
+ return /^{.+}$/.test(expr) || /^.+\|.+$/.test(expr) || /^.+<.+>$/.test(expr);
}
function fragmentHash(fragmentId) {
diff --git a/test/specs/jsdoc/util/templateHelper.js b/test/specs/jsdoc/util/templateHelper.js
index ab239f4f..45f5cf0d 100644
--- a/test/specs/jsdoc/util/templateHelper.js
+++ b/test/specs/jsdoc/util/templateHelper.js
@@ -333,11 +333,13 @@ describe("jsdoc/util/templateHelper", function() {
beforeEach(function() {
helper.longnameToUrl.linktoTest = 'test.html';
helper.longnameToUrl.LinktoFakeClass = 'fakeclass.html';
+ helper.longnameToUrl['Foo#bar(baz)'] = 'foo-bar-baz.html';
});
afterEach(function() {
delete helper.longnameToUrl.linktoTest;
delete helper.longnameToUrl.LinktoFakeClass;
+ delete helper.longnameToUrl['Foo#bar(baz)'];
});
it('returns the longname if only the longname is specified and has no URL', function() {
@@ -414,6 +416,12 @@ describe("jsdoc/util/templateHelper", function() {
expect(logger.error).not.toHaveBeenCalled();
});
+ it('does not treat a longname with a variation as a type application', function() {
+ var link = helper.linkto('Foo#bar(baz)', 'link text');
+
+ expect(link).toBe('link text');
+ });
+
it('returns a link when a URL is specified', function() {
var link = helper.linkto('http://example.com');
expect(link).toBe('http://example.com');