{"action":"created","issue":{"url":"https://api.github.com/repos/less/less.js/issues/2586","labels_url":"https://api.github.com/repos/less/less.js/issues/2586/labels{/name}","comments_url":"https://api.github.com/repos/less/less.js/issues/2586/comments","events_url":"https://api.github.com/repos/less/less.js/issues/2586/events","html_url":"https://github.com/less/less.js/issues/2586","id":73917684,"number":2586,"title":"Bug: extend compiled incorrectly (leaks through nested `&`)","user":{"login":"justpusher","id":3765965,"avatar_url":"https://avatars.githubusercontent.com/u/3765965?v=3","gravatar_id":"","url":"https://api.github.com/users/justpusher","html_url":"https://github.com/justpusher","followers_url":"https://api.github.com/users/justpusher/followers","following_url":"https://api.github.com/users/justpusher/following{/other_user}","gists_url":"https://api.github.com/users/justpusher/gists{/gist_id}","starred_url":"https://api.github.com/users/justpusher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justpusher/subscriptions","organizations_url":"https://api.github.com/users/justpusher/orgs","repos_url":"https://api.github.com/users/justpusher/repos","events_url":"https://api.github.com/users/justpusher/events{/privacy}","received_events_url":"https://api.github.com/users/justpusher/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/less/less.js/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/less/less.js/labels/Medium%20Priority","name":"Medium Priority","color":"0000E0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-07T09:35:18Z","updated_at":"2015-05-07T21:10:22Z","closed_at":null,"body":"The following LESS source is compiled incorrectly:\r\n\r\n    .bordered {\r\n        border: solid 1px black;\r\n    }\r\n    \r\n    .somepage {\r\n        .content:extend(.bordered) {\r\n            &>span {\r\n                margin-bottom: 10px;\r\n            }\r\n        }\r\n    }\r\n\r\nProduced CSS file:\r\n\r\n    .bordered,\r\n    .somepage .content,\r\n    .somepage .content > span {\r\n      border: solid 1px black;\r\n    }\r\n    .somepage .content > span {\r\n      margin-bottom: 10px;\r\n    }\r\n\r\nborder rule for .somepage .content > span is incorrect.\r\n\r\nThe simpler following source will be compiled correctly:\r\n\r\n    .bordered {\r\n        border: solid 1px black;\r\n    }\r\n    \r\n    .content:extend(.bordered) {\r\n        &>span {\r\n            margin-bottom: 10px;\r\n        }\r\n    }\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/less/less.js/issues/comments/100020376","html_url":"https://github.com/less/less.js/issues/2586#issuecomment-100020376","issue_url":"https://api.github.com/repos/less/less.js/issues/2586","id":100020376,"user":{"login":"seven-phases-max","id":5304376,"avatar_url":"https://avatars.githubusercontent.com/u/5304376?v=3","gravatar_id":"","url":"https://api.github.com/users/seven-phases-max","html_url":"https://github.com/seven-phases-max","followers_url":"https://api.github.com/users/seven-phases-max/followers","following_url":"https://api.github.com/users/seven-phases-max/following{/other_user}","gists_url":"https://api.github.com/users/seven-phases-max/gists{/gist_id}","starred_url":"https://api.github.com/users/seven-phases-max/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seven-phases-max/subscriptions","organizations_url":"https://api.github.com/users/seven-phases-max/orgs","repos_url":"https://api.github.com/users/seven-phases-max/repos","events_url":"https://api.github.com/users/seven-phases-max/events{/privacy}","received_events_url":"https://api.github.com/users/seven-phases-max/received_events","type":"User","site_admin":false},"created_at":"2015-05-07T21:10:22Z","updated_at":"2015-05-07T21:10:22Z","body":">I wonder if that should be changed, because it's possible someone is relying on this behavior to inherit extend? \r\n\r\nBut this clearly a bug. All three snippets in my answer should produce the same result just by definition. \r\n```\r\nx:extend(y) {\r\n    // something ...\r\n}\r\n```\r\nand\r\n```\r\nx {\r\n    &:extend(y);\r\n    // something ...\r\n}\r\n```\r\nshould produce equal CSS regardless of `something`.\r\nSame way notice in the last OP example the compiler already does skip `:extend` for the first level nesting selector (so the error is most likely just in first-level-check-only instead of all the way through)."}}